-
Notifications
You must be signed in to change notification settings - Fork 385
/
playwright.config.ts
114 lines (106 loc) · 3.49 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
// Copyright (C) 2023 Storj Labs, Inc.
// See LICENSE for copying information.
import * as os from 'os';
// import generateCustomLayoutSimpleMeta from './slackReporter';
import { defineConfig, ReporterDescription } from '@playwright/test';
// require('dotenv').config();
// Potentially interesting metadata to append into the test report – might help with debugging
const metadata: Record<string, string> = {
cpu: os.arch(),
memory: `${os.totalmem() / (1024 ** 2)} MB`,
hostname: os.hostname(),
system: os.type(),
kernel: os.version(),
};
enum Reporter {
HTML = 'html',
List = 'list',
CI = 'github'
}
/**
* Customize reporters.
* By default, we want to have a standard list reporting and a pretty HTML output.
* In CI pipelines, we want to have an annotated report visible on the GitHub Actions page.
*/
const addReporter = (): ReporterDescription[] => {
const defaultReporter: ReporterDescription[] = [
[Reporter.List],
[Reporter.HTML],
];
if (isPipeline) {
return defaultReporter.concat([[Reporter.CI]]);
}
return defaultReporter;
};
const isPipeline = !!process.env.CI;
const threshold = 0.95;
export default defineConfig({
expect: {
timeout: 4000, // Maximum time expect() should wait for the condition to be met.
toMatchSnapshot: { threshold }, // Only require the screenshots to be the same within a certain threshold.
},
fullyParallel: false, // Opt out of parallel tests on CI.
outputDir: 'test-results/', // Folder for test artifacts such as screenshots, videos, traces, etc.
projects: [
{
name: 'chromium-hd',
use: {
viewport: { width: 1280, height: 720 },
browserName: 'chromium',
headless: true,
launchOptions: {
// args: ["--headless","--no-sandbox","--use-angle=gl"]
args: ['--no-sandbox'],
},
},
},
/*
{
name: 'chromium-fhd',
use: {
viewport: { width: 1920, height: 1080 },
browserName: 'chromium',
},
},
{
name: 'firefox-hd',
use: {
viewport: { width: 1280, height: 720 },
browserName: 'firefox',
},
},
{
name: 'webkit-hd',
use: {
viewport: { width: 1280, height: 720 },
browserName: 'webkit',
},
},*/
],
reporter: [
[
'./node_modules/playwright-slack-report/dist/src/SlackReporter.js',
{
channels: ['#team-integrations-console-alerts'], // provide one or more Slack channels
sendResults: 'always', // "always" , "on-failure", "off"
showInThread: true,
},
],
['dot'],
['html'],
],
retries: process.env.CI ? 1 : 0, // Retry on CI only.
testDir: './tests', // Directory where tests are located.
timeout: 20 * 1000, // Maximum time one test can run for.
use: {
actionTimeout: 0, // Maximum time each action can take.
// baseURL: 'http://127.0.0.1:10000',
ignoreHTTPSErrors: true, // Suppress the errors relative to serving web data.
trace: 'on-first-retry', // Collect trace when retrying the failed test.
launchOptions: {
slowMo: process.env.CI ? 0 : 0,
headless: true,
},
},
workers: process.env.CI ? 1 : undefined,
});