|
| 1 | +import type { PlaywrightTestConfig } 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 | +const config: PlaywrightTestConfig = { |
| 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:3000', |
| 39 | + |
| 40 | + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ |
| 41 | + trace: "on-first-retry", |
| 42 | + }, |
| 43 | + |
| 44 | + /* Folder for test artifacts such as screenshots, videos, traces, etc. */ |
| 45 | + // outputDir: 'test-results/', |
| 46 | + |
| 47 | + /* Run your local dev server before starting the tests */ |
| 48 | + // webServer: { |
| 49 | + // command: 'npm run start', |
| 50 | + // port: 3000, |
| 51 | + // }, |
| 52 | +}; |
| 53 | + |
| 54 | +export default config; |
0 commit comments