|
1 | 1 | import defaultConfig from '@microsoft/fast-test-harness/playwright.config.mjs'; |
2 | | -import { defineConfig } from '@playwright/test'; |
| 2 | +import { defineConfig, devices } from '@playwright/test'; |
3 | 3 |
|
4 | 4 | const CI = process.env.CI === 'true'; |
5 | 5 |
|
| 6 | +// Duplicate each browser project across CSR and SSR rendering modes so a |
| 7 | +// single `playwright test` run exercises both. Per-test overrides |
| 8 | +// (e.g. `test.use({ ssr: true })`) still take precedence over the |
| 9 | +// project-level value. |
| 10 | +// |
| 11 | +// TODO: Remove this local axis once the equivalent change lands in |
| 12 | +// @microsoft/fast-test-harness/playwright.config.mjs. |
| 13 | +const browsers = [ |
| 14 | + { name: 'chromium', use: devices['Desktop Chrome'] }, |
| 15 | + { name: 'firefox', use: devices['Desktop Firefox'] }, |
| 16 | + { |
| 17 | + name: 'webkit', |
| 18 | + use: { |
| 19 | + ...devices['Desktop Safari'], |
| 20 | + deviceScaleFactor: 1, |
| 21 | + }, |
| 22 | + }, |
| 23 | +]; |
| 24 | + |
| 25 | +const modes = [ |
| 26 | + { suffix: 'csr', ssr: false }, |
| 27 | + { suffix: 'ssr', ssr: true }, |
| 28 | +]; |
| 29 | + |
| 30 | +const projects = browsers.flatMap(browser => |
| 31 | + modes.map(mode => ({ |
| 32 | + name: `${browser.name}-${mode.suffix}`, |
| 33 | + use: { ...browser.use, ssr: mode.ssr }, |
| 34 | + })), |
| 35 | +); |
| 36 | + |
6 | 37 | export default defineConfig({ |
7 | 38 | ...defaultConfig, |
| 39 | + projects, |
8 | 40 | reporter: CI ? 'github' : 'list', |
9 | 41 | testMatch: 'src/**/*.spec.ts', |
10 | 42 | }); |
0 commit comments