-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
73 lines (68 loc) · 2.54 KB
/
Copy pathplaywright.config.ts
File metadata and controls
73 lines (68 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { defineConfig, devices } from '@playwright/test';
const PORT = 8787;
const BASE_URL = `http://localhost:${PORT}`;
/**
* Playwright Test config.
*
* Three projects:
* - `desktop` and `mobile` run the full behavioural + layout suite at
* each viewport. They're what `npm test` exercises and what CI gates
* on.
* - `screenshots` only runs `tests/visual.spec.ts` and writes the PNGs
* the docs gallery embeds. It's invoked via `npm run screenshots` and
* is *not* part of the default run — capturing screenshots churns the
* doc/screenshots/ files on every push otherwise.
*
* The dev server starts once per `playwright test` invocation via the
* shim in `scripts/test-server.mjs`, which writes stub OAuth secrets so
* /auth/login renders the real login template (not the maintenance
* fallback the worker shows when essentials are missing).
*/
export default defineConfig({
testDir: './tests',
fullyParallel: false, // single dev server, sequential keeps logs readable
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: 1,
reporter: process.env.CI ? [['github'], ['html', { open: 'never' }]] : 'list',
outputDir: 'test-results',
use: {
baseURL: BASE_URL,
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
},
projects: [
{
name: 'desktop',
use: { ...devices['Desktop Chrome'], viewport: { width: 1280, height: 800 } },
// The mobile-density sweep is keyed off mobile-specific media
// breakpoints (table-stack, tap-target floors, --page-pad token),
// so running it on desktop would just assert against the wrong
// computed values.
testIgnore: [/visual\.spec\.ts/, /mobile-density\.spec\.ts/],
},
{
name: 'mobile',
use: { ...devices['Desktop Chrome'], viewport: { width: 375, height: 812 } },
// The layout sweep manages its own viewports, so running it under both
// projects would just duplicate work. Keep it desktop-only.
testIgnore: [/visual\.spec\.ts/, /layout\.spec\.ts/],
},
{
name: 'screenshots',
use: { ...devices['Desktop Chrome'] },
testMatch: /visual\.spec\.ts/,
},
],
webServer: {
command: 'node scripts/test-server.mjs',
url: BASE_URL,
// Wipes .wrangler/state before boot. Interactive `nix run .#dev`
// leaves this unset so dev state persists across restarts.
env: { CONCIERGE_TEST_RESET: '1' },
reuseExistingServer: !process.env.CI,
timeout: 240_000, // first wasm build can take 2+ minutes
stdout: 'pipe',
stderr: 'pipe',
},
});