-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
68 lines (63 loc) · 2.03 KB
/
Copy pathplaywright.config.ts
File metadata and controls
68 lines (63 loc) · 2.03 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
import { defineConfig, devices } from '@playwright/test';
const PORT = Number(process.env.RTM_E2E_PORT ?? 3211);
const BASE_URL = `http://127.0.0.1:${PORT}`;
/**
* End-to-end tests run against a real production build.
*
* `RTM_FIXTURE_MODE=1` makes the route handlers serve recorded payloads from
* `fixtures/` instead of calling GitHub, so the suite exercises the whole stack
* — routing, caching headers, hydration, client behaviour — without depending on
* GitHub's availability or spending rate limit. No token is provided, which also
* proves the application works without one.
*/
export default defineConfig({
testDir: './e2e',
outputDir: './test-results',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 2 : undefined,
reporter: process.env.CI ? [['github'], ['html', { open: 'never' }]] : [['list'], ['html', { open: 'never' }]],
timeout: 45_000,
expect: { timeout: 10_000 },
use: {
baseURL: BASE_URL,
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
colorScheme: 'dark',
},
projects: [
{
name: 'desktop',
use: { ...devices['Desktop Chrome'], viewport: { width: 1440, height: 900 } },
testIgnore: /motion\.spec\.ts/,
},
{
// The narrow layout is what needs re-checking on a phone; the API and
// reduced-motion suites are viewport-independent.
name: 'mobile',
use: { ...devices['Pixel 7'] },
testMatch: /shell\.spec\.ts/,
},
{
name: 'reduced-motion',
use: {
...devices['Desktop Chrome'],
viewport: { width: 1280, height: 800 },
contextOptions: { reducedMotion: 'reduce' },
},
testMatch: /motion\.spec\.ts/,
},
],
webServer: {
command: `npx next start -p ${PORT}`,
url: BASE_URL,
reuseExistingServer: !process.env.CI,
timeout: 120_000,
env: {
RTM_FIXTURE_MODE: '1',
// Deliberately no GITHUB_TOKEN: the suite runs the anonymous code path.
NODE_ENV: 'production',
},
},
});