-
Notifications
You must be signed in to change notification settings - Fork 6
/
playwright.config.ts
56 lines (52 loc) · 1.42 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
import type { PlaywrightTestConfig } from '@playwright/test';
import path from 'path';
import url from 'url';
const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export const STORAGE_STATE = path.join(__dirname, 'e2e-test-results/.auth/user.json');
const config: PlaywrightTestConfig = {
forbidOnly: !!process.env.CI,
projects: [
{
name: 'setup',
testMatch: /global\.setup\.ts/,
},
{
dependencies: ['setup'],
name: 'e2e tests',
testMatch: '**/*.test.ts',
use: {
storageState: STORAGE_STATE,
},
},
{
dependencies: ['e2e tests'],
name: 'teardown',
testMatch: /global\.teardown\.ts/,
},
],
reportSlowTests: {
max: 0,
threshold: 60000,
},
reporter: [
[process.env.CI ? 'github' : 'list'],
['html', { open: 'never', outputFile: 'index.html', outputFolder: 'e2e-test-results' }],
['json', { outputFile: 'e2e-test-results/json-results.json' }],
['junit', { outputFile: 'e2e-test-results/junit-results.xml' }],
],
retries: 2,
testDir: './e2e-tests',
use: {
baseURL: 'http://localhost:3000',
browserName: 'chromium',
trace: process.env.CI ? 'retain-on-failure' : 'off',
video: process.env.CI ? 'retain-on-failure' : 'off',
},
webServer: {
command: 'npm run preview',
port: 3000,
reuseExistingServer: !process.env.CI,
},
};
export default config;