Skip to content

Commit fc9f9be

Browse files
committed
chore(skills): add visual-testing skill
1 parent e80978e commit fc9f9be

1 file changed

Lines changed: 82 additions & 0 deletions

File tree

  • .github/skills/visual-testing-snapshots
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
name: visual-testing-snapshots
3+
description: 'Run IX visual-testing snapshot checks or snapshot updates inside the Playwright Docker image. Use for updating or verifying visual regression snapshots with the visual-testing package, especially when a specific .e2e.ts test file should be run with or without -u.'
4+
argument-hint: 'Provide the visual test file, for example button.e2e.ts, and whether snapshots should be updated'
5+
user-invocable: true
6+
---
7+
8+
# Visual Testing Snapshots
9+
10+
## When to Use
11+
12+
- Update IX visual regression snapshots for one or more `testing/visual-testing/**/*.e2e.ts` files.
13+
- Re-run a visual regression test inside Docker to verify snapshot changes.
14+
- A PR changes component UI, styling, theme output, layout, density, screenshots, or visual state and requires snapshot updates.
15+
- A visual regression failure needs to be reproduced in the same Linux Playwright environment used by CI.
16+
17+
## Required Constraints
18+
19+
- Run visual-testing snapshot checks and updates only inside a Playwright Docker image.
20+
- Use the Docker image that matches the currently used `@playwright/test` or `playwright` version from `pnpm-workspace.yaml`.
21+
- For the current repository configuration, use `mcr.microsoft.com/playwright:v1.58.1-noble`.
22+
- Install `pnpm` inside the Docker command or shell with `npm i -g pnpm`.
23+
- Do not run a build inside Docker. If built package output is required, build outside Docker before starting the snapshot update flow.
24+
- Do not run `pnpm run test.setup` inside the Playwright Docker image unless a test explicitly fails because the browser installation is missing.
25+
26+
## Inputs To Gather
27+
28+
- The visual test file to run, preferably a path under `testing/visual-testing/tests/`, for example `testing/visual-testing/tests/button/button.e2e.ts`.
29+
- Whether the user wants to update snapshots (`-u`) or only verify the current snapshots.
30+
- Whether the repository has already been built outside Docker when the visual test depends on built package output.
31+
32+
## Procedure
33+
34+
1. Confirm the current Playwright version from `pnpm-workspace.yaml` before choosing the Docker image. Use the matching `mcr.microsoft.com/playwright:v<version>-noble` image.
35+
2. Make sure the test file exists under `testing/visual-testing/tests/`.
36+
3. If the requested action is an update, run the test inside Docker with `-u`.
37+
4. If the requested action is a verification run, run the same command without `-u`.
38+
5. Keep the build outside Docker. Do not add `pnpm build`, `pnpm run build`, or Turbo build commands to the Docker command.
39+
6. After the run, inspect the changed files under `testing/visual-testing/__screenshots__/` and report the updated snapshots or test failure.
40+
41+
## Commands
42+
43+
From the repository root, update snapshots for a specific test:
44+
45+
```sh
46+
docker run --rm -v "$(pwd):/work" -w /work mcr.microsoft.com/playwright:v1.58.1-noble /bin/bash -lc 'npm i -g pnpm && pnpm --filter visual-testing visual-regression mytest.e2e.ts -u'
47+
```
48+
49+
From the repository root, verify a specific test without updating snapshots:
50+
51+
```sh
52+
docker run --rm -v "$(pwd):/work" -w /work mcr.microsoft.com/playwright:v1.58.1-noble /bin/bash -lc 'npm i -g pnpm && pnpm --filter visual-testing visual-regression mytest.e2e.ts'
53+
```
54+
55+
Replace `mytest.e2e.ts` with the requested test file name or path, for example:
56+
57+
```sh
58+
docker run --rm -v "$(pwd):/work" -w /work mcr.microsoft.com/playwright:v1.58.1-noble /bin/bash -lc 'npm i -g pnpm && pnpm --filter visual-testing visual-regression testing/visual-testing/tests/button/button.e2e.ts -u'
59+
```
60+
61+
## Failure Handling
62+
63+
- If Docker is not available, stop and report that visual-testing snapshot updates require Docker.
64+
- If `pnpm` is missing inside the container, keep `npm i -g pnpm` in the Docker pipeline instead of using a host-installed package manager.
65+
- If the test fails because built IX output is missing, stop and ask for or run the needed build outside Docker, then re-run only the visual-testing command inside Docker.
66+
- If snapshots change unexpectedly outside the requested test area, inspect the diff before reporting success.
67+
68+
## Output Format
69+
70+
When using this skill, report:
71+
72+
1. Docker image used.
73+
2. Command run.
74+
3. Snapshot update status: updated, unchanged, or failed.
75+
4. Changed snapshot files, if any.
76+
5. Any follow-up needed, such as running the build outside Docker before retrying.
77+
78+
## Example Prompts
79+
80+
- `Use the visual-testing-snapshots skill to update button.e2e.ts snapshots.`
81+
- `Run the visual-testing snapshot check for testing/visual-testing/tests/menu/menu.e2e.ts without updating.`
82+
- `Update the visual regression snapshots for mytest.e2e.ts in Docker.`

0 commit comments

Comments
 (0)