From 9edc6506e0d976ce3c2a780af63d7856de0bb43f Mon Sep 17 00:00:00 2001 From: yetone Date: Mon, 9 Nov 2026 09:18:55 +0800 Subject: [PATCH] routing: a group's editor folds what few change under Advanced The owner found the Add group form too long. Name, In agents' lists, Models, Accounts, Rules and the classifier stay in the form; Patterns, Model lists, Routing, Rate limited, Slow to start, Every member busy, Context, Stays, Effort and Levels move into an Advanced fold (details.more, as the provider editor's). It opens by itself when the group sets any of them, remembers being opened or closed while the editor is up, and Save opens it when a typed pattern is invalid so the focus lands on it. The fold's inner grid takes the editor's label column (--ed-lab), so its labels line up with the ones above; without it English sat 30px off (group-editor-fits caught it), and at 520px and in the web layout it stacks like the rows above. edAlign now sets --ed-lab/--ed-at only when they change, and in an open fold a later change waits a frame (a closed fold only moves its chevron and follows at once): opening the fold re-measured inside the ResizeObserver callback and routing-rows-fit failed on "ResizeObserver loop completed with undelivered notifications". The GUI tests that edit those rows open Advanced first (openAdvanced in group-context, -unlists, -first-token, -patience, -defaults, -editor-align, -from-model-add); group-editor-align measures the fold's labels too. Run (Linux, WSL magpie-desktop, Chromium + WebKit, 5 languages): - the 34 GUI files red in a first run plus group-editor-fits and group-editor-selected, at this head rebased on 8935abcf5: 528 tests, 499 pass, 29 fail. The reds are i18n-keys (1, #5332 #5426 #5482), routing-intent-entry (8, #5392) and zero-priced-free (20, #5262); the same files fail the same way at base 4f3ec591a without this change. - the 112 GUI files that reach an editor's fold, the view's room or the group editor (details.advanced/.more, rt-gedit, --ed-lab, setRoom, click-scroll, i18n-keys), at this head and at base 8935abcf5: 2246 tests, 44 fail on each, the same tests but two that flipped once (provider-url-each-api 440px red here, 3 of 3 green alone; a long-text-box menu red at base only). Among them editor-advanced-align's chromium case (#4615) is red at base too. - the whole GUI suite was started and stopped part way (it would take hours on WSL); its reds so far are in #5559's list. - rebased on b68218f43 (a912cdc36 touched the groups page): every group-* file, routing-rows-fit, routing-save-blank and click-scroll again: 616 tests, 2 fail, both click-scroll's late wheel in WebKit (#4385, red at base too). - go test -run Budget ./internal/gui on mote at the pushed head: ok. Broken by hand: without the inner grid rule, group-editor-fits is red (373 vs 343 in English); without the edAlign change, routing-rows-fit is red on the ResizeObserver page error; without the previous commit, routing-save-blank is red. Not tried: the real app window, macOS (mote was overloaded with launch timeouts) and Windows. --- internal/gui/assets/app.js | 12 +++++-- internal/gui/assets/plugins/routing/client.js | 35 +++++++++++++------ .../gui/assets/plugins/routing/routing.css | 7 ++++ internal/gui/tests/group-context.test.cjs | 8 ++++- internal/gui/tests/group-defaults.test.cjs | 8 +++++ .../gui/tests/group-editor-align.test.cjs | 9 ++++- internal/gui/tests/group-first-token.test.cjs | 11 ++++++ .../gui/tests/group-from-model-add.test.cjs | 9 ++++- internal/gui/tests/group-patience.test.cjs | 7 ++++ internal/gui/tests/group-unlists.test.cjs | 7 ++++ 10 files changed, 97 insertions(+), 16 deletions(-) diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 93d16e2d9..f8fd19eb3 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -8981,8 +8981,16 @@ const edAlign = new ResizeObserver((es) => { if (!n.isConnected) { edAlign.unobserve(n); continue; } const cs = getComputedStyle(n.parentElement), cols = cs.gridTemplateColumns.split(" "); const lab = cols.length > 1 ? parseFloat(cols[0]) || 0 : 0; - n.style.setProperty("--ed-lab", lab + "px"); - n.style.setProperty("--ed-at", (lab && lab + parseFloat(cs.columnGap)) + "px"); + // only when changed, and in an open fold a change after the first a + // frame later: its rows take the column, so set while the observer is + // delivering, the fold's own height changes with it (a label wrapping) + // and the browser reports a loop as a page error (a group's editor + // narrowed with the window). A closed fold only moves its chevron, so + // it follows at once, never a frame out of line + const at = (lab && lab + parseFloat(cs.columnGap)) + "px"; + if (n.style.getPropertyValue("--ed-lab") === lab + "px" && n.style.getPropertyValue("--ed-at") === at) continue; + const set = () => { n.style.setProperty("--ed-lab", lab + "px"); n.style.setProperty("--ed-at", at); }; + if (n.open && n.style.getPropertyValue("--ed-at")) requestAnimationFrame(set); else set(); } }); const edAligned = (n) => (edAlign.observe(n), n); diff --git a/internal/gui/assets/plugins/routing/client.js b/internal/gui/assets/plugins/routing/client.js index ffae461ca..652f2df8c 100644 --- a/internal/gui/assets/plugins/routing/client.js +++ b/internal/gui/assets/plugins/routing/client.js @@ -7515,20 +7515,32 @@ function routingPage(part) { drawPats(); const pw = el("div"); pw.append(pbox, el("div", "hint", t("Every model a pattern matches is in the group, now and as providers list new ones, after the models above: * is any run of characters in provider/model, re: starts a regular expression."))); - ed.append(el("label", "", t("Patterns")), pw); + // what few change — patterns, the lists, routing, the waits, the + // window, how long a conversation stays, reasoning — folded under + // Advanced below the rules, as a provider's editor folds its own (the + // owner: the form was too much at once). Open when one of them is set, + // or as it was left while this group is being edited + const adv = edAligned(el("details", "more advanced rt-gadv")); + adv.open = gEdit.adv ?? !!(d.match.length || d.unlists || d.routing || d.sink === "sink" || d.sink === "" || d.firstToken || d.patience || d.context || d.affinity || d.effort || d.levels?.length); + const advOf = gEdit; + adv.onfold = (open) => { advOf.adv = open; }; + adv.append(el("summary", "", t("Advanced"))); + const advIn = el("div", "inner"); + adv.append(advIn); + advIn.append(el("label", "", t("Patterns")), pw); // its models in the lists agents see too, or the group alone (#1783) const listHint = el("div", "hint", t(LIST_HINT[d.unlists ? "unlists" : ""])), listW = el("div"); const listPick = segs(LIST_OPTS.map(([id, n]) => [id, t(n)]), d.unlists ? "unlists" : "", (v) => { d.unlists = v === "unlists"; listHint.textContent = t(LIST_HINT[v]); }); listPick.classList.add("list-pick"); listW.append(listPick, listHint); - ed.append(el("label", "", t("Model lists")), listW); + advIn.append(el("label", "", t("Model lists")), listW); const gHint = (v) => GROUP_HINT[v] ? t(GROUP_HINT[v]) : MODES[v] || !v ? t(GROUP_HINT[""]) : modeOf(v)[1]; const rHint = el("div", "hint", gHint(d.routing)); const rw = el("div"); rw.append(routingSegs(withJS(GROUP_ROUTE_OPTS, d.routing).map(([id, n, js]) => [id, t(n), , js]), d.routing, (v) => { d.routing = v; rHint.textContent = gHint(v); draw(); drawRules(); drawSink(); }), rHint); rw.append(el("div", "hint", t(GROUP_NEST))); - ed.append(el("label", "", t("Routing")), rw); + advIn.append(el("label", "", t("Routing")), rw); // one rate limited with quota left: its place, or the back const kHint = el("div", "hint"), kw = el("div", "sink-wrap"), kLab = el("label", "", t("Rate limited")); // Default follows the setting for every group, under the list @@ -7541,7 +7553,7 @@ function routingPage(part) { const kPick = segs(G_SINK_OPTS.map(([id, n]) => [id, t(n)]), d.sink ?? "def", (v) => { d.sink = v; drawSink(); }); kPick.classList.add("sink-pick"); kw.append(kPick, kHint); - ed.append(kLab, kw); + advIn.append(kLab, kw); drawSink(); // a member slow to begin its answer: waited for, or the next asked // or after as many minutes as the user types (Kismet Alan on Discord) @@ -7584,7 +7596,7 @@ function routingPage(part) { if (n > 0) d.firstToken = n; drawFirst(); }; - ed.append(el("label", "", t("Slow to start")), fw); + advIn.append(el("label", "", t("Slow to start")), fw); drawFirst(); // every member busy at once: the agent told, or the members asked // again within a budget (#1418) @@ -7596,7 +7608,7 @@ function routingPage(part) { : t("When every member has failed with an error that may pass — overloaded, unavailable, rate limited for a moment — and nothing of the reply has reached the agent, each is asked again after a pause, longer each time and never shorter than the vendor asks, for up to {n} more. A streaming agent is kept waiting meanwhile.", { n: patienceWord(pat) })); }; patW.append(segs(G_PATIENCE_OPTS.map(([n, l]) => [n, t(l)]), d.patience || 0, (v) => { d.patience = +v; drawPatience(); }), patHint); - ed.append(el("label", "", t("Every member busy")), patW); + advIn.append(el("label", "", t("Every member busy")), patW); drawPatience(); // the window agents are told: the largest member's, the smallest's, or // one the user names (Mikan on Discord) @@ -7641,12 +7653,12 @@ function routingPage(part) { if (n > 0) d.context = n; drawCtx(); }; - ed.append(el("label", "", t("Context")), ctxW); + advIn.append(el("label", "", t("Context")), ctxW); drawCtx(); const aHint = el("div", "hint", t(AFF_HINT[d.affinity] || AFF_HINT[""])); const aw = el("div"); aw.append(segs(AFF_OPTS.map(([id, n]) => [id, t(n)]), d.affinity, (v) => { d.affinity = v; aHint.textContent = t(AFF_HINT[v] || AFF_HINT[""]); }), aHint); - ed.append(el("label", "", t("Stays")), aw); + advIn.append(el("label", "", t("Stays")), aw); // rules: which member a turn goes to first, by what the request shows. // A rule reads as one line, a sentence: the conditions it has, then → @@ -8271,7 +8283,7 @@ function routingPage(part) { drawEffort(); drawClassifier(); }), eHint); drawEffort(); - ed.append(el("label", "", t("Effort")), ew); + advIn.append(el("label", "", t("Effort")), ew); ed.append(clabel, cw); drawRules(); // the levels agents are offered: those every model has, or ones the @@ -8307,7 +8319,8 @@ function routingPage(part) { drawLevels(); }), chips, lHint); drawLevels(); - ed.append(el("label", "", t("Levels")), lw); + advIn.append(el("label", "", t("Levels")), lw); + ed.append(adv); const bar = el("div", "bar view-foot"); if (g) { @@ -8320,7 +8333,7 @@ function routingPage(part) { cancel.onclick = cancelGroup; const saveBtn = el("button", "text primary", t(g ? "Save" : "Add")); const save = () => { - if (addPattern() === null) return pin.focus({ preventScroll: true }); // typed, not added: it is meant + if (addPattern() === null) return adv.open = true, pin.focus({ preventScroll: true }); // typed, not added: it is meant if (!d.members.length && !d.match.length) { addBtn.focus({ preventScroll: true }); return status(t("A group needs a model in it"), "warn"); } d.rules.forEach((r) => { r.intent = (r.intent || "").trim(); }); // hours: both times, or none and no days; days alone are all day diff --git a/internal/gui/assets/plugins/routing/routing.css b/internal/gui/assets/plugins/routing/routing.css index b92352129..cccdc6316 100644 --- a/internal/gui/assets/plugins/routing/routing.css +++ b/internal/gui/assets/plugins/routing/routing.css @@ -685,6 +685,11 @@ button.rt-session { cursor: pointer; } .rt-group.rt-gpick { cursor: default; } .rt-group.rt-gpick.on { background: var(--card-2); } .rt-gedit { cursor: default; scroll-margin-top: 12px; } +/* the rows folded under Advanced keep the editor's own columns, so their + fields start where the ones above do; a label longer than the column + wraps in it, as one above the fold does */ +.rt-gedit .rt-gadv .inner { grid-template-columns: var(--ed-lab, 72px) minmax(0, 1fr); } +.rt-gedit .rt-gadv .inner label { white-space: normal; } /* the group being edited reads as selected among the others: a soft tint and an accent ring, as a list marks its selected row; its Save and Cancel stay at the bottom of the window while its rows scroll by, at a @@ -741,6 +746,7 @@ body.window .rt-gedit > .bar { --vfoot: 8px; } body.web .rt-pick { flex-wrap: wrap; } body.web .rt-gedit { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 12px; } body.web .rt-gedit label { text-align: left; padding-top: 8px; } + body.web .rt-gedit .rt-gadv .inner { grid-template-columns: minmax(0, 1fr); gap: 6px; } body.web .rt-gedit .segs { flex-wrap: wrap; } body.web .rt-gedit .fbrow { flex-wrap: wrap; justify-content: normal; } body.web .rt-gedit .fbrow .n { flex: 1 1 calc(100% - 60px); white-space: normal; overflow-wrap: anywhere; } @@ -764,6 +770,7 @@ body.window .rt-gedit > .bar { --vfoot: 8px; } :where(.rt-gpage.max520) .rt-gsec .rt-gfilter { flex: 1 1 auto; width: auto; } :where(.rt-gpage.max520) .rt-gedit { grid-template-columns: minmax(0, 1fr); gap: 4px; } :where(.rt-gpage.max520) .rt-gedit label { text-align: left; padding-top: 8px; } +:where(.rt-gpage.max520) .rt-gedit .rt-gadv .inner { grid-template-columns: minmax(0, 1fr); gap: 4px; } :where(.rt-gpage.max520) .rt-gedit .segs .opt { padding-left: 9px; padding-right: 9px; } /* the models and patterns take the column's width and no more: a grid's auto track grows to its widest row's content, so a long model name with diff --git a/internal/gui/tests/group-context.test.cjs b/internal/gui/tests/group-context.test.cjs index 09e5034c6..52534c754 100644 --- a/internal/gui/tests/group-context.test.cjs +++ b/internal/gui/tests/group-context.test.cjs @@ -12,6 +12,12 @@ const fs = require("node:fs/promises"); const path = require("node:path"); const { test } = require("node:test"); const { chromium, webkit } = require("playwright"); +// the rows a group's editor folds under Advanced, opened +const openAdvanced = async (page) => { + const d = page.locator(".rt-gedit .rt-gadv"); + await d.waitFor({ state: "attached" }); + if (!(await d.evaluate((e) => e.open))) await d.locator(":scope > summary").click(); +}; const assets = path.resolve(__dirname, "../assets"); const models = [ @@ -92,7 +98,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await page.waitForFunction(() => !document.querySelector(".rt-gedit")); return posts.filter((p) => p.path === "/api/groups/save").at(-1).body; }; - const open = async () => { await card.locator("button", { hasText: w.edit }).click(); await row.waitFor().catch((e) => { throw new Error(errors.join(" / ") || e.message); }); }; + const open = async () => { await card.locator("button", { hasText: w.edit }).click(); await openAdvanced(page); await row.waitFor().catch((e) => { throw new Error(errors.join(" / ") || e.message); }); }; await open(); assert.equal(await row.locator(".opt.on").textContent(), w.largest); diff --git a/internal/gui/tests/group-defaults.test.cjs b/internal/gui/tests/group-defaults.test.cjs index 6564c80cd..a07832c89 100644 --- a/internal/gui/tests/group-defaults.test.cjs +++ b/internal/gui/tests/group-defaults.test.cjs @@ -12,6 +12,12 @@ const fs = require("node:fs/promises"); const path = require("node:path"); const { test } = require("node:test"); const { chromium, webkit } = require("playwright"); +// the rows a group's editor folds under Advanced, opened +const openAdvanced = async (page) => { + const d = page.locator(".rt-gedit .rt-gadv"); + await d.waitFor({ state: "attached" }); + if (!(await d.evaluate((e) => e.open))) await d.locator(":scope > summary").click(); +}; const assets = path.resolve(__dirname, "../assets"); const models = [ @@ -128,6 +134,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", // a group that sets none opens on Default, its hint saying what it follows await (await reach(card.locator("button", { hasText: await tr("Edit") }))).click(); + await openAdvanced(page); const ed = page.locator(".rt-gedit"); const field = (label) => ed.locator("label", { hasText: new RegExp(`^${label}$`) }).locator("xpath=following-sibling::div[1]"); const eSink = field(await tr("Rate limited")), eFirst = field(await tr("Slow to start")), ePat = field(await tr("Every member busy")); @@ -152,6 +159,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", // opened again, it shows its own; Default sends none of them await (await reach(card.locator("button", { hasText: await tr("Edit") }))).click(); + await openAdvanced(page); await eSink.waitFor(); assert.equal(await on(eSink), await tr("Keeps its place")); assert.equal(await on(eFirst), await tr("Wait")); diff --git a/internal/gui/tests/group-editor-align.test.cjs b/internal/gui/tests/group-editor-align.test.cjs index 3ef4a5808..9d41b47f8 100644 --- a/internal/gui/tests/group-editor-align.test.cjs +++ b/internal/gui/tests/group-editor-align.test.cjs @@ -12,6 +12,12 @@ const fs = require("node:fs/promises"); const path = require("node:path"); const { test } = require("node:test"); const { chromium, webkit } = require("playwright"); +// the rows a group's editor folds under Advanced, opened +const openAdvanced = async (page) => { + const d = page.locator(".rt-gedit .rt-gadv"); + await d.waitFor({ state: "attached" }); + if (!(await d.evaluate((e) => e.open))) await d.locator(":scope > summary").click(); +}; const assets = path.resolve(__dirname, "../assets"); const members = ["a/m1", "a/m2"]; @@ -70,7 +76,7 @@ const measure = () => { } return null; }; - return [...ed.querySelectorAll(":scope > label")].filter(shown).map((l) => { + return [...ed.querySelectorAll(":scope > label, :scope > .rt-gadv > .inner > label")].filter(shown).map((l) => { const ctl = l.nextElementSibling, a = firstLine(l), c = firstLine(ctl); const gaps = [...ctl.querySelectorAll(".hint")].filter(shown).flatMap((h) => { let p = h.previousElementSibling; @@ -100,6 +106,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", if (withOne) await page.locator(".rt-group", { hasText: "Glim" }).locator("button", { hasText: w.Edit }).click(); else await page.locator("button", { hasText: w["New group"] }).first().click(); await page.locator(".rt-gedit").waitFor(); + await openAdvanced(page); // its rows are measured too if (withOne) await page.locator(".rt-gedit .rt-pats .fbrow").first().waitFor(); const rows = await page.evaluate(measure); assert.ok(rows.length >= 10, `the editor's rows: ${JSON.stringify(rows)}`); diff --git a/internal/gui/tests/group-first-token.test.cjs b/internal/gui/tests/group-first-token.test.cjs index 687437bb6..0c0b1c08d 100644 --- a/internal/gui/tests/group-first-token.test.cjs +++ b/internal/gui/tests/group-first-token.test.cjs @@ -12,6 +12,12 @@ const fs = require("node:fs/promises"); const path = require("node:path"); const { test } = require("node:test"); const { chromium, webkit } = require("playwright"); +// the rows a group's editor folds under Advanced, opened +const openAdvanced = async (page) => { + const d = page.locator(".rt-gedit .rt-gadv"); + await d.waitFor({ state: "attached" }); + if (!(await d.evaluate((e) => e.open))) await d.locator(":scope > summary").click(); +}; const assets = path.resolve(__dirname, "../assets"); const models = [ @@ -109,6 +115,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", return posts.filter((p) => p.path === "/api/groups/save").at(-1).body; }; await (await reach(card.locator("button", { hasText: w.edit }))).click(); + await openAdvanced(page); const ed = page.locator(".rt-gedit"); const row = ed.locator("label", { hasText: w.label }).locator("xpath=following-sibling::div[1]"); await row.waitFor(); @@ -122,6 +129,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await card.locator(".tag", { hasText: w.tag }).waitFor(); await (await reach(card.locator("button", { hasText: w.edit }))).click(); + await openAdvanced(page); await row.waitFor(); await reach(row); assert.equal(await row.locator(".opt.on").textContent(), w.min, "the editor opens at what was saved"); @@ -131,6 +139,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", // Custom: as many minutes as are typed, from 5 when it was Wait await (await reach(card.locator("button", { hasText: w.edit }))).click(); + await openAdvanced(page); await row.waitFor(); await reach(row); const minutes = row.locator("input.first-in"); @@ -160,6 +169,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await card.locator(".tag", { hasText: tag150 }).waitFor(); await (await reach(card.locator("button", { hasText: w.edit }))).click(); + await openAdvanced(page); await row.waitFor(); await reach(row); assert.equal(await row.locator(".opt.on").textContent(), custom[lang], "a time of its own opens as Custom"); @@ -169,6 +179,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal((await save()).firstToken, 60); await (await reach(card.locator("button", { hasText: w.edit }))).click(); + await openAdvanced(page); await row.waitFor(); await reach(row); await row.locator(".opt", { hasText: w.dflt }).click(); diff --git a/internal/gui/tests/group-from-model-add.test.cjs b/internal/gui/tests/group-from-model-add.test.cjs index c19b3a28d..f7e162a83 100644 --- a/internal/gui/tests/group-from-model-add.test.cjs +++ b/internal/gui/tests/group-from-model-add.test.cjs @@ -17,6 +17,12 @@ const fs = require("node:fs/promises"); const path = require("node:path"); const { test } = require("node:test"); const { chromium, webkit } = require("playwright"); +// the rows a group's editor folds under Advanced, opened +const openAdvanced = async (page) => { + const d = page.locator(".rt-gedit .rt-gadv"); + await d.waitFor({ state: "attached" }); + if (!(await d.evaluate((e) => e.open))) await d.locator(":scope > summary").click(); +}; const assets = path.resolve(__dirname, "../assets"); const MODEL = "workbuddy/hy4-preview"; @@ -121,7 +127,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", // column on purpose (plugins/routing/routing.css), so the label is above its field // there — beside is only what a wide window can ask for. const oneColumn = width <= 760; - const rows = await ed.evaluate((e, oneColumn) => [...e.children].filter((c) => c.matches("label") && !c.hidden && c.offsetParent).map((l) => { + await openAdvanced(page); // Levels and the rest folded under it, measured too + const rows = await ed.evaluate((e, oneColumn) => [...e.children, ...(e.querySelector(":scope > .rt-gadv > .inner")?.children || [])].filter((c) => c.matches("label") && !c.hidden && c.offsetParent).map((l) => { const f = l.nextElementSibling, a = l.getBoundingClientRect(), b = f.getBoundingClientRect(); const beside = a.right <= b.left + 1 && Math.abs(a.top - b.top) < 12; const above = a.bottom <= b.top + 1 && a.left <= b.left + 1; diff --git a/internal/gui/tests/group-patience.test.cjs b/internal/gui/tests/group-patience.test.cjs index f4c016593..fe2e905d0 100644 --- a/internal/gui/tests/group-patience.test.cjs +++ b/internal/gui/tests/group-patience.test.cjs @@ -14,6 +14,12 @@ const fs = require("node:fs/promises"); const path = require("node:path"); const { test } = require("node:test"); const { chromium, webkit } = require("playwright"); +// the rows a group's editor folds under Advanced, opened +const openAdvanced = async (page) => { + const d = page.locator(".rt-gedit .rt-gadv"); + await d.waitFor({ state: "attached" }); + if (!(await d.evaluate((e) => e.open))) await d.locator(":scope > summary").click(); +}; const assets = path.resolve(__dirname, "../assets"); const models = [ @@ -93,6 +99,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", }; const open = async () => { await card.locator("button", { hasText: w.edit }).click(); + await openAdvanced(page); const row = page.locator(".rt-gedit label", { hasText: w.label }).locator("xpath=following-sibling::div[1]"); await row.waitFor(); return row; diff --git a/internal/gui/tests/group-unlists.test.cjs b/internal/gui/tests/group-unlists.test.cjs index 33a0bc9ac..300eedfe3 100644 --- a/internal/gui/tests/group-unlists.test.cjs +++ b/internal/gui/tests/group-unlists.test.cjs @@ -10,6 +10,12 @@ const fs = require("node:fs/promises"); const path = require("node:path"); const { test } = require("node:test"); const { chromium, webkit } = require("playwright"); +// the rows a group's editor folds under Advanced, opened +const openAdvanced = async (page) => { + const d = page.locator(".rt-gedit .rt-gadv"); + await d.waitFor({ state: "attached" }); + if (!(await d.evaluate((e) => e.open))) await d.locator(":scope > summary").click(); +}; const assets = path.resolve(__dirname, "../assets"); const members = ["a/m1", "a/m2"]; @@ -101,6 +107,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", }; await card.locator("button", { hasText: w.Edit }).click(); + await openAdvanced(page); await label.waitFor(); assert.match(await opt("Its models too").getAttribute("class"), /\bon\b/, "its models too by default"); assert.equal(await field.locator(".hint").last().textContent(), w[H0]);