Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add spencerpauly/awesome-cursor-skills --skill adding-e2e-tests -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/adding-e2e-tests/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/adding-e2e-tests/

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

Similar skills

Everything for Testing and QA →

From the same set59

writing-commit-messages This skill gives the agent a fixed format for commit messages: type, scope, body, footer. Useful when the model writes the commits, not you. CX Codex +1 454installs monitoring-terminal-errors A skill that watches a running process — dev server, test runner, build — for crashes and stack traces, then opens the failing file and fixes it. Handy when the log is long and the error is buried. CX Codex +1 449installs form-testing This skill fills and submits every form in your app three ways: empty, invalid, valid. Useful before a release. CX Codex +1 447installs suggesting-skills A skill that watches what you're doing and suggests installing another skill when one already covers the task. Useful when you don't know the set yet. CX Codex +1 445installs network-request-auditing Audits browser fetch and XHR calls after UI interactions to find errors, duplicate requests, and latency issues. Useful for API-heavy pages and backend changes. CX Codex +1 435installs dark-mode-testing Toggles light and dark mode in the browser, screenshots both states, and points out hardcoded colors, invisible text and contrast failures. CX Codex +1 436installs writing-copy A skill that gives the agent rules for marketing copy: headlines, CTAs, emails, interface microcopy. Useful when landing pages and UI text live in the same repo. CX Codex +1 435installs auto-type-checking Runs tsc --noEmit after each TypeScript edit and surfaces type errors right away instead of at build time. CX Codex +1 435installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor