Fix flaky landingPage visual spec

This makes sure that the stubs are always loaded before the app.
We assume that previously the load order was not deterministic due to
the dynamic import.

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
Rūdolfs Ošiņš
2023-01-06 14:53:54 +01:00
parent 4b58539eff
commit d8dd0d8e5b
3 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ declare global {
// src/config.ts
APP_CONFIG: Config;
// eslint-disable-next-line @typescript-eslint/ban-types
initializeTestStubs: Function;
initializeTestStubs?: Function;
e2eTestStubs: {
FakeTimers: FakeTimers;
};
+9 -1
View File
@@ -1,4 +1,12 @@
if (window.PLAYWRIGHT) import("@app/lib/e2eTestStubs");
import * as FakeTimers from "@sinonjs/fake-timers";
if (window.PLAYWRIGHT && window.initializeTestStubs !== undefined) {
window.e2eTestStubs = {
FakeTimers: FakeTimers,
};
window.initializeTestStubs();
}
import App from "@app/App.svelte";
const app = new App({
-8
View File
@@ -1,8 +0,0 @@
import * as FakeTimers from "@sinonjs/fake-timers";
if (typeof window.initializeTestStubs === "function") {
window.e2eTestStubs = {
FakeTimers: FakeTimers,
};
window.initializeTestStubs();
}