1979 |
stevensc |
1 |
// @ts-check
|
|
|
2 |
const { defineConfig, devices } = require('@playwright/test')
|
|
|
3 |
|
|
|
4 |
/**
|
|
|
5 |
* Read environment variables from file.
|
|
|
6 |
* https://github.com/motdotla/dotenv
|
|
|
7 |
*/
|
|
|
8 |
// require('dotenv').config();
|
|
|
9 |
|
|
|
10 |
/**
|
|
|
11 |
* @see https://playwright.dev/docs/test-configuration
|
|
|
12 |
*/
|
|
|
13 |
module.exports = defineConfig({
|
|
|
14 |
testDir: './tests',
|
|
|
15 |
/* Run tests in files in parallel */
|
|
|
16 |
fullyParallel: true,
|
|
|
17 |
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
|
18 |
forbidOnly: !!process.env.CI,
|
|
|
19 |
/* Retry on CI only */
|
|
|
20 |
retries: process.env.CI ? 2 : 0,
|
|
|
21 |
/* Opt out of parallel tests on CI. */
|
|
|
22 |
workers: process.env.CI ? 1 : undefined,
|
|
|
23 |
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
|
|
24 |
reporter: 'html',
|
|
|
25 |
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
|
26 |
use: {
|
|
|
27 |
/* Base URL to use in actions like `await page.goto('/')`. */
|
|
|
28 |
// baseURL: 'http://127.0.0.1:3000',
|
|
|
29 |
|
|
|
30 |
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
|
31 |
trace: 'on-first-retry'
|
|
|
32 |
},
|
|
|
33 |
|
|
|
34 |
/* Configure projects for major browsers */
|
|
|
35 |
projects: [
|
|
|
36 |
{ name: 'setup', testMatch: /.*\.setup\.js/ },
|
|
|
37 |
|
|
|
38 |
{
|
|
|
39 |
name: 'chromium',
|
|
|
40 |
use: { ...devices['Desktop Chrome'], storageState: './auth.json' },
|
|
|
41 |
dependencies: ['setup']
|
|
|
42 |
},
|
|
|
43 |
|
|
|
44 |
{
|
|
|
45 |
name: 'firefox',
|
|
|
46 |
use: { ...devices['Desktop Firefox'], storageState: './auth.json' },
|
|
|
47 |
dependencies: ['setup']
|
|
|
48 |
},
|
|
|
49 |
|
|
|
50 |
{
|
|
|
51 |
name: 'webkit',
|
|
|
52 |
use: { ...devices['Desktop Safari'], storageState: './auth.json' },
|
|
|
53 |
dependencies: ['setup']
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
/* Test against mobile viewports. */
|
|
|
57 |
// {
|
|
|
58 |
// name: 'Mobile Chrome',
|
|
|
59 |
// use: { ...devices['Pixel 5'] },
|
|
|
60 |
// },
|
|
|
61 |
// {
|
|
|
62 |
// name: 'Mobile Safari',
|
|
|
63 |
// use: { ...devices['iPhone 12'] },
|
|
|
64 |
// },
|
|
|
65 |
|
|
|
66 |
/* Test against branded browsers. */
|
|
|
67 |
// {
|
|
|
68 |
// name: 'Microsoft Edge',
|
|
|
69 |
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
|
|
|
70 |
// },
|
|
|
71 |
// {
|
|
|
72 |
// name: 'Google Chrome',
|
|
|
73 |
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
|
|
|
74 |
// },
|
|
|
75 |
]
|
|
|
76 |
|
|
|
77 |
/* Run your local dev server before starting the tests */
|
|
|
78 |
// webServer: {
|
|
|
79 |
// command: 'npm run start',
|
|
|
80 |
// url: 'http://127.0.0.1:3000',
|
|
|
81 |
// reuseExistingServer: !process.env.CI,
|
|
|
82 |
// },
|
|
|
83 |
})
|