-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaywright.config.js
58 lines (51 loc) · 1.52 KB
/
playwright.config.js
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
// playwright.config.js
const { devices } = require('@playwright/test');
module.exports = {
// Define browsers and devices
projects: [
{
name: 'Desktop Chrome',
use: {
browserName: 'chromium',
...devices['Desktop Chrome'],
// // You can specify browser options here
// headless: true,
},
},
// {
// name: 'Desktop Firefox',
// use: {
// browserName: 'firefox',
// ...devices['Desktop Firefox'],
// // You can specify browser options here
// headless: true,
// },
// },
// {
// name: 'Desktop Safari',
// use: {
// browserName: 'Safari',
// ...devices['Desktop Safari'],
// // You can specify browser options here
// headless: true,
// },
// },
// You can add more browsers or device configurations here if needed
],
// Use Allure reporter
reporter: [['allure-playwright']],
// Retry failed tests, set to 0 or desired retry count
retries: 0,
// Output directory for test results
outputDir: 'test-results/',
// Configure the test environment
testDir: './test',
// Directory where your tests are located
testMatch: '**/*.test.js', // Pattern to match test files
afterEach: async ({ page, testInfo }) => {
if (testInfo.status === 'failed') {
// Save the screenshot in the output directory with a name based on the test
await page.screenshot({ path: `test-results/${testInfo.title.replace(/ /g, '_')}-screenshot.png` });
}
},
};