test(webui): settings-s4 review F1: each organization pick waits for the picker and changes it in one step, since a route change repaints the select; the final gate caught the select missing for a moment between a wait and the pick; the test still fails with the bus.js and display.js of e717824c5 (#1873, lane settings-s4)

This commit was merged in pull request #2004.
This commit is contained in:
jason.woltje committed 2026-11-19 18:49:24 -06:00
1 parent ae53b1988a
commit 524132b42b
1 file changed
+5 -3
@@ -159,17 +159,19 @@ test('settings-s4: the sidebar marks an organization paused while the model serv
// settings-s4 review F1: the picker on a page that is not an organization's keeps the #/settings/ base.
test('settings-s4 review F1: picking an organization from Model setup opens its Routing page at #/settings/routing?org=', { timeout: 90000 }, async t => {
const { b, wait } = await orgSetup(t, { path: '/#/settings/model-setup' });
// A route change repaints the picker, so the pick waits for the select and changes it in one step.
const pick = id => wait(`(() => { const s = document.querySelector("#org-pick"); if (!s || ![...s.options].some(o => o.value === "${id}")) return false; s.value = "${id}"; s.dispatchEvent(new Event("change", { bubbles: true })); return true; })()`);
await wait('document.querySelector("#org-pick") && document.querySelector("#proxy-setup")');
await b.evaluate('(() => { const s = document.querySelector("#org-pick"); s.value = "north"; s.dispatchEvent(new Event("change", { bubbles: true })); return true; })()');
await pick('north');
await wait('location.hash === "#/settings/routing?org=north" && document.querySelector("#settings-nav a[href=\'#/settings/routing?org=north\'][aria-current=page]")');
await wait('/North Works/.test(document.querySelector("#breadcrumbs")?.textContent ?? "")');
assert.equal(await b.evaluate('location.hash.includes("#/orgs/")'), false);
for (const from of ['appearance', 'organizations']) {
await b.evaluate(`location.hash = "#/settings/${from}"; true`);
await wait(`document.querySelector("#settings-nav a[href='#/settings/${from}'][aria-current=page]") && document.querySelector("#org-pick")`);
await b.evaluate('(() => { const s = document.querySelector("#org-pick"); s.value = "acme"; s.dispatchEvent(new Event("change", { bubbles: true })); return true; })()');
await pick('acme');
await wait('location.hash === "#/settings/routing?org=acme" && document.querySelector("#org-pick")?.value === "acme"');
await b.evaluate('(() => { const s = document.querySelector("#org-pick"); s.value = "north"; s.dispatchEvent(new Event("change", { bubbles: true })); return true; })()');
await pick('north');
await wait('location.hash === "#/settings/routing?org=north"');
}
});