From 24d0b3f6b1b59759f93ce8167ab9b48b25e09e0b Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 19 Apr 2026 19:14:29 +0300 Subject: [PATCH] e2e(standalone): test failing due to reload mechanism --- packages/trilium-e2e/src/support/app.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/trilium-e2e/src/support/app.ts b/packages/trilium-e2e/src/support/app.ts index d2d260407a..b8f4215af2 100644 --- a/packages/trilium-e2e/src/support/app.ts +++ b/packages/trilium-e2e/src/support/app.ts @@ -61,7 +61,19 @@ export default class App { url = "/"; } - await this.page.goto(url, { waitUntil: "networkidle", timeout: 30_000 }); + // If we're already on the target (modulo hash), page.goto treats it as + // a same-document navigation and doesn't reload. In standalone that + // means the worker keeps its current state — so option changes made + // since the last navigation (e.g. a locale switch via setOption) won't + // take effect. Force a real reload in that case. + const currentUrl = this.page.url(); + const targetUrl = new URL(url, getBaseUrl()).toString(); + const stripHash = (u: string) => u.split("#")[0]; + if (currentUrl !== "about:blank" && stripHash(currentUrl) === stripHash(targetUrl)) { + await this.page.reload({ waitUntil: "networkidle", timeout: 30_000 }); + } else { + await this.page.goto(url, { waitUntil: "networkidle", timeout: 30_000 }); + } // Wait for the page to load. if (url === "/") {