|
| 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: "./tests", |
| 14 | + /* Run tests in files in parallel */ |
| 15 | + fullyParallel: true, |
| 16 | + /* Fail the build on CI if you accidentally left test.only in the source code. */ |
| 17 | + forbidOnly: !!process.env.CI, |
| 18 | + /* Retry on CI only */ |
| 19 | + retries: process.env.CI ? 2 : 0, |
| 20 | + /* Opt out of parallel tests on CI. */ |
| 21 | + workers: process.env.CI ? 1 : undefined, |
| 22 | + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ |
| 23 | + reporter: process.env.CI ? "dot" : "list", |
| 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://localhost:3000", |
| 28 | + |
| 29 | + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ |
| 30 | + trace: "on-first-retry", |
| 31 | + }, |
| 32 | + |
| 33 | + projects: [ |
| 34 | + { |
| 35 | + name: "chromium", |
| 36 | + use: { ...devices["Desktop Chrome"] }, |
| 37 | + }, |
| 38 | + /* Test against mobile viewports. */ |
| 39 | + { |
| 40 | + name: "Mobile Chrome", |
| 41 | + use: { ...devices["Pixel 5"] }, |
| 42 | + }, |
| 43 | + ], |
| 44 | + |
| 45 | + /* Run your local dev server before starting the tests */ |
| 46 | + webServer: { |
| 47 | + command: |
| 48 | + "wasp-app-runner --app-path=../ --app-name=examples-tutorials-TodoAppTs --db-type sqlite", |
| 49 | + |
| 50 | + // Wait for the backend to start |
| 51 | + url: "http://localhost:3001", |
| 52 | + reuseExistingServer: !process.env.CI, |
| 53 | + timeout: 180 * 1000, |
| 54 | + gracefulShutdown: { signal: "SIGTERM", timeout: 500 }, |
| 55 | + }, |
| 56 | +}); |
0 commit comments