Skip to content
Back to skills

Adding E2e Tests

ASecurity

Set up Playwright end-to-end testing in a project, including test configuration, example tests, and CI integration.

  • 4 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 10, 2026
testinggobashtestinggit

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned September 10, 2026

npx -y skills add 0xAidan/polymarket-bot-test --skill adding-e2e-tests --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Adding E2e Tests?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Adding E2e Tests
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/0xaidan-adding-e2e-tests/badge)](https://www.skillsdirectory.com/skills/0xaidan-adding-e2e-tests)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…