Skip to content

Commit c80688c

Browse files
committed
add SSR support to Playwright configuration and streamline e2e test execution
1 parent d9b43de commit c80688c

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,42 @@
11
import defaultConfig from '@microsoft/fast-test-harness/playwright.config.mjs';
2-
import { defineConfig } from '@playwright/test';
2+
import { defineConfig, devices } from '@playwright/test';
33

44
const CI = process.env.CI === 'true';
55

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+
637
export default defineConfig({
738
...defaultConfig,
39+
projects,
840
reporter: CI ? 'github' : 'list',
941
testMatch: 'src/**/*.spec.ts',
1042
});

0 commit comments

Comments
 (0)