From c3c192677defa518eabeb324aac82f0757e398c3 Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Tue, 10 Nov 2026 15:48:06 -0600 Subject: [PATCH] test(webui): the layout reload test loads the page through navigate (#1873) The mark from the previous commit kept the wait off the old page, but the wait could still start on it and be killed by the reload ("Inspected target navigated or closed", once in ten runs). navigate() waits for the load; a query makes the same URL load again. --- packages/webui/tests/tasks-board-browser.test.mjs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/webui/tests/tasks-board-browser.test.mjs b/packages/webui/tests/tasks-board-browser.test.mjs index 41c695c9a..95be63d1a 100644 --- a/packages/webui/tests/tasks-board-browser.test.mjs +++ b/packages/webui/tests/tasks-board-browser.test.mjs @@ -128,13 +128,15 @@ test('org and project filters narrow the board', async t => { }); test('the layout toggle is remembered across a reload', async t => { - const { b, wait } = await open(t); + const { b, wait, url } = await open(t); await b.evaluate('document.querySelector("[data-tb-layout=list]").click()'); await wait('document.querySelector("[data-tasks-board]").dataset.layout === "list" && document.querySelector("[data-tb-list]")'); assert.equal(await b.evaluate('document.querySelector("[data-tb-layout=list]").getAttribute("aria-pressed")'), 'true'); - // The mark goes with the old page, so the wait below cannot pass on the board that is unloading. - await b.evaluate('window.__beforeReload = true; location.reload()'); - await wait('!window.__beforeReload && document.querySelector("[data-tasks-board] [data-tb-tracker=home]")'); + // Load the page again through navigate(), which waits for the load. A location.reload() from evaluate + // returns before the reload commits, so the next wait ran on the old page and the reload killed it + // (as instances-browser found). The same URL with only a hash would not load, so add a query. + await b.navigate(url.replace('/#', '/?reload=1#')); + await wait('document.querySelector("[data-tasks-board] [data-tb-tracker=home]")'); assert.equal(await b.evaluate('document.querySelector("[data-tasks-board]").dataset.layout'), 'list'); assert.equal(await b.evaluate('document.querySelectorAll("[data-tb-list] tr.tb-row").length'), 5); });