Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

gui tests: routing-bodies and routing-request-metrics wheel to a row like a reader before clicking it (#2559, #2658)

yetone2543fb2c18cc
diff --git a/internal/gui/tests/routing-bodies.test.cjs b/internal/gui/tests/routing-bodies.test.cjs
index 556bf0c1a..a8b87a464 100644
--- a/internal/gui/tests/routing-bodies.test.cjs
+++ b/internal/gui/tests/routing-bodies.test.cjs
@@ -12,6 +12,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
+const { reach } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const now = new Date();
@@ -105,9 +106,13 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
});
// a click at the middle of what is shown: with the page scrolled down
// to the story, Playwright's WebKit places what sits in a scroller
- // ~700px lower than it shows, and clicks the footer instead
+ // ~700px lower than it shows, and clicks the footer instead. The
+ // reader wheels it into sight first (reach): the page puts back any
+ // scroll that isn't the reader's, and Playwright's
+ // scrollIntoViewIfNeeded is code, so the row it scrolled to was put
+ // back under the footer or out of the window before the click (#2559).
const tap = async (loc) => {
- await loc.scrollIntoViewIfNeeded();
+ await reach(page, loc);
const [x, y] = await loc.evaluate((e) => { const r = e.getBoundingClientRect(); return [r.left + r.width / 2, r.top + r.height / 2]; });
await page.mouse.click(x, y);
};
diff --git a/internal/gui/tests/routing-request-metrics.test.cjs b/internal/gui/tests/routing-request-metrics.test.cjs
index 02dd375d7..4773d0fe4 100644
--- a/internal/gui/tests/routing-request-metrics.test.cjs
+++ b/internal/gui/tests/routing-request-metrics.test.cjs
@@ -5,6 +5,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
+const { reach } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const now = new Date();
@@ -144,9 +145,14 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// clicks where the page shows the picker and its menu: once the
// story's head wraps at this width (its "Request and response"
// button) the page is scrolled, and Playwright's WebKit then
- // places them hundreds of pixels lower, under the footer
+ // places them hundreds of pixels lower, under the footer. The
+ // reader wheels to them first (reach): the page puts back a
+ // scroll that isn't the reader's, as scrollIntoView from here
+ // is, and the click landed on whatever the put-back left there
+ // (#2658)
const tap = async (loc) => {
- const [x, y] = await loc.evaluate((e) => { e.scrollIntoView({ block: "center" }); const r = e.getBoundingClientRect(); return [r.left + r.width / 2, r.top + r.height / 2]; });
+ await reach(page, loc);
+ const [x, y] = await loc.evaluate((e) => { const r = e.getBoundingClientRect(); return [r.left + r.width / 2, r.top + r.height / 2]; });
await page.mouse.click(x, y);
};
await tap(page.locator("#rtMetrics"));