2026-03-17 02:52:49 +01:00
|
|
|
import { defineConfig, devices } from "@playwright/test";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Playwright config for testing against the PRODUCTION build.
|
|
|
|
|
* Uses `vite preview` to serve the built dist/ folder — the same
|
|
|
|
|
* HTML/CSS/JS that Tauri bundles into the exe.
|
|
|
|
|
*
|
|
|
|
|
* Usage: npm run test:e2e:prod
|
|
|
|
|
*/
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
testDir: "./tests/e2e",
|
2026-08-07 21:20:48 +02:00
|
|
|
testIgnore: ["**/native/**", "**/admin/**"],
|
2026-03-17 02:52:49 +01:00
|
|
|
timeout: 30_000,
|
|
|
|
|
expect: {
|
|
|
|
|
timeout: 5_000,
|
|
|
|
|
},
|
|
|
|
|
fullyParallel: true,
|
|
|
|
|
forbidOnly: !!process.env.CI,
|
2026-03-18 05:38:53 +01:00
|
|
|
retries: process.env.CI ? 2 : 1,
|
2026-03-17 02:52:49 +01:00
|
|
|
workers: process.env.CI ? 1 : undefined,
|
2026-03-18 05:38:53 +01:00
|
|
|
reporter: process.env.CI
|
2026-08-28 06:54:32 +02:00
|
|
|
? [
|
|
|
|
|
["html", { open: "never" }],
|
|
|
|
|
["junit", { outputFile: "test-results/junit.xml" }],
|
|
|
|
|
]
|
2026-03-18 05:38:53 +01:00
|
|
|
: "html",
|
2026-03-17 02:52:49 +01:00
|
|
|
|
|
|
|
|
use: {
|
|
|
|
|
baseURL: "http://localhost:4173",
|
2026-03-18 05:38:53 +01:00
|
|
|
actionTimeout: 10_000,
|
|
|
|
|
navigationTimeout: 15_000,
|
2026-03-17 02:52:49 +01:00
|
|
|
screenshot: "only-on-failure",
|
|
|
|
|
trace: "on-first-retry",
|
2026-03-18 05:38:53 +01:00
|
|
|
video: "on-first-retry",
|
|
|
|
|
contextOptions: { reducedMotion: "reduce" },
|
2026-03-17 02:52:49 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
projects: [
|
|
|
|
|
{
|
|
|
|
|
name: "chromium",
|
|
|
|
|
use: { ...devices["Desktop Chrome"] },
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
webServer: {
|
2026-08-28 06:54:32 +02:00
|
|
|
// Spawn Vite directly rather than through npm — see the note in
|
|
|
|
|
// playwright.config.ts: an `npm run` wrapper leaves vite alive as an
|
|
|
|
|
// orphaned grandchild on teardown and the runner never exits.
|
|
|
|
|
command: "npx vite preview",
|
2026-03-17 02:52:49 +01:00
|
|
|
url: "http://localhost:4173",
|
|
|
|
|
reuseExistingServer: !process.env.CI,
|
2026-03-18 05:38:53 +01:00
|
|
|
timeout: 60_000,
|
2026-03-17 02:52:49 +01:00
|
|
|
},
|
|
|
|
|
});
|