-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplaywright.config.ts
68 lines (66 loc) · 1.67 KB
/
playwright.config.ts
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 { env } from 'node:process'
import { defineConfig, devices } from '@playwright/test'
const { CI, TEST_BASE_URL } = env
const ciBrowsers = [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
ignoreHTTPSErrors: Boolean(CI)
}
},
{
name: 'Mobile Safari',
use: { ...devices['iPhone 12'] }
}
]
const devBrowsers = [
...ciBrowsers,
/**
* Ubuntu and mkcert issues with Chrome / Firefox
* @see https://github.com/FiloSottile/mkcert/issues/447
*
* Other option is to use macos GitHub action runner and
* install docker, etc. Could also, use `ignoreHTTPSErrors`
* from playwright in the test specs to cover more browsers.
*/
{
name: 'webkit',
use: { ...devices['Desktop Safari'] }
},
{
name: 'Mobile Chrome',
use: {
...devices['Pixel 5'],
ignoreHTTPSErrors: Boolean(CI)
}
}
]
export default defineConfig({
testDir: './tests',
fullyParallel: true,
retries: CI ? 1 : 0,
workers: CI ? 1 : undefined,
reporter: 'list',
/**
* Shared settings for all the projects below.
* @see https://playwright.dev/docs/api/class-testoptions
*/
use: {
// Base URL to use in actions like `await page.goto('/')`.
baseURL: TEST_BASE_URL ?? 'https://localhost',
trace: 'on-first-retry'
},
projects: CI ? ciBrowsers : devBrowsers,
webServer: TEST_BASE_URL
? undefined
: {
command: CI
? 'docker compose -f compose.yaml up --attach-dependencies stage'
: 'docker compose up --attach-dependencies dev',
ignoreHTTPSErrors: true,
url: 'https://localhost/healthcheck',
reuseExistingServer: !CI,
timeout: 60_000 * 7
}
})