|
| 1 | +import { defineConfig, devices } from "@playwright/test"; |
| 2 | +import type nodeProcess from "node:process"; |
| 3 | + |
| 4 | +declare const process: typeof nodeProcess; |
| 5 | + |
| 6 | +/** |
| 7 | + * See https://playwright.dev/docs/test-configuration. |
| 8 | + */ |
| 9 | +export default defineConfig({ |
| 10 | + testDir: "./", |
| 11 | + /* Run tests in files in parallel */ |
| 12 | + fullyParallel: true, |
| 13 | + /* Fail the build on CI if you accidentally left test.only in the source code. */ |
| 14 | + forbidOnly: !!process.env.CI, |
| 15 | + /* Retry on CI only */ |
| 16 | + retries: process.env.CI ? 2 : 0, |
| 17 | + /* Opt out of parallel tests on CI. */ |
| 18 | + workers: process.env.CI ? 1 : undefined, |
| 19 | + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ |
| 20 | + reporter: "html", |
| 21 | + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ |
| 22 | + use: { |
| 23 | + /* Base URL to use in actions like `await page.goto('/')`. */ |
| 24 | + baseURL: "http://localhost:8791", |
| 25 | + |
| 26 | + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ |
| 27 | + trace: "on-first-retry", |
| 28 | + }, |
| 29 | + |
| 30 | + /* Configure projects for major browsers */ |
| 31 | + projects: [ |
| 32 | + { |
| 33 | + name: "chromium", |
| 34 | + use: { ...devices["Desktop Chrome"] }, |
| 35 | + }, |
| 36 | + // TODO(vicb): enable all browsers |
| 37 | + // { |
| 38 | + // name: "firefox", |
| 39 | + // use: { ...devices["Desktop Firefox"] }, |
| 40 | + // }, |
| 41 | + // { |
| 42 | + // name: "webkit", |
| 43 | + // use: { ...devices["Desktop Safari"] }, |
| 44 | + // }, |
| 45 | + ], |
| 46 | + |
| 47 | + /* Run your local dev server before starting the tests */ |
| 48 | + webServer: { |
| 49 | + command: "pnpm preview", |
| 50 | + url: "http://localhost:8791", |
| 51 | + reuseExistingServer: !process.env.CI, |
| 52 | + timeout: 70_000, |
| 53 | + }, |
| 54 | +}); |
0 commit comments