From 70e7e36675eec14ec3d484fcfbbfa565d81c0cdd Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 6 Oct 2026 20:55:01 +0800 Subject: [PATCH] =?UTF-8?q?gui=20tests:=20a=20press=20is=20made=20only=20o?= =?UTF-8?q?n=20a=20target=20wholly=20in=20sight,=20so=20Playwright's=20cli?= =?UTF-8?q?ck=20doesn't=20scroll=20it=20the=20last=20fraction=20of=20a=20p?= =?UTF-8?q?ixel=20itself=20(request-archive-usage.test.cjs:=20"a=20click?= =?UTF-8?q?=20moved=20the=20page:=20860=20to=20861"=20in=20Chromium=20once?= =?UTF-8?q?=20the=20Usage=20page's=20archive=20switch=20shows,=20which=20#?= =?UTF-8?q?1017=20makes=20it=20do)=20=E2=80=94=20reader.inView=20took=20a?= =?UTF-8?q?=20target=20cut=20off=20by=20up=20to=20a=20pixel=20at=20the=20v?= =?UTF-8?q?iew's=20foot=20as=20in=20sight;=20Fetch=20from=20archive=20span?= =?UTF-8?q?ned=20539.80=E2=80=93562.59=20in=20a=20562px=20view=20(the=20sw?= =?UTF-8?q?itch=20makes=20.led-head=204px=20taller,=20so=20the=2020px=20wh?= =?UTF-8?q?eel=20steps=20land=20the=20rows=20elsewhere),=20and=20Playwrigh?= =?UTF-8?q?t's=20click=20scrollIntoViewIfNeeded'd=20it=201px=20before=20di?= =?UTF-8?q?spatching,=20before=20the=20app's=20capture-phase=20click=20lis?= =?UTF-8?q?tener=20took=20the=20positions=20hold()=20keeps,=20so=20the=20a?= =?UTF-8?q?pp=20saw=20nothing=20to=20put=20back.=20A=20raw=20page.mouse.cl?= =?UTF-8?q?ick=20at=20the=20same=20point=20moves=20nothing;=20no=20page=20?= =?UTF-8?q?code=20scrolls=20or=20focuses=20there,=20and=20overflow-anchor:?= =?UTF-8?q?=20none=20changes=20nothing.=20inView=20now=20wants=20the=20tar?= =?UTF-8?q?get=20wholly=20in=20the=20view=20(or,=20taller=20than=20it,=20i?= =?UTF-8?q?ts=20top=20in=20sight),=20and=20the=20press=20test's=20web=20?= =?UTF-8?q?=C2=B11=20allowance=20("settles=20a=20row's=20first=20opening?= =?UTF-8?q?=20up=20to=20a=20pixel=20off")=20is=20gone:=20a=20click=20moves?= =?UTF-8?q?=20the=20page=20by=20nothing.=20With=20#1017's=20diff=20applied?= =?UTF-8?q?,=20request-archive-usage.test.cjs=20failed=20in=20Chromium=20(?= =?UTF-8?q?both=20app=20modes)=20and=20passed=20in=20WebKit;=20with=20this?= =?UTF-8?q?=20it=20passes=205/5=20in=20both,=20and=203/3=20with=20the=20al?= =?UTF-8?q?lowance=20removed.=20The=2032=20suites=20using=20reader.cjs,=20?= =?UTF-8?q?request-archive*,=20usage-*,=20click-scroll=20and=20ledger-*=20?= =?UTF-8?q?pass=20in=20Chromium=20and=20WebKit=20(275/275).=20No=20app=20c?= =?UTF-8?q?hange.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/gui/tests/reader.cjs | 10 ++++++++-- internal/gui/tests/request-archive-usage.test.cjs | 4 +--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/internal/gui/tests/reader.cjs b/internal/gui/tests/reader.cjs index 72364a45..a747d5a8 100644 --- a/internal/gui/tests/reader.cjs +++ b/internal/gui/tests/reader.cjs @@ -1,5 +1,10 @@ // The app deliberately undoes unsolicited scrollIntoView (including Playwright's // automatic scroll). Bring a control into sight with real wheel input first. +// Wholly in sight: one cut off by a fraction of a pixel at the view's foot +// was scrolled the rest of the way by Playwright's click itself, before the +// app saw the click, and the page moved 1px under it (860 to 861 on the +// Usage page's Fetch from archive, once the archive switch in its header +// had moved the rows 4px down). async function inView(page, locator) { await locator.waitFor({state:"visible"}); if (await locator.evaluate(e => !e.closest("#view-usage"))) return; @@ -9,11 +14,12 @@ async function inView(page, locator) { for (let i = 0; i < 80; i++) { const b = await locator.boundingBox(); if (!b) { await page.waitForTimeout(40); continue; } - if (b.y >= v.y - 1 && b.y + b.height <= v.y + v.height + 1) { + // one taller than the view: its top in sight + if (b.y >= v.y && (b.y + b.height <= v.y + v.height || (b.height > v.height && b.y < v.y + v.height))) { await page.waitForTimeout(300); return; } - const delta = b.y < v.y - 1 ? -20 : 20; + const delta = b.y < v.y ? -20 : 20; await page.mouse.wheel(0, delta); await page.waitForTimeout(40); } diff --git a/internal/gui/tests/request-archive-usage.test.cjs b/internal/gui/tests/request-archive-usage.test.cjs index 5435d1c5..372c00e5 100644 --- a/internal/gui/tests/request-archive-usage.test.cjs +++ b/internal/gui/tests/request-archive-usage.test.cjs @@ -117,9 +117,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", const at = await top(); await loc.click(); await p.waitForTimeout(200); - // magpie web's page settles a row's first opening up to a pixel - // off, on main before #447 as well - assert(Math.abs((await top()) - at) <= (web ? 1 : 0), `a click moved the page: ${at} to ${await top()}`); + assert.equal(await top(), at, "a click moved the page"); }; const wait = async (n) => { for (let i = 0; i < 60 && seen.length < n; i++) await p.waitForTimeout(50); };