-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathplaywright.config.ts
77 lines (70 loc) · 1.92 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
import { defineConfig, devices } from '@playwright/test';
import { config } from './config';
const formattedDateTime = () => {
const d = new Date();
const month = `${String(d.getMonth() + 1).padStart(2, '0')}`;
const day = `${String(d.getDate() + 1).padStart(2, '0')}`;
const hour = `${String(d.getHours()).padStart(2, '0')}`;
const min = `${String(d.getMinutes()).padStart(2, '0')}`;
const date = `${d.getFullYear()}-${month}-${day}`;
const time = `${hour}.${min}.${d.getSeconds()}`;
return `${date}T${time}`;
};
const reportName = () => `${process.env.CATEGORY}/${formattedDateTime()}`;
/**
* See https://playwright.dev/docs/test-configuration.
*
* Timeouts are set by `ms`.
* Can be modified if needed
*/
export default defineConfig({
workers: 5,
// Timeout for each test
timeout: 5 * 60 * 1000, // 5 mins
// Maximum time the whole test suite can run
globalTimeout: 20 * 60 * 1000, // 20 mins
testDir: './tests',
reporter: [
[
'html',
{
outputFolder: `playwright-report/${reportName()}`,
open: 'never',
},
],
],
expect: {
timeout: 2 * 60 * 1000, // set to 2min
},
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// This is set in config/index.ts
baseURL: config.baseURL,
actionTimeout: 2 * 60 * 1000, // set to 2min
screenshot: 'only-on-failure',
},
/* Configure projects for major browsers */
projects: [
{
name: 'Desktop - Chromium',
use: {
...devices['Desktop Chrome'],
ignoreHTTPSErrors: true, // this is needed to avoid getting warnings like: the website is not safe
},
},
{
name: 'Desktop - Firefox',
use: {
...devices['Desktop Firefox'],
ignoreHTTPSErrors: true,
},
},
{
name: 'Desktop - Webkit',
use: {
...devices['Desktop Safari'],
ignoreHTTPSErrors: true,
},
},
],
});