|
| 1 | +import { defineConfig, devices } from '@playwright/test'; |
| 2 | + |
| 3 | +/** |
| 4 | + * Read environment variables from file. |
| 5 | + * https://github.com/motdotla/dotenv |
| 6 | + */ |
| 7 | +// import dotenv from 'dotenv'; |
| 8 | +// dotenv.config({ path: path.resolve(__dirname, '.env') }); |
| 9 | + |
| 10 | +/** |
| 11 | + * See https://playwright.dev/docs/test-configuration. |
| 12 | + */ |
| 13 | +export default 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 | + { |
| 37 | + name: 'chromium', |
| 38 | + use: { ...devices['Desktop Chrome'] }, |
| 39 | + }, |
| 40 | + |
| 41 | + { |
| 42 | + name: 'firefox', |
| 43 | + use: { ...devices['Desktop Firefox'] }, |
| 44 | + }, |
| 45 | + |
| 46 | + { |
| 47 | + name: 'webkit', |
| 48 | + use: { ...devices['Desktop Safari'] }, |
| 49 | + }, |
| 50 | + |
| 51 | + /* Test against mobile viewports. */ |
| 52 | + // { |
| 53 | + // name: 'Mobile Chrome', |
| 54 | + // use: { ...devices['Pixel 5'] }, |
| 55 | + // }, |
| 56 | + // { |
| 57 | + // name: 'Mobile Safari', |
| 58 | + // use: { ...devices['iPhone 12'] }, |
| 59 | + // }, |
| 60 | + |
| 61 | + /* Test against branded browsers. */ |
| 62 | + // { |
| 63 | + // name: 'Microsoft Edge', |
| 64 | + // use: { ...devices['Desktop Edge'], channel: 'msedge' }, |
| 65 | + // }, |
| 66 | + // { |
| 67 | + // name: 'Google Chrome', |
| 68 | + // use: { ...devices['Desktop Chrome'], channel: 'chrome' }, |
| 69 | + // }, |
| 70 | + ], |
| 71 | + |
| 72 | + /* Run your local dev server before starting the tests */ |
| 73 | + // webServer: { |
| 74 | + // command: 'npm run start', |
| 75 | + // url: 'http://127.0.0.1:3000', |
| 76 | + // reuseExistingServer: !process.env.CI, |
| 77 | + // }, |
| 78 | +}); |
0 commit comments