-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
107 lines (104 loc) · 3.29 KB
/
Copy pathplaywright.config.ts
File metadata and controls
107 lines (104 loc) · 3.29 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import { defineConfig, devices } from '@playwright/test'
const testDatabaseUrl = process.env.TEST_DATABASE_URL
const useCompiledServer = process.env.PLAYWRIGHT_USE_BUILD === '1'
const releaseSmokeTest = /release-smoke\.spec\.ts/
if (!testDatabaseUrl) {
throw new Error(
'TEST_DATABASE_URL is required. Browser tests never run against a development or production database.',
)
}
if (testDatabaseUrl === process.env.DATABASE_URL) {
throw new Error('TEST_DATABASE_URL must be different from DATABASE_URL.')
}
export default defineConfig({
testDir: './tests/e2e',
timeout: 90_000,
globalSetup: './tests/e2e/global-setup.ts',
fullyParallel: false,
forbidOnly: true,
retries: process.env.CI ? 2 : 1,
reporter: process.env.CI ? 'github' : 'list',
use: {
baseURL: 'http://127.0.0.1:4173',
locale: 'en-US',
timezoneId: 'Europe/Prague',
colorScheme: 'light',
reducedMotion: 'reduce',
serviceWorkers: 'block',
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
},
expect: { toHaveScreenshot: { animations: 'disabled', maxDiffPixelRatio: 0.01 } },
projects: [
{ name: 'setup', testMatch: /auth\.setup\.ts/ },
{
name: 'mobile-light-en',
testIgnore: [/auth\.setup\.ts/, /wide-qa\.spec\.ts/, releaseSmokeTest],
dependencies: ['setup'],
use: { ...devices['iPhone 13'], viewport: { width: 360, height: 800 }, colorScheme: 'light', locale: 'en-US' },
},
{
name: 'tablet-dark-cs',
testIgnore: [/auth\.setup\.ts/, /wide-qa\.spec\.ts/, releaseSmokeTest],
dependencies: ['setup'],
use: { ...devices['iPad (gen 7)'], viewport: { width: 768, height: 1024 }, colorScheme: 'dark', locale: 'cs-CZ' },
},
{
name: 'desktop-light-en',
testIgnore: [/auth\.setup\.ts/, /wide-qa\.spec\.ts/, releaseSmokeTest],
dependencies: ['setup'],
use: {
...devices['Desktop Chrome'],
viewport: { width: 1440, height: 1000 },
colorScheme: 'light',
locale: 'en-US',
},
},
{
name: 'desktop-dark-cs',
testIgnore: [/auth\.setup\.ts/, /wide-qa\.spec\.ts/, releaseSmokeTest],
dependencies: ['setup'],
use: {
...devices['Desktop Chrome'],
viewport: { width: 1440, height: 1000 },
colorScheme: 'dark',
locale: 'cs-CZ',
},
},
{
name: 'wide-qa',
testMatch: /wide-qa\.spec\.ts/,
dependencies: ['setup'],
use: {
...devices['Desktop Chrome'],
viewport: { width: 1920, height: 1080 },
colorScheme: 'dark',
locale: 'cs-CZ',
},
},
{
name: 'release-smoke',
testMatch: releaseSmokeTest,
use: {
...devices['Desktop Chrome'],
viewport: { width: 1440, height: 1000 },
serviceWorkers: 'allow',
},
},
],
webServer: {
command: useCompiledServer ? 'bun .output/server/index.mjs' : 'bun run dev --host 127.0.0.1 --port 4173',
url: 'http://127.0.0.1:4173',
reuseExistingServer: !process.env.CI,
env: {
...process.env,
DATABASE_URL: testDatabaseUrl,
DIRECT_DATABASE_URL: testDatabaseUrl,
AUTH_ORIGIN: 'http://127.0.0.1:4173/api/auth',
AUTH_SECRET: process.env.AUTH_SECRET || 'topiqu-browser-test-secret',
HOST: '127.0.0.1',
PORT: '4173',
},
timeout: 120_000,
},
})