Cursor Skill

adding-e2e-tests

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

LLM Mart · 0 points · 24 views 0 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download spencerpauly-awesome-cursor-skills-resources_adding-e2e-tests-99cd265.zip · 1 KB
Part of spencerpauly/awesome-cursor-skills — 65 skills

Install

skills CLI npx skills add https://github.com/spencerpauly/awesome-cursor-skills/tree/main/resources/adding-e2e-tests
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install spencerpauly-awesome-cursor-skills@llmmart
Git git clone https://github.com/spencerpauly/awesome-cursor-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole spencerpauly/awesome-cursor-skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

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

    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:

    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:

      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:

    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

    {
      "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.
Files (awesome-cursor-skills)
  • SKILL.md 2 KB
    ---
    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.
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related