|
| 1 | +import { defineConfig, devices } from '@playwright/test'; |
| 2 | + |
| 3 | +/** |
| 4 | + * Read environment variables from file. |
| 5 | + * https://github.com/motdotla/dotenv |
| 6 | + */ |
| 7 | +// require('dotenv').config(); |
| 8 | + |
| 9 | +/** |
| 10 | + * See https://playwright.dev/docs/test-configuration. |
| 11 | + */ |
| 12 | +export default defineConfig({ |
| 13 | + testDir: './e2e', |
| 14 | + /* Maximum time one test can run for. */ |
| 15 | + timeout: 30 * 1000, |
| 16 | + expect: { |
| 17 | + /** |
| 18 | + * Maximum time expect() should wait for the condition to be met. |
| 19 | + * For example in `await expect(locator).toHaveText();` |
| 20 | + */ |
| 21 | + timeout: 5000, |
| 22 | + }, |
| 23 | + /* Run tests in files in parallel */ |
| 24 | + fullyParallel: true, |
| 25 | + /* Fail the build on CI if you accidentally left test.only in the source code. */ |
| 26 | + forbidOnly: !!process.env.CI, |
| 27 | + /* Retry on CI only */ |
| 28 | + retries: process.env.CI ? 2 : 0, |
| 29 | + /* Opt out of parallel tests on CI. */ |
| 30 | + workers: process.env.CI ? 1 : undefined, |
| 31 | + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ |
| 32 | + reporter: 'html', |
| 33 | + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ |
| 34 | + use: { |
| 35 | + /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ |
| 36 | + actionTimeout: 0, |
| 37 | + /* Base URL to use in actions like `await page.goto('/')`. */ |
| 38 | + // baseURL: 'http://localhost:8000', |
| 39 | + |
| 40 | + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ |
| 41 | + trace: 'on-first-retry', |
| 42 | + |
| 43 | + // See https://playwright.dev/docs/network#missing-network-events-and-service-workers |
| 44 | + serviceWorkers: 'block', |
| 45 | + }, |
| 46 | + |
| 47 | + /* Configure projects for major browsers */ |
| 48 | + projects: [ |
| 49 | + { |
| 50 | + name: 'chromium', |
| 51 | + use: { ...devices['Desktop Chrome'] }, |
| 52 | + }, |
| 53 | + |
| 54 | + // { |
| 55 | + // name: 'firefox', |
| 56 | + // use: { ...devices['Desktop Firefox'] }, |
| 57 | + // }, |
| 58 | + |
| 59 | + // { |
| 60 | + // name: 'webkit', |
| 61 | + // use: { ...devices['Desktop Safari'] }, |
| 62 | + // }, |
| 63 | + |
| 64 | + /* Test against mobile viewports. */ |
| 65 | + // { |
| 66 | + // name: 'Mobile Chrome', |
| 67 | + // use: { ...devices['Pixel 5'] }, |
| 68 | + // }, |
| 69 | + // { |
| 70 | + // name: 'Mobile Safari', |
| 71 | + // use: { ...devices['iPhone 12'] }, |
| 72 | + // }, |
| 73 | + |
| 74 | + /* Test against branded browsers. */ |
| 75 | + // { |
| 76 | + // name: 'Microsoft Edge', |
| 77 | + // use: { channel: 'msedge' }, |
| 78 | + // }, |
| 79 | + // { |
| 80 | + // name: 'Google Chrome', |
| 81 | + // use: { channel: 'chrome' }, |
| 82 | + // }, |
| 83 | + ], |
| 84 | + |
| 85 | + /* Folder for test artifacts such as screenshots, videos, traces, etc. */ |
| 86 | + // outputDir: 'test-results/', |
| 87 | + |
| 88 | + /* Run your local dev server before starting the tests */ |
| 89 | + // webServer: { |
| 90 | + // command: 'pnpm start', |
| 91 | + // port: 3000, |
| 92 | + // }, |
| 93 | +}); |
0 commit comments