adding-e2e-tests — Claude Code skill: Playwright setup
A skill that walks your agent through Playwright setup: config, a smoke test, npm scripts and a CI run.
npx skills add spencerpauly/awesome-cursor-skills --skill adding-e2e-tests -a claude-codeWhat adding-e2e-tests does
The skill fires when you ask for end-to-end tests, browser tests, integration tests, or Playwright setup. The agent works through seven steps: install Playwright, edit playwright.config.ts, write a smoke test that checks the page loads, add npm scripts, update .gitignore, and wire the run into GitHub Actions.
Setup starts with npm init playwright@latest, which creates playwright.config.ts, a tests/ directory and downloads browsers. If the project already has a test runner, the skill installs manually instead: npm install -D @playwright/test followed by npx playwright install. The config points baseURL at your local dev server, and the webServer block starts it for you during a run. For local speed it suggests keeping chromium only and enabling every browser in CI.
Selectors should use data-testid rather than CSS classes. Classes change with any markup edit, so tests start failing for no real reason. Larger apps get an optional page object step with a tests/pages/ directory. To record a scenario interactively, run npx playwright codegen.
What it helps with
- set up Playwright in a project with no tests yet
- make the dev server start automatically before a test run
- write a first smoke test that checks the page loads
- run e2e tests in GitHub Actions and keep the HTML report
- move selectors and actions into page objects for a bigger app
Example prompts for the agent
- add Playwright e2e tests to this project
- set up playwright.config.ts with an auto-started dev server
- wire the e2e run into GitHub Actions
How to install adding-e2e-tests
1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill adding-e2e-tests -a claude-code2Manually: put the files in place
~/.claude/skills/adding-e2e-tests/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/adding-e2e-tests/
1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill adding-e2e-tests -a codex2Manually: put the files in place
.agents/skills/adding-e2e-tests/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill adding-e2e-tests -a cursor2Manually: put the files in place
.cursor/skills/adding-e2e-tests/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install spencerpauly/awesome-cursor-skills adding-e2e-tests2Manually: put the files in place
.github/skills/adding-e2e-tests/SKILL.md1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill adding-e2e-tests -a gemini-cli2Platform CLI
gemini skills install https://github.com/spencerpauly/awesome-cursor-skills --path resources/adding-e2e-testsManually: put the files in place
.devin/skills/adding-e2e-tests/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill adding-e2e-tests -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about adding-e2e-tests
How do I install adding-e2e-tests in Claude?
Run npx skills add spencerpauly/awesome-cursor-skills --skill adding-e2e-tests -a claude-code. The skill lands in ~/.claude/skills/adding-e2e-tests/SKILL.md.
What does adding-e2e-tests do?
It guides the agent through Playwright setup: install, playwright.config.ts, a smoke test, npm scripts, .gitignore and a CI step.
What does the skill need to work?
A Node.js project with npm, since setup runs through npm init playwright@latest. If a test runner already exists, Playwright is installed manually.
Source text
SKILL.md · CC0-1.0
---
name: adding-e2e-tests
description: Set up Playwright end-to-end testing in a project, including test configuration, example tests, and CI integration.
---
# Add E2E Tests (Playwright)
Use this skill when the user asks to add end-to-end tests, browser tests, integration tests, or set up Playwright.
## Steps
1. **Install Playwright**
```bash
npm init playwright@latest
```
This creates `playwright.config.ts`, a `tests/` directory, and installs browsers. If the project already has a test runner, install manually:
```bash
npm install -D @playwright/test
npx playwright install
```
2. **Configure `playwright.config.ts`**
- Set `baseURL` to the local dev server URL (e.g. `http://localhost:3000`).
- Configure `webServer` to start the dev server automatically:
```ts
webServer: {
command: "npm run dev",
url: "http://localhost:3000",
reuseExistingServer: !process.env.CI,
},
```
- Enable only chromium for local dev speed; enable all browsers in CI.
3. **Create a smoke test** — write a basic test that verifies the app loads:
```ts
import { test, expect } from "@playwright/test";
test("homepage loads", async ({ page }) => {
await page.goto("/");
await expect(page).toHaveTitle(/.+/);
});
```
4. **Add page object pattern (optional)** — for larger apps, create a `tests/pages/` directory with page objects that encapsulate selectors and actions.
5. **Add npm scripts**
```json
{
"test:e2e": "playwright test",
"test:e2e:ui": "playwright test --ui"
}
```
6. **Add to `.gitignore`**
```
test-results/
playwright-report/
blob-report/
```
7. **CI integration** — add a GitHub Actions step that runs `npx playwright install --with-deps` then `npm run test:e2e`. Use the official `actions/upload-artifact` to save the HTML report on failure.
## Notes
- Use `data-testid` attributes for selectors instead of CSS classes.
- Use `test.describe` to group related tests.
- Run `npx playwright codegen` to record tests interactively.
© spencerpauly · CC0-1.0 · spencerpauly/awesome-cursor-skills