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); });