| Pokey Rule | a4ad8af | 2025-05-08 15:05:27 +0100 | [diff] [blame] | 1 | import { |
| 2 | defineConfig, |
| 3 | devices, |
| 4 | PlaywrightTestConfig, |
| 5 | } from "@sand4rt/experimental-ct-web"; |
| Sean McCullough | b29f891 | 2025-04-20 15:39:11 -0700 | [diff] [blame] | 6 | |
| 7 | /** |
| 8 | * See https://playwright.dev/docs/test-configuration. |
| 9 | */ |
| 10 | export default defineConfig({ |
| Sean McCullough | a0f68fa | 2025-04-22 09:57:54 -0700 | [diff] [blame] | 11 | testDir: "./src", |
| Sean McCullough | b29f891 | 2025-04-20 15:39:11 -0700 | [diff] [blame] | 12 | /* The base directory, relative to the config file, for snapshot files created with toMatchSnapshot and toHaveScreenshot. */ |
| Sean McCullough | a0f68fa | 2025-04-22 09:57:54 -0700 | [diff] [blame] | 13 | snapshotDir: "./__snapshots__", |
| Sean McCullough | b29f891 | 2025-04-20 15:39:11 -0700 | [diff] [blame] | 14 | /* Maximum time one test can run for. */ |
| 15 | timeout: 10 * 1000, |
| 16 | /* Run tests in files in parallel */ |
| 17 | fullyParallel: true, |
| 18 | /* Fail the build on CI if you accidentally left test.only in the source code. */ |
| 19 | forbidOnly: !!process.env.CI, |
| 20 | /* Retry on CI only */ |
| 21 | retries: process.env.CI ? 2 : 0, |
| 22 | /* Opt out of parallel tests on CI. */ |
| 23 | workers: process.env.CI ? 1 : undefined, |
| 24 | /* Reporter to use. See https://playwright.dev/docs/test-reporters */ |
| Pokey Rule | a4ad8af | 2025-05-08 15:05:27 +0100 | [diff] [blame] | 25 | reporter: getReporterConfig(), |
| Sean McCullough | b29f891 | 2025-04-20 15:39:11 -0700 | [diff] [blame] | 26 | /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ |
| 27 | use: { |
| 28 | /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ |
| Sean McCullough | a0f68fa | 2025-04-22 09:57:54 -0700 | [diff] [blame] | 29 | trace: "on-first-retry", |
| Sean McCullough | b29f891 | 2025-04-20 15:39:11 -0700 | [diff] [blame] | 30 | |
| 31 | /* Port to use for Playwright component endpoint. */ |
| 32 | ctPort: 3100, |
| 33 | }, |
| 34 | |
| 35 | /* Configure projects for major browsers */ |
| 36 | projects: [ |
| 37 | { |
| Sean McCullough | a0f68fa | 2025-04-22 09:57:54 -0700 | [diff] [blame] | 38 | name: "chromium", |
| 39 | use: { ...devices["Desktop Chrome"] }, |
| Sean McCullough | b29f891 | 2025-04-20 15:39:11 -0700 | [diff] [blame] | 40 | }, |
| 41 | // { |
| 42 | // name: 'firefox', |
| 43 | // use: { ...devices['Desktop Firefox'] }, |
| 44 | // }, |
| 45 | // { |
| 46 | // name: 'webkit', |
| 47 | // use: { ...devices['Desktop Safari'] }, |
| 48 | // }, |
| 49 | ], |
| 50 | }); |
| Pokey Rule | a4ad8af | 2025-05-08 15:05:27 +0100 | [diff] [blame] | 51 | |
| 52 | function getReporterConfig(): PlaywrightTestConfig["reporter"] { |
| Philip Zeyliger | 8bdf627 | 2025-05-16 13:36:21 -0700 | [diff] [blame] | 53 | // Sketch does not understand the junit failure reporting very well. |
| Autoformatter | 8c46362 | 2025-05-16 21:54:17 +0000 | [diff] [blame] | 54 | |
| Pokey Rule | a4ad8af | 2025-05-08 15:05:27 +0100 | [diff] [blame] | 55 | return [["html", { open: "never" }]]; |
| 56 | } |