generated from akshayp7/playwright-typescript-playwright-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
playwright.config.ts
161 lines (144 loc) · 3.85 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import { devices } from 'playwright';
import { PlaywrightTestConfig } from '@playwright/test';
import { testConfig } from './testConfig';
const ENV = process.env.ENV;
if (!ENV || ![`qa`, `dev`, `qaApi`, `devApi`].includes(ENV)) {
console.log(`Please provide a correct environment value like "npx cross-env ENV=qa|dev|qaApi|devApi"`);
process.exit();
}
const config: PlaywrightTestConfig = {
//Global Setup to run before all tests
globalSetup: `./global-setup`,
//Global Teardown to run after all tests
globalTeardown: `./global-teardown`,
//sets timeout for each test case
timeout: 120000,
//number of retries if test case fails
retries: 0,
//Reporters
reporter: [[`./CustomReporterConfig.ts`], [`experimental-allure-playwright`], [`html`, { outputFolder: 'html-report', open: 'never' }]],
projects: [
{
name: `Chrome`,
use: {
// Configure the browser to use.
browserName: `chromium`,
//Chrome Browser Config
channel: `chrome`,
//Picks Base Url based on User input
baseURL: testConfig[process.env.ENV],
//Browser Mode
headless: true,
//Browser height and width
viewport: { width: 1500, height: 730 },
ignoreHTTPSErrors: true,
//Enable File Downloads in Chrome
acceptDownloads: true,
//Artifacts
screenshot: `only-on-failure`,
video: `retain-on-failure`,
trace: `retain-on-failure`,
//Slows down execution by ms
launchOptions: {
slowMo: 0
}
},
},
{
name: `Chromium`,
use: {
browserName: `chromium`,
baseURL: testConfig[process.env.ENV],
headless: true,
viewport: { width: 1500, height: 730 },
ignoreHTTPSErrors: true,
acceptDownloads: true,
screenshot: `only-on-failure`,
video: `retain-on-failure`,
trace: `retain-on-failure`,
launchOptions: {
slowMo: 0
}
},
},
{
name: `Firefox`,
use: {
browserName: `firefox`,
baseURL: testConfig[process.env.ENV],
headless: true,
viewport: { width: 1500, height: 730 },
ignoreHTTPSErrors: true,
acceptDownloads: true,
screenshot: `only-on-failure`,
video: `retain-on-failure`,
trace: `retain-on-failure`,
launchOptions: {
slowMo: 0
}
},
},
{
name: `Edge`,
use: {
browserName: `chromium`,
channel: `msedge`,
baseURL: testConfig[process.env.ENV],
headless: false,
viewport: { width: 1500, height: 730 },
ignoreHTTPSErrors: true,
acceptDownloads: true,
screenshot: `only-on-failure`,
video: `retain-on-failure`,
trace: `retain-on-failure`,
launchOptions: {
slowMo: 0
}
},
},
{
name: `WebKit`,
use: {
browserName: `webkit`,
baseURL: testConfig[process.env.ENV],
headless: true,
viewport: { width: 1500, height: 730 },
ignoreHTTPSErrors: true,
acceptDownloads: true,
screenshot: `only-on-failure`,
video: `retain-on-failure`,
trace: `retain-on-failure`,
launchOptions: {
slowMo: 0
}
},
},
{
name: `Device`,
use: {
...devices[`Pixel 4a (5G)`],
browserName: `chromium`,
baseURL: testConfig[process.env.ENV],
headless: true,
ignoreHTTPSErrors: true,
acceptDownloads: true,
screenshot: `only-on-failure`,
video: `retain-on-failure`,
trace: `retain-on-failure`,
launchOptions: {
slowMo: 0
}
},
},
{
name: `DB`
},
{
name: `API`,
use: {
baseURL: testConfig[process.env.ENV]
}
}
],
};
export default config;