Skip to content

Commit 5d82444

Browse files
committed
doc: optimize playwright configuration and contribution doc
1 parent 1824c62 commit 5d82444

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

CONTRIBUTING.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,23 @@ pnpm test:browser:ui # Run with Playwright UI
752752

753753
Make sure to read about [Playwright best practices](https://playwright.dev/docs/best-practices) and don't rely on classes/IDs but try to follow user-replicable behaviour (like selecting an element based on text content instead).
754754

755+
#### Updating snapshots
756+
757+
Some tests use image snapshots that must match the CI environment (Linux). If you need to update them, use Docker to run in the same environment:
758+
759+
```bash
760+
docker run --rm \
761+
-e CI=true \
762+
-e NODE_OPTIONS="--max-old-space-size=4096" \
763+
-v $(pwd):/work \
764+
-w /work \
765+
mcr.microsoft.com/playwright:v1.58.2-noble \
766+
sh -c "npm install -g pnpm && pnpm install && pnpm vp run build:test && pnpm vp run test:browser:prebuilt --update-snapshots"
767+
```
768+
769+
> [!NOTE]
770+
> If the build runs out of memory, increase `--max-old-space-size` to `8192`.
771+
755772
### Test fixtures (mocking external APIs)
756773

757774
E2E tests use a fixture system to mock external API requests, ensuring tests are deterministic and don't hit real APIs. This is handled at two levels:

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default defineConfig<ConfigOptions>({
1515
webServer: {
1616
command: 'pnpm start:playwright:webserver',
1717
url: baseURL,
18-
reuseExistingServer: false,
18+
reuseExistingServer: !process.env.CI,
1919
timeout: 60_000,
2020
},
2121
// Start/stop mock connector server before/after all tests (teardown via returned closure)

0 commit comments

Comments
 (0)