-
Notifications
You must be signed in to change notification settings - Fork 19
/
playwright.config.ts
79 lines (77 loc) · 2.25 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
69
70
71
72
73
74
75
76
77
78
79
import { PlaywrightTestConfig, devices } from '@playwright/test';
import 'dotenv/config';
// Reference: https://playwright.dev/docs/test-configuration
const config: PlaywrightTestConfig = {
timeout: (Number(process.env['TIMEOUT']) || 120) * 1000,
testDir: './apps/golden-sample-app-e2e/specs/',
retries: process.env['CI'] ? 1 : 0,
grep: process.env['TEST_TAG'] ? RegExp(process.env['TEST_TAG']) : undefined,
outputDir: process.env['OUTPUT_DIR'] || './test-output',
forbidOnly: !!process.env['CI'],
workers: process.env['CI'] ? 4 : 1,
expect: {
timeout: (Number(process.env['EXPECT_TIMEOUT']) || 5) * 1000,
toHaveScreenshot: {
maxDiffPixelRatio: 0.01,
},
},
reporter: [['list'], ['allure-playwright'], ['html']],
globalSetup: require.resolve(__dirname + '/global-setup.ts'),
use: {
trace: 'retain-on-failure',
baseURL: process.env['BASE_URL'] || 'http://localhost:4200/',
ignoreHTTPSErrors: true,
screenshot: 'only-on-failure',
video: 'on-first-retry',
headless: process.env['HEADLESS']?.toLowerCase() !== 'false',
viewport: {
width: Number(process.env['SCREEN_WIDTH']) || 1280,
height: Number(process.env['SCREEN_HEIGHT']) || 720,
},
contextOptions: {
ignoreHTTPSErrors: true,
acceptDownloads: true,
},
},
projects: [
{
name: 'web-chrome',
use: {
...devices['Desktop Chrome'],
launchOptions: {
chromiumSandbox: false,
args: [
// List of Chrome arguments: http://peter.sh/experiments/chromium-command-line-switches/
'--disable-gpu',
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
],
},
},
},
{
name: 'mobile-chrome',
use: {
...devices['Nexus 7'],
isMobile: true,
baseURL: 'http://localhost:4201',
},
},
],
webServer: [
{
command: 'npm run mock-server',
url: 'http://localhost:9999/dev-interface',
timeout: 30 * 1000,
reuseExistingServer: false,
},
{
command: 'npx nx serve -c=mocks --port=4201',
url: 'http://localhost:4201/',
timeout: 120 * 1000,
reuseExistingServer: false,
},
],
};
export default config;