|
| 1 | +// @ignoreFile |
| 2 | +import { defineConfig, devices } from '@playwright/test'; |
| 3 | +import { config } from 'dotenv'; |
| 4 | + |
| 5 | +// Load environment variables from .env file |
| 6 | +config(); |
| 7 | + |
| 8 | +/** |
| 9 | + * See https://playwright.dev/docs/test-configuration. |
| 10 | + */ |
| 11 | +export default defineConfig({ |
| 12 | + testDir: './tests', |
| 13 | + /* Run tests in files in parallel */ |
| 14 | + fullyParallel: true, |
| 15 | + /* Fail the build on CI if you accidentally left test.only in the source code. */ |
| 16 | + forbidOnly: !!process.env.CI, |
| 17 | + /* Retry on CI only */ |
| 18 | + retries: process.env.CI ? 2 : 0, |
| 19 | + /* Opt out of parallel tests on CI. */ |
| 20 | + workers: process.env.CI ? 1 : undefined, |
| 21 | + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ |
| 22 | + reporter: 'html', |
| 23 | + |
| 24 | + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ |
| 25 | + use: { |
| 26 | + /* Base URL to use in actions like `await page.goto('/')`. */ |
| 27 | + baseURL: 'http://127.0.0.1:3333', |
| 28 | + |
| 29 | + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ |
| 30 | + trace: 'on-first-retry', |
| 31 | + }, |
| 32 | + |
| 33 | + /* Global timeout settings */ |
| 34 | + timeout: 180000, // 3 minutes for individual tests |
| 35 | + expect: { |
| 36 | + timeout: 60000, // 1 minute for expect assertions |
| 37 | + }, |
| 38 | + |
| 39 | + /* Configure projects for major browsers */ |
| 40 | + projects: [ |
| 41 | + { |
| 42 | + name: 'chromium', |
| 43 | + use: { ...devices['Desktop Chrome'] }, |
| 44 | + snapshotPathTemplate: '{testDir}/{testFileName}-snapshots/{arg}{ext}', |
| 45 | + }, |
| 46 | + ], |
| 47 | + |
| 48 | + /* Run your local dev server before starting the tests */ |
| 49 | + webServer: { |
| 50 | + command: 'pnpm dev --port 3333', |
| 51 | + url: 'http://127.0.0.1:3333', |
| 52 | + reuseExistingServer: false, // Always start fresh |
| 53 | + }, |
| 54 | +}); |
| 55 | + |
| 56 | + |
0 commit comments