|
| 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 | +// import path from 'path'; |
| 9 | +// dotenv.config({ path: path.resolve(__dirname, '.env') }); |
| 10 | + |
| 11 | +/** |
| 12 | + * See https://playwright.dev/docs/test-configuration. |
| 13 | + */ |
| 14 | +export default defineConfig({ |
| 15 | + testDir: './e2e', |
| 16 | + /* Run tests in files in parallel */ |
| 17 | + fullyParallel: true, |
| 18 | + /* Fail the build on CI if you accidentally left test.only in the source code. */ |
| 19 | + forbidOnly: !!process.env.CI, |
| 20 | + /* Retry on CI only */ |
| 21 | + retries: process.env.CI ? 2 : 0, |
| 22 | + /* Opt out of parallel tests on CI. */ |
| 23 | + workers: process.env.CI ? 1 : undefined, |
| 24 | + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ |
| 25 | + reporter: 'html', |
| 26 | + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ |
| 27 | + use: { |
| 28 | + /* Base URL to use in actions like `await page.goto('')`. */ |
| 29 | + // baseURL: 'http://localhost:3000', |
| 30 | + |
| 31 | + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ |
| 32 | + trace: 'on-first-retry', |
| 33 | + }, |
| 34 | + |
| 35 | + /* Configure projects for major browsers */ |
| 36 | + projects: [ |
| 37 | + { |
| 38 | + name: 'chromium', |
| 39 | + use: { ...devices['Desktop Chrome'] }, |
| 40 | + }, |
| 41 | + { |
| 42 | + name: 'Mobile Chrome', |
| 43 | + use: { ...devices['Pixel 5'] }, |
| 44 | + }, |
| 45 | + ], |
| 46 | + |
| 47 | + /* Run your local dev server before starting the tests */ |
| 48 | + // webServer: { |
| 49 | + // command: 'npm run start', |
| 50 | + // url: 'http://localhost:3000', |
| 51 | + // reuseExistingServer: !process.env.CI, |
| 52 | + // }, |
| 53 | +}) |
0 commit comments