diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index b4e015a3c..cd882bfdb 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -45,4 +45,4 @@ jobs: - run: mkdir -p tests/artifacts - name: Run e2e tests - run: npm run test:e2e -- --project webkit + run: npm run test:e2e diff --git a/CLAUDE.md b/CLAUDE.md index cd44bbcec..092dec1f6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -44,8 +44,8 @@ npm run test:unit ### E2E tests ```sh -npm run test:e2e -- --project webkit -npm run test:e2e -- tests/e2e/.spec.ts --project webkit +npm run test:e2e +npm run test:e2e -- tests/e2e/.spec.ts ``` `SKIP_SETUP=true` skips fixture creation for faster iteration. @@ -93,7 +93,7 @@ These mirror what CI runs on every PR. Run them all before shipping a feature. npm run check # tsc, svelte-check, eslint, prettier, # cargo fmt, cargo clippy, cargo test npm run test:unit -npm run test:e2e -- --project webkit +npm run test:e2e ``` If backend types changed, regenerate and commit the bindings first: diff --git a/eslint.config.js b/eslint.config.js index 39454c39b..fbf8f86b7 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -161,6 +161,7 @@ export default [ { ignores: [ "build/*", + "tests/tmp/**/*", "isolation/*", "node_modules/**/*", "target/*", diff --git a/playwright.config.ts b/playwright.config.ts index 8c54beabd..4166a87b0 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -24,6 +24,12 @@ const userAgent = const testHttpApiPort = await getFreePort(); process.env.VITE_TEST_HTTP_API_PORT = String(testHttpApiPort); +// A separate build directory keeps test settings out of the app bundle. +const testBuildDir = "tests/tmp/build"; +const appServerCommand = process.env.E2E_DEV_SERVER + ? "npm run start -- --strictPort --port 3001" + : `npx vite build --outDir ${testBuildDir} --emptyOutDir && npx vite preview --outDir ${testBuildDir} --strictPort --port 3001`; + const config: PlaywrightTestConfig = { outputDir: "./tests/artifacts", testDir: "./tests/e2e", @@ -33,10 +39,13 @@ const config: PlaywrightTestConfig = { timeout: 8000, }, fullyParallel: true, - workers: process.env.CI ? 1 : undefined, + workers: process.env.CI ? 2 : undefined, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, - reporter: "list", + reporter: [ + ["list"], + ["json", { outputFile: "tests/artifacts/results.json" }], + ], use: { colorScheme: "dark", actionTimeout: 5000, @@ -56,7 +65,7 @@ const config: PlaywrightTestConfig = { webServer: [ { - command: `VITE_AUTH_LONG_DELAY=1000 VITE_TEST_HTTP_API_PORT=${testHttpApiPort} npm run start -- --strictPort --port 3001`, + command: `VITE_AUTH_LONG_DELAY=1000 VITE_TEST_HTTP_API_PORT=${testHttpApiPort} ${appServerCommand}`, port: 3001, }, ],