-
Notifications
You must be signed in to change notification settings - Fork 3
/
playwright.e2e.config.ts
90 lines (88 loc) · 2.47 KB
/
playwright.e2e.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
80
81
82
83
84
85
86
87
88
89
90
import { defineConfig, devices } from '@playwright/test';
import path from 'path';
import commonConfig from './playwright.common.config.ts';
import {
COMMON_SAVED_STATES_FOLDER,
E2E_REPORTS_FOLDER,
E2E_TESTS_FOLDER,
} from './tests/playwright/common/lib/constants.ts';
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
...commonConfig,
testDir: E2E_TESTS_FOLDER,
testMatch: '**/*.@(e2e-test).?(m)[jt]s?(x)',
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
outputDir: path.join(E2E_REPORTS_FOLDER, 'test-results'),
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
[
'html',
{
open: 'never',
outputFolder: path.join(E2E_REPORTS_FOLDER, 'playwright-report'),
},
],
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
...commonConfig.use,
},
/* Configure projects for major browsers */
projects: [
{
name: 'setup',
testMatch: '**/*.@(e2e-setup).?(m)[jt]s?(x)',
teardown: 'teardown',
use: {
...devices['Desktop Chrome'],
},
},
{
name: 'teardown',
testMatch: '**/*.@(e2e-teardown).?(m)[jt]s?(x)',
use: {
...devices['Desktop Chrome'],
},
},
{
name: 'visitor',
dependencies: ['setup'],
testDir: path.join(E2E_TESTS_FOLDER, 'visitor'),
use: {
...devices['Desktop Chrome'],
storageState: path.join(COMMON_SAVED_STATES_FOLDER, 'visitor.json'),
},
},
{
name: 'signed-in-user',
dependencies: ['setup'],
testDir: path.join(E2E_TESTS_FOLDER, 'signed-in-user'),
use: {
...devices['Desktop Chrome'],
storageState: path.join(
COMMON_SAVED_STATES_FOLDER,
'signed-in-user.json',
),
},
},
/**
* WARNING: Session is deleted after sign out, so this test must be run last.
* It also will not be possible to run tests for signed-in-user after this one
* without reseeding/restarting the stack.
*/
{
name: 'signed-in-user--before-sign-out',
dependencies: ['setup'],
testDir: path.join(E2E_TESTS_FOLDER, 'signed-in-user--before-sign-out'),
use: {
...devices['Desktop Chrome'],
storageState: path.join(
COMMON_SAVED_STATES_FOLDER,
'signed-in-user--before-sign-out.json',
),
},
},
],
});