mirror of
https://github.com/zadam/trilium.git
synced 2026-05-06 17:17:37 +02:00
e2e(standalone): test failing due to reload mechanism
This commit is contained in:
@@ -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 === "/") {
|
||||
|
||||
Reference in New Issue
Block a user