-
Notifications
You must be signed in to change notification settings - Fork 0
/
playwright.config.js
69 lines (61 loc) · 1.57 KB
/
playwright.config.js
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
// @ts-check
const { devices, expect } = require('@playwright/test')
const { matchers } = require('expect-playwright')
// sleep
global.sleep = time => {
return new Promise(resolve => setTimeout(resolve, time * 1000))
}
// Extend advanced matchers
expect.extend(matchers)
global.expect = expect
// Get env vars
const TARGET = process.env.TARGET || 'prod'
global.TARGET = TARGET
const CONFIG_ENV = require(`./src/config/environment/${TARGET}.json`)
global.CONFIG_ENV = CONFIG_ENV
const CI = process.env.CI || false
global.CI = CI
/** @type {any} */
let reporters = [
['html', { outputFolder: 'reports', open: CI ? 'never' : 'on-failure' }],
['json', { outputFile: 'reports/results.json' }],
['list']
]
CI && reporters.push(['allure-playwright'], ['github'])
/** @type {import('@playwright/test').PlaywrightTestConfig} */
const config = {
use: {
baseURL: CONFIG_ENV.baseUrl,
screenshot: 'only-on-failure',
trace: CI ? 'on-first-retry' : 'retain-on-failure',
video: 'on-first-retry',
ignoreHTTPSErrors: true,
colorScheme: 'dark',
actionTimeout: 20 * 1000
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] }
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] }
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] }
}
],
reporter: reporters,
workers: CI ? 8 : undefined,
globalTimeout: 60 * 60 * 1000,
timeout: 60 * 1000,
outputDir: './output',
retries: CI ? 1 : 0,
forbidOnly: !!CI,
expect: {
timeout: 20 * 1000
}
}
module.exports = config