From c687dbdc6499879a26efba82a9a6fd5bfaf0400c Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 18 Nov 2026 05:47:36 +0800 Subject: [PATCH] gui tests: Settings' hint cards are hovered after a reader's wheel, not a scroll by code (#6353) settings-hints and settings-lines-wrap brought a Settings row into sight with scrollIntoView, then hovered its name. The app puts back any scroll the reader didn't ask for (gui-shell.md, "A click never moves"), so the view stayed at the top. In Japanese and German at 420/440px the image recognition MCP row starts below the 800px window (its name at y=809, #view-settings scrollTop 0 after the scroll and after Playwright's own), and the pointer landed on Image generation's row above: its card showed, "the card doesn't say the row's line", or no card at all (#6073, #6156). Both now wheel the view through reader.cjs's reach, as the other GUI tests do. The app is unchanged. Run on mica at this tree (origin/main 73a70275c + this change), both engines: settings-hints and settings-lines-wrap 42/42. At origin/main the same two files were red: settings-hints ja and de at 420px in both engines, settings-lines-wrap "chromium de 440px" (8s wait for .set-hint.on). Found by logging the name's box, elementFromPoint at its centre, and each scrolling ancestor's scrollTop around the hover. Not run: the whole GUI suite; Windows WebKit, where #6073 was seen. --- internal/gui/tests/settings-hints.test.cjs | 7 +++++-- internal/gui/tests/settings-lines-wrap.test.cjs | 8 +++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/internal/gui/tests/settings-hints.test.cjs b/internal/gui/tests/settings-hints.test.cjs index effb1c816..92ebb6e7d 100644 --- a/internal/gui/tests/settings-hints.test.cjs +++ b/internal/gui/tests/settings-hints.test.cjs @@ -18,7 +18,7 @@ const fs = require("node:fs/promises"); const path = require("node:path"); const { test } = require("node:test"); const { chromium, webkit } = require("playwright"); -const { watchSettingsReads, settingsDrawn, openPart } = require("./reader.cjs"); +const { watchSettingsReads, settingsDrawn, openPart, reach } = require("./reader.cjs"); const assets = path.resolve(__dirname, "../assets"); @@ -110,7 +110,10 @@ for (const engine of engines) { // the pointer resting on the row: a card with the whole line, and // nothing moves - await mcp.evaluate((e) => e.scrollIntoView({ block: "center" })); + // wheeled into sight, as a reader would: the app puts back a scroll + // by code, so in ja and de at 420px, where the row starts below the + // window, the pointer landed on the row above (#6353) + await reach(page, mcp.locator(":scope > .who > .name")); await page.mouse.move(1, 1); const before = await page.evaluate(boxes); await mcp.locator(":scope > .who > .name").hover(); diff --git a/internal/gui/tests/settings-lines-wrap.test.cjs b/internal/gui/tests/settings-lines-wrap.test.cjs index 95902a110..a17650754 100644 --- a/internal/gui/tests/settings-lines-wrap.test.cjs +++ b/internal/gui/tests/settings-lines-wrap.test.cjs @@ -16,7 +16,7 @@ const fs = require("node:fs/promises"); const path = require("node:path"); const { test } = require("node:test"); const { chromium, webkit } = require("playwright"); -const { watchSettingsReads, settingsDrawn, openPart } = require("./reader.cjs"); +const { watchSettingsReads, settingsDrawn, openPart, reach } = require("./reader.cjs"); const assets = path.resolve(process.env.MAGPIE_WRAP_ASSETS || path.join(__dirname, "../assets")); @@ -121,8 +121,10 @@ for (const engine of engines) { await s.waitFor({ state: "attached" }); if (await s.evaluate((e) => getComputedStyle(e).getPropertyValue("--hint").trim() === "1")) { // out of sight at rest: the row's card shows it whole - await s.evaluate((e) => e.closest(".row.pref").scrollIntoView({ block: "center" })); - await s.locator("xpath=ancestor::div[contains(concat(' ', @class, ' '), ' pref ')][1]").locator(":scope > .who > .name").hover(); + // wheeled into sight: a scroll by code is put back (#6353) + const name = s.locator("xpath=ancestor::div[contains(concat(' ', @class, ' '), ' pref ')][1]").locator(":scope > .who > .name"); + await reach(page, name); + await name.hover(); const card = page.locator(".set-hint.on"); await card.waitFor(); assert.ok((await card.textContent()).includes((await s.textContent()).trim()), `${sel} isn't in its card`);