gui tests: Settings tabs are opened with Enter, not a click that waits on frames a loaded WebKit doesn't draw (#2150)

Cause: quota-reads (webkit de 360) timed out on
`:is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click()`. Its
call log ends at "waiting for element to be visible, enabled and stable",
with no "element is not stable" retries, so the tab wasn't moving.
Playwright's stability check compares the box over two
requestAnimationFrame callbacks. WebKit's frames are driven by its UI
process, and on a loaded machine they stall for seconds while the page's
ordinary tasks run on, so the click sat out the whole 5s page timeout over
a still tab.

Reproduced by injecting a delay: SIGSTOP/SIGCONT duty-cycling of WebKit's
UI process (10ms on / 990ms off) around the tab step in a copy of
quota-reads. click() took 3-4s and timed out in 4 of 6 runs.
press("Enter") on the same locator took 2-3s and passed 6 of 6.

Fix: reader.cjs gets openPart(page, id), which presses Enter on the tab or
its sidebar strip entry. Both are <button>s, so Enter clicks them with no
frame to wait for. All 49 call sites of that locator shape across 35 test
files use it now. The other shapes (getAttribute, focus, boundingBox, the
.nav-s strip's own pointer tests) are left as they are, since they test
the tab itself.

Run (playwright 1.62.0, chromium + webkit, each file's own languages and
widths): all 35 changed files, four at a time, at load average ~400 from
other sessions. 450 tests passed. sync-not-backup (#prefs not there yet)
and tray-inuse (a 180s browser launch timeout) failed one test each
before the tab step; alone they pass 20/20 and 4/4.

Not tried: the other rAF-polled waits across the suite (waitForFunction
defaults to rAF polling, and settingsDrawn is one of them). They starve
the same way under this load, but none is named in #2150 or #2151.
This commit is contained in:
yetone
2026-10-14 20:00:55 +08:00
parent fcd6f35198
commit 62e012b3e2
36 changed files with 94 additions and 57 deletions
@@ -14,6 +14,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -78,7 +79,7 @@ async function open(browser, lang, width, posts, over) {
await page.route("**/*", server(lang, posts, over));
await page.goto("http://magpie.test/?view=usage");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-privacy, .nav-s[data-of=setTab-privacy]):visible").click();
await openPart(page, "privacy");
await page.locator("#discoveryList .opt").first().waitFor();
return { context, page, errors };
}
+3 -2
View File
@@ -4,6 +4,7 @@ const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { fixture } = require("./fixtures/caller-keys.cjs");
const { openPart } = require("./reader.cjs");
async function palette(page, selectors) {
return page.evaluate((selectors) => {
@@ -119,11 +120,11 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.mouse.move(500, 400);
await page.mouse.wheel(0, -5000);
for (const choice of ["Dark", "Light", "System"]) {
await page.locator(":is(#setTab-general, .nav-s[data-of=setTab-general]):visible").click();
await openPart(page, "general");
await page.locator("#themeSegs").getByRole("button", { name: choice, exact: true }).click();
await page.waitForFunction((want) => (document.documentElement.dataset.theme || "system") === want, choice.toLowerCase());
await page.waitForFunction(() => !document.documentElement.classList.contains("theming"));
await page.locator(":is(#setTab-network, .nav-s[data-of=setTab-network]):visible").click();
await openPart(page, "network");
const { colors: c, elements: e } = await palette(page, { card: "#lanList", key: "#lanList .lan-url" });
assert.equal(e.card.bg, c.card);
assert.equal(e.key.color, c["fg-2"]);
+2 -2
View File
@@ -14,7 +14,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 } = require("./reader.cjs");
const { watchSettingsReads, settingsDrawn, openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -96,7 +96,7 @@ async function open(browser, lang, ctl, errors) {
await watchSettingsReads(page);
await page.goto("http://magpie.test/?view=settings");
await settingsDrawn(page); // rows found are the ones that stay (#1659)
await page.locator(":is(#setTab-about, .nav-s[data-of=setTab-about]):visible").click();
await openPart(page, "about");
await page.locator("#setPage-about").waitFor({ state: "visible" });
const row = page.locator("#about .row.pref.cli-row");
await row.locator(".cli-shell").first().waitFor();
@@ -2,6 +2,7 @@ const assert = require("node:assert/strict");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { fixture } = require("./fixtures/caller-keys.cjs");
const { openPart } = require("./reader.cjs");
// coeo91 on Discord: the LAN address picked as Gateway's Base URL went back
// to 127.0.0.1 after a restart or an update. The address and the gateway key
@@ -59,12 +60,12 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// Share on local network's address is kept the same way
await page.locator("#prefs").click();
await page.locator(":is(#setTab-network, .nav-s[data-of=setTab-network]):visible").click();
await openPart(page, "network");
await page.locator("#lanList .lan-address-row").waitFor();
await pick("#lanList .lan-interface", "10.0.0.10");
await page.reload();
await page.locator("#prefs").click();
await page.locator(":is(#setTab-network, .nav-s[data-of=setTab-network]):visible").click();
await openPart(page, "network");
await page.locator("#lanList .lan-address-row").waitFor();
assert.match(await shown("#lanList .lan-interface"), /10\.0\.0\.10:3999/);
+4 -3
View File
@@ -9,6 +9,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -94,7 +95,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// Settings: the currency row, its rate in the tooltip
await page.locator("#prefs").click();
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
await page.locator("#currencySegs .opt").first().waitFor();
const segs = page.locator("#currencySegs .opt");
assert.equal(await segs.count(), 2);
@@ -141,7 +142,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// and back to Settings, ¥ CNY is still picked after a reload
await page.reload();
await page.locator("#prefs").click();
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
await page.locator("#currencySegs .opt").first().waitFor();
assert.equal(await page.locator('#currencySegs .opt', { hasText: cny }).evaluate((b) => b.classList.contains("on")), true);
@@ -190,7 +191,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// Settings agrees
await page.locator("#prefs").click();
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
await page.locator("#currencySegs .opt").first().waitFor();
assert.equal(await page.locator("#currencySegs .opt", { hasText: cny }).evaluate((b) => b.classList.contains("on")), true);
@@ -4,6 +4,7 @@ const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { fixture, confirmKeyAction } = require("./fixtures/caller-keys.cjs");
const { openPart } = require("./reader.cjs");
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
for (const lang of ["en", "zh"]) {
@@ -71,7 +72,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert(events.some((e) => e.action === "export" && e.query.includes("callerKey=laptop") && !e.query.includes("key=") && !e.query.includes("user=")));
await page.reload();
await page.locator("#prefs").click();
await page.locator(":is(#setTab-network, .nav-s[data-of=setTab-network]):visible").click();
await openPart(page, "network");
const share = page.locator("#lanList").getByRole("button", { name: lang === "zh" ? "开启" : "On", exact: true });
await share.waitFor();
// Real wheel input lets the page remember the reader's scroll position.
@@ -117,7 +118,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.mouse.move(500, 400);
await page.mouse.wheel(0, -2000);
await page.waitForFunction(() => document.querySelector("#view-settings").scrollTop === 0);
await page.locator(":is(#setTab-network, .nav-s[data-of=setTab-network]):visible").click();
await openPart(page, "network");
await page.locator("#lanList .lan-address-row").waitFor();
await page.locator("#lanList").getByRole("button", { name: lang === "zh" ? "关闭" : "Off", exact: true }).click();
await page.locator("#lanList .lan-address-row").waitFor({ state: "detached" });
@@ -4,6 +4,7 @@ const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { fixture, confirmKeyAction } = require("./fixtures/caller-keys.cjs");
const { openPart } = require("./reader.cjs");
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
for (const locale of ["en", "zh"]) {
@@ -38,7 +39,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.locator("#prefs").click();
await page.locator(":is(#setTab-network, .nav-s[data-of=setTab-network]):visible").click();
await openPart(page, "network");
const on = page.locator("#lanList").getByRole("button", { name: w.on, exact: true });
await on.waitFor();
const bounds = await on.boundingBox();
@@ -69,7 +70,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
};
await page.route("**/api/caller-keys", lateList);
await page.locator("#prefs").click();
await page.locator(":is(#setTab-network, .nav-s[data-of=setTab-network]):visible").click();
await openPart(page, "network");
await page.locator("#lanList").waitFor();
await page.locator("#nav").getByRole("button", { name: w.gateway, exact: true }).click();
await started;
@@ -169,7 +170,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await expectSecret("fixture-created-2");
assert.equal(await page.locator("#connectKey code").textContent(), "Replacement");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-network, .nav-s[data-of=setTab-network]):visible").click();
await openPart(page, "network");
await page.locator("#lanList .lan-address-row").waitFor();
await page.locator("#lanList").getByRole("button", { name: w.off, exact: true }).click();
await page.locator("#lanList .lan-address-row").waitFor({ state: "detached" });
+2 -1
View File
@@ -14,6 +14,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const midnight = new Date();
@@ -164,7 +165,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await p.locator("#prefs").click();
await p.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(p, "usage");
await p.locator("#currencySegs .opt").first().waitFor();
if (lang === "en") {
assert.equal(await p.locator("#unitsRow").isHidden(), true, "no Number units row in English");
+3 -3
View File
@@ -5,7 +5,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 } = require("./reader.cjs");
const { watchSettingsReads, settingsDrawn, openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -128,13 +128,13 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal(p.otel.bodiesWhole, true);
assert.equal(p.otel.bodies, true);
assert.equal(await mode.textContent(), modes[2]);
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
p = await saved(() => page.locator("#currencySegs .opt").nth(1).click());
assert.equal(p.otel.enabled, true);
assert.equal(p.otel.bodiesWhole, true);
assert.equal(p.otel.endpoint, "https://collector.test/api/public/otel");
assert.equal(p.otel.headers.Authorization, "Basic YWJjZA==");
await page.locator(":is(#setTab-otel, .nav-s[data-of=setTab-otel]):visible").click();
await openPart(page, "otel");
p = await saved(() => page.locator("#otelExportRow .opt").first().click());
assert.equal(p.otel.enabled, false);
await page.reload();
@@ -14,6 +14,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -79,7 +80,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", server(lang, posts));
await page.goto("http://magpie.test/?view=usage");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
const pill = page.locator("#trayUsagePick button");
await pill.waitFor();
await pill.scrollIntoViewIfNeeded();
@@ -10,7 +10,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 } = require("./reader.cjs");
const { watchSettingsReads, settingsDrawn, openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -96,7 +96,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await watchSettingsReads(page);
await page.goto("http://magpie.test/?view=settings");
await settingsDrawn(page);
await page.locator(":is(#setTab-network, .nav-s[data-of=setTab-network]):visible").click();
await openPart(page, "network");
const sub = page.locator("#proxySub");
await sub.waitFor({ state: "visible" });
assert.equal((await sub.textContent()).trim(), words[lang][source], `${lang} ${source}`);
@@ -2,6 +2,7 @@ const assert = require("node:assert/strict");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { fixture } = require("./fixtures/caller-keys.cjs");
const { openPart } = require("./reader.cjs");
// #1551 (everpcpc): magpie web in Docker behind a reverse proxy, with
// MAGPIE_PUBLIC_URL=https://magpie.example.com. The page is opened from
@@ -36,7 +37,7 @@ async function setup(t, engine, lang, width, options) {
const shown = (sel) => page.locator(sel).textContent();
const settingsTab = async (tab) => {
if (!(await page.locator("#view-settings").isVisible())) await page.locator("#prefs").click();
await page.locator(`:is(#setTab-${tab}, .nav-s[data-of=setTab-${tab}]):visible`).click();
await openPart(page, tab);
};
const fits = async (where) => assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true, where + " wider than the window");
return { page, errors, open, shown, settingsTab, fits };
+2 -1
View File
@@ -13,6 +13,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const at = (h) => new Date(Date.now() + h * 3600e3).toISOString();
@@ -141,7 +142,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
t.after(() => browser.close());
const prefs = async (page) => {
await page.locator("#prefs").click();
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
await page.locator("#trayUsagePick button").waitFor();
};
const scrolled = (page) => page.locator("#view-settings").evaluate((v) => v.scrollTop);
+2 -1
View File
@@ -11,6 +11,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -82,7 +83,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", server(lang, posts));
await page.goto("http://magpie.test/?view=usage");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
const row = page.locator("#quotaReadsRow");
const opts = row.locator("#quotaReadsSegs .opt");
await opts.first().waitFor();
+11 -1
View File
@@ -94,4 +94,14 @@ async function watchSettingsReads(page) {
// settings, with no wait between, so once it is set the read is counted.
const settingsDrawn = (page) => page.waitForFunction(() => load.done && __settingsReads.asked === __settingsReads.drawn);
module.exports = { inView, reach, click, watchSettingsReads, settingsDrawn };
// openPart opens a part of Settings (a tab, or its entry in the sidebar's
// strip) the way the keyboard does. A click waits for the tab to hold still
// over two animation frames, and on a loaded machine WebKit draws no frames
// for seconds while the page itself runs on, so the click can sit out the
// test's whole timeout over a tab that isn't moving (#2150). Enter on the
// focused button clicks it with no frame to wait for.
async function openPart(page, id) {
await page.locator(`:is(#setTab-${id}, .nav-s[data-of=setTab-${id}]):visible`).press("Enter");
}
module.exports = { inView, reach, click, openPart, watchSettingsReads, settingsDrawn };
+2 -1
View File
@@ -8,6 +8,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -64,7 +65,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.goto("http://magpie.test/");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-sync, .nav-s[data-of=setTab-sync]):visible").click();
await openPart(page, "sync");
const list = page.locator("#syncList");
const first = list.locator(".row.pref").first();
await first.waitFor({ state: "visible" });
+2 -1
View File
@@ -17,6 +17,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const today = new Date(Date.now() + 8 * 3600e3).toISOString().slice(0, 10);
@@ -108,7 +109,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", server(lang, posts, over));
const go = async () => {
await page.locator("#prefs").click();
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
await page.locator("#warmSegs .opt").first().waitFor({ state: "attached" });
};
await page.goto("http://magpie.test/");
+2 -1
View File
@@ -14,6 +14,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -109,7 +110,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// a row's own words, in the language shown: that row alone, under
// its part's name, the tabs set aside
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
await type(page, await tr("Appearance"));
let s = await state(page);
assert.deepEqual([s.parts, s.tabs, s.none], [["general"], false, ""]);
@@ -18,6 +18,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -158,21 +159,21 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal(posts.length, posted, id + ": a tab posts nothing");
}
// the warm-ups are in Allowances, still a tab each
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
assert(await page.locator("#warmTab-codex").isVisible(), "the warm-ups under Allowances");
// a part's control posts what it did
await page.locator(":is(#setTab-general, .nav-s[data-of=setTab-general]):visible").click();
await openPart(page, "general");
await page.locator("#themeSegs .opt").nth(2).click();
for (let i = 0; i < 50 && !posts.length; i++) await page.waitForTimeout(40);
assert.equal(posts.at(-1)?.theme, "dark", "the theme still saves");
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
await page.locator("#currencySegs .opt").nth(1).click();
for (let i = 0; i < 50 && posts.at(-1)?.currency !== "cny"; i++) await page.waitForTimeout(40);
assert.equal(posts.at(-1).currency, "cny", "the currency still saves");
// the keyboard: one tab in the Tab order, the arrows, Home and End
await page.locator(":is(#setTab-privacy, .nav-s[data-of=setTab-privacy]):visible").click();
await openPart(page, "privacy");
assert.deepEqual(await page.locator("#setTabs [role=tab]").evaluateAll((bs) => bs.filter((b) => b.tabIndex === 0).map((b) => b.dataset.set)), ["privacy"]);
await page.locator(":is(#setTab-privacy, .nav-s[data-of=setTab-privacy]):visible").focus();
await page.keyboard.press("ArrowRight");
@@ -231,7 +232,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
const under = await page.evaluate(() => document.querySelector("#setPage-general").getBoundingClientRect().top - document.querySelector("#setTabs").getBoundingClientRect().bottom);
assert(under >= 0, what + ": the part under the tabs");
// the last tab, on the last line, reached with one click, moving nothing
await page.locator(":is(#setTab-about, .nav-s[data-of=setTab-about]):visible").click();
await openPart(page, "about");
await page.waitForTimeout(150);
assert.deepEqual((await shown(page)).parts, ["about"], what);
assert.equal(await top(page), 0, what + ": the click must not scroll the page");
@@ -14,6 +14,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -90,7 +91,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.goto("http://magpie.test/");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-sync, .nav-s[data-of=setTab-sync]):visible").click();
await openPart(page, "sync");
const list = page.locator("#syncList");
const rowNamed = (name) => list.locator(".row.pref").filter({ has: page.locator(".name", { hasText: name }) });
const auto = rowNamed(w.auto);
+2 -1
View File
@@ -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 { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const EN = "the file magpie/magpie.magpie-backup on the WebDAV server is empty (0 bytes): a write to it didn't finish.";
@@ -77,7 +78,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
page.setDefaultTimeout(5000);
await page.goto("http://magpie.test/");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-sync, .nav-s[data-of=setTab-sync]):visible").click();
await openPart(page, "sync");
const first = page.locator("#syncList .row.pref").first();
await first.waitFor({ state: "visible" });
const said = await first.locator(".who > .sub").first().textContent();
+2 -1
View File
@@ -13,6 +13,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const DAV = { kind: "webdav", url: "https://dav.example.com/dav/", user: "me", passwordSet: true };
@@ -89,7 +90,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.goto("http://magpie.test/");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-sync, .nav-s[data-of=setTab-sync]):visible").click();
await openPart(page, "sync");
const list = page.locator("#syncList");
const first = list.locator(".row.pref").first();
await first.waitFor({ state: "visible" });
+2 -2
View File
@@ -12,7 +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 { reach, openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -67,7 +67,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
page.setDefaultTimeout(5000);
await page.goto("http://magpie.test/");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-sync, .nav-s[data-of=setTab-sync]):visible").click();
await openPart(page, "sync");
const first = page.locator("#syncList .row.pref").first();
await first.waitFor({ state: "visible" });
const line = first.locator(".sync-sign-in");
+2 -1
View File
@@ -11,6 +11,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const CUT = "the WebDAV server kept 0 of 6869 bytes of 5f0c-2026-08-29.magpie-usage: the write was cut short — sync again, and if it keeps happening the network to the server is dropping long uploads";
@@ -68,7 +69,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
page.setDefaultTimeout(5000);
await page.goto("http://magpie.test/");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-sync, .nav-s[data-of=setTab-sync]):visible").click();
await openPart(page, "sync");
const first = page.locator("#syncList .row.pref").first();
await first.waitFor({ state: "visible" });
const status = first.locator(".who > .sub").first();
+2 -1
View File
@@ -10,6 +10,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -68,7 +69,7 @@ async function open(browser, lang, posts, platform, over) {
await page.route("**/*", server(lang, posts, over));
await page.goto("http://magpie.test/?view=usage");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
await page.locator("#trayUsagePick button").waitFor();
return { context, page };
}
+2 -1
View File
@@ -11,6 +11,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -76,7 +77,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", server(lang, posts));
await page.goto("http://magpie.test/?view=usage");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
const pill = page.locator("#trayUsagePick button");
await pill.waitFor();
await pill.scrollIntoViewIfNeeded();
+2 -1
View File
@@ -10,6 +10,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -68,7 +69,7 @@ async function open(browser, lang, posts, platform, over) {
await page.route("**/*", server(lang, posts, over));
await page.goto("http://magpie.test/?view=usage");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
await page.locator("#trayUsagePick button").waitFor();
return { context, page };
}
+2 -1
View File
@@ -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 { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -106,7 +107,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.goto("http://magpie.test/?view=usage");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
const pill = page.locator("#trayUsagePick button");
await pill.waitFor();
await pillIs(page, w.off);
@@ -8,6 +8,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const quotas = [
@@ -63,7 +64,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// from Agents: the Usage page would have read the allowances already
await page.goto("http://magpie.test/?view=agents");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
const pill = page.locator("#trayUsagePick button");
await pill.waitFor();
assert.equal(await page.evaluate(() => quotas), null, "the allowances were read before the click");
+3 -2
View File
@@ -11,6 +11,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -93,7 +94,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.goto("http://magpie.test/?view=usage");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
const pill = page.locator("#trayUsagePick button");
await pill.waitFor();
await page.waitForFunction(() => document.querySelector("#trayUsagePick button").textContent.trim() === "Copilot");
@@ -204,7 +205,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.goto("http://magpie.test/?view=usage");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-usage, .nav-s[data-of=setTab-usage]):visible").click();
await openPart(page, "usage");
const pill = page.locator("#trayUsagePick button");
await pill.waitFor();
await pill.evaluate((b) => b.click());
+3 -3
View File
@@ -11,7 +11,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 } = require("./reader.cjs");
const { watchSettingsReads, settingsDrawn, openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -103,7 +103,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await settingsDrawn(page); // rows found are the ones that stay (#1659)
// the rows are in Settings' About part
const aboutTab = async () => {
await page.locator(":is(#setTab-about, .nav-s[data-of=setTab-about]):visible").click();
await openPart(page, "about");
await page.locator("#setPage-about").waitFor({ state: "visible" });
};
await aboutTab();
@@ -179,7 +179,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await watchSettingsReads(page);
await page.goto("http://magpie.test/?view=settings");
await settingsDrawn(page);
await page.locator(":is(#setTab-about, .nav-s[data-of=setTab-about]):visible").click();
await openPart(page, "about");
await page.locator("#setPage-about").waitFor({ state: "visible" });
const auto = page.locator("#about .row.pref", { has: page.locator(".name", { hasText: new RegExp("^" + w.auto + "$") }) });
await auto.waitFor();
+2 -1
View File
@@ -10,6 +10,7 @@ const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -54,7 +55,7 @@ async function open(browser, lang, ctl, errors) {
page.on("pageerror", (e) => errors.push(e.message));
await page.route("**/*", server(lang, ctl));
await page.goto("http://magpie.test/?view=settings");
await page.locator(":is(#setTab-about, .nav-s[data-of=setTab-about]):visible").click();
await openPart(page, "about");
await page.locator("#setPage-about").waitFor({ state: "visible" });
return page;
}
+2 -2
View File
@@ -11,7 +11,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 } = require("./reader.cjs");
const { watchSettingsReads, settingsDrawn, openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -76,7 +76,7 @@ async function open(browser, lang, ctl, errors) {
await watchSettingsReads(page);
await page.goto("http://magpie.test/?view=settings");
await settingsDrawn(page); // rows found are the ones that stay (#1659)
await page.locator(":is(#setTab-about, .nav-s[data-of=setTab-about]):visible").click();
await openPart(page, "about");
await page.locator("#setPage-about").waitFor({ state: "visible" });
const row = page.locator("#about .row.pref.update-mirror-row");
await row.waitFor();
+2 -2
View File
@@ -11,7 +11,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 } = require("./reader.cjs");
const { watchSettingsReads, settingsDrawn, openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -105,7 +105,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.goto("http://magpie.test/?view=settings");
await settingsDrawn(page);
const aboutTab = async () => {
await page.locator(":is(#setTab-about, .nav-s[data-of=setTab-about]):visible").click();
await openPart(page, "about");
await page.locator("#setPage-about").waitFor({ state: "visible" });
};
await aboutTab();
+1 -1
View File
@@ -177,7 +177,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
const posts = [];
const { p, errors } = await open("http://magpie.test/", { width: 900, height: 420 }, false, [], [], posts);
await p.locator("#prefs").click();
await p.locator(":is(#setTab-sync, .nav-s[data-of=setTab-sync]):visible").click();
await reader.openPart(p, "sync");
const first = p.locator("#syncList .row.pref").first();
await first.waitFor({ state: "visible" });
const toEnd = async () => {
@@ -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 { openPart } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
@@ -63,7 +64,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.goto("http://magpie.test/");
await page.locator("#prefs").click();
await page.locator(":is(#setTab-sync, .nav-s[data-of=setTab-sync]):visible").click();
await openPart(page, "sync");
const list = page.locator("#syncList");
const first = list.locator(".row.pref").first();
await first.waitFor({ state: "visible" });