From 077e7e0b799bd87747e77307e47d9a70bceaffe9 Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 4 Oct 2026 09:37:57 +0800 Subject: [PATCH] =?UTF-8?q?gui=20tests:=20routing-manual=20and=20routing-t?= =?UTF-8?q?ime=20follow=20the=20group=20editor's=20hints=20under=20Routing?= =?UTF-8?q?=20=E2=80=94=20a802d98b=20(#576)=20added=20a=20second=20hint=20?= =?UTF-8?q?under=20the=20editor's=20Routing=20segs=20(a=20group=20among=20?= =?UTF-8?q?the=20models=20keeps=20its=20own=20routing),=20so=20routing-man?= =?UTF-8?q?ual's=20row.locator(".hint")=20matched=20two=20and=20failed=20s?= =?UTF-8?q?trict=20mode,=20and=20the=20taller=20editor=20put=20Add=20a=20r?= =?UTF-8?q?ule=20below=20the=20fold=20in=20routing-time,=20where=20Playwri?= =?UTF-8?q?ght's=20scroll=20into=20view=20is=20put=20back=20by=20the=20app?= =?UTF-8?q?=20(only=20the=20reader=20moves=20the=20view)=20and=20the=20cli?= =?UTF-8?q?ck=20timed=20out.=20The=20UI=20change=20was=20deliberate:=20rou?= =?UTF-8?q?ting-manual=20reads=20the=20routing's=20own=20hint=20as=20the?= =?UTF-8?q?=20row's=20first=20.hint,=20and=20routing-time=20wheels=20Add?= =?UTF-8?q?=20a=20rule=20into=20the=20middle=20of=20the=20view=20first,=20?= =?UTF-8?q?as=20routing-manual=20already=20does=20for=20its=20rows.=20All?= =?UTF-8?q?=2030=20routing-*.test.cjs=20(85=20tests)=20pass=20in=20WebKit;?= =?UTF-8?q?=20no=20app=20code=20changed.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/gui/tests/routing-manual.test.cjs | 7 ++++--- internal/gui/tests/routing-time.test.cjs | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/internal/gui/tests/routing-manual.test.cjs b/internal/gui/tests/routing-manual.test.cjs index 2a1c83520..e4c179059 100644 --- a/internal/gui/tests/routing-manual.test.cjs +++ b/internal/gui/tests/routing-manual.test.cjs @@ -136,11 +136,12 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await page.waitForTimeout(400); }; await wheelTo(row); - assert.equal(await row.locator(".hint").textContent(), w.hint); + // the routing's own hint is the first; a group-in-group note follows it + assert.equal(await row.locator(".hint").first().textContent(), w.hint); await row.locator(".segs .opt", { hasText: w.smart }).click(); - assert.notEqual(await row.locator(".hint").textContent(), w.hint); + assert.notEqual(await row.locator(".hint").first().textContent(), w.hint); await row.locator(".segs .opt", { hasText: w.manual }).click(); - assert.equal(await row.locator(".hint").textContent(), w.hint); + assert.equal(await row.locator(".hint").first().textContent(), w.hint); assert.ok((await ed.innerText()).includes(w.rulesWait)); const b = ed.locator("button.primary", { hasText: w.save }); await wheelTo(b); diff --git a/internal/gui/tests/routing-time.test.cjs b/internal/gui/tests/routing-time.test.cjs index 5481af599..fb3b7ba64 100644 --- a/internal/gui/tests/routing-time.test.cjs +++ b/internal/gui/tests/routing-time.test.cjs @@ -105,8 +105,19 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(await days1.getAttribute("class"), "rt-cond on"); assert.equal(await rows.first().locator(".rt-rwarn").textContent(), w.night); - // a second rule: its hours typed, nothing moved by a click - await ed.locator("button", { hasText: w.add }).click(); + // a second rule: its hours typed, nothing moved by a click. The + // reader wheels Add a rule into view first: the editor runs past the + // fold since the hints under Routing (a click's scroll is put back) + const wheelTo = async (x) => { + const d = await x.evaluate((e) => { const v = document.querySelector("#view-routing"); + return Math.round(e.getBoundingClientRect().top - v.getBoundingClientRect().top - v.clientHeight / 2); }); + await page.mouse.move(550, 400); + await page.mouse.wheel(0, d); + await page.waitForTimeout(400); + }; + const addBtn = ed.locator("button", { hasText: w.add }); + await wheelTo(addBtn); + await addBtn.click(); const row2 = rows.nth(1); const tm2 = row2.locator(".rt-cond.tm"); await tm2.waitFor();