From f3d1debbaa9202f456e37ae9a7e720fb1a85da6e Mon Sep 17 00:00:00 2001 From: efiten Date: Sun, 11 Oct 2026 10:01:23 +0200 Subject: [PATCH] test(e2e): assert the configured-scope row after the theme-refresh re-render MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every page load fires one theme-refresh about 300 ms after the theme loads, and live.js re-runs showNodeDetail on it, which swaps #nodeDetailContent to "Loading…" before it renders again. The test waited for the detail table and then called the non-waiting row.isVisible(), so a refresh landing in between failed the live #fixture case. The null-scope case could pass on the "Loading…" panel for the same reason. Wait for the refresh to have fired, then for the detail again, before asserting. Co-Authored-By: Claude Opus 5.5 --- tests/e2e/test-issue-1648-m2-icons-e2e.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/e2e/test-issue-1648-m2-icons-e2e.js b/tests/e2e/test-issue-1648-m2-icons-e2e.js index c31ce2069..a7ee7d663 100644 --- a/tests/e2e/test-issue-1648-m2-icons-e2e.js +++ b/tests/e2e/test-issue-1648-m2-icons-e2e.js @@ -86,6 +86,12 @@ async function checkConfiguredScope(page) { await page.route(nodeListUrl, route => route.fulfill({ json: { nodes: [{ ...node, lat: 1, lon: 1 }], total: 1 }, })); + // Every page load fires one 'theme-refresh' about 300ms after the theme + // loads, and live.js re-runs showNodeDetail on it, which briefly swaps the + // detail panel to "Loading…". Assert only after that re-render. + await page.addInitScript(() => { + window.addEventListener('theme-refresh', () => { window.__scopeThemeReady = true; }, { once: true }); + }); try { for (const live of [false, true]) { for (const scope of ['#fixture', '', null]) { @@ -95,7 +101,10 @@ async function checkConfiguredScope(page) { const route = live ? '/live?lat=1&lon=1&zoom=10' : '/nodes/' + key; await page.goto(`${BASE}/#${route}`, { waitUntil: 'domcontentloaded' }); if (live) await page.locator('#liveMap .live-node-marker').click(); - await page.locator(live ? '#nodeDetailContent table' : '#node-stats').waitFor({ state: 'visible', timeout: 8000 }); + const detail = page.locator(live ? '#nodeDetailContent table' : '#node-stats'); + await detail.waitFor({ state: 'visible', timeout: 8000 }); + await page.waitForFunction(() => window.__scopeThemeReady === true, null, { timeout: 8000 }); + await detail.waitFor({ state: 'visible', timeout: 8000 }); const row = live ? page.locator('#nodeDetailContent tr').filter({ hasText: 'Configured scope' }) : page.locator('#row-configured-scope');