From 57f8f884b95816aadba17974c355e7df9b39502f Mon Sep 17 00:00:00 2001 From: DJConnect Date: Sat, 8 Aug 2026 09:49:40 +0200 Subject: [PATCH] Stabilize dashboard locale test --- tests/engineering/dashboard.spec.mjs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/engineering/dashboard.spec.mjs b/tests/engineering/dashboard.spec.mjs index 6289e1b7..cb5a2fad 100644 --- a/tests/engineering/dashboard.spec.mjs +++ b/tests/engineering/dashboard.spec.mjs @@ -155,7 +155,21 @@ test.describe("Engineering Status browser smoke", () => { ); // Change language only after the asynchronous snapshot has rendered; // otherwise it may overwrite localized template placeholders. + // A locale selection deliberately reloads the dashboard so persisted + // client state is applied from a clean document. Wait for that specific + // navigation before inspecting template bindings; otherwise a fast CI + // worker can read the outgoing document while its localized text is + // being replaced. + const localeReload = page.waitForEvent( + "framenavigated", + (frame) => frame === page.mainFrame(), + ); await page.locator("#dashboardLocale").selectOption(language); + await localeReload; + await page.waitForLoadState("domcontentloaded"); + await page.waitForFunction( + () => document.body.classList.contains("dashboard-ready"), + ); await expect(page.locator("html")).toHaveAttribute("lang", language); await expect(page).toHaveTitle(sourceTranslator("dashboard.title")); await expect(page.locator("#dashboardAppleWebAppTitle")).toHaveAttribute(