本文へ移動
cccskills
無料GitHub で公開

adding-e2e-tests

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

インストール方法を見る

含まれるファイル(1)

  • SKILL.md2.0 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Use Cursor's browser aria snapshots to audit a page for accessibility issues — missing labels, broken tab order, contrast, and ARIA misuse.

日本語の概要は準備中です。原文の説明を表示しています。

0xAidan/polymarket-bot-test42026年9月4日 更新

Add PostHog analytics to a web application, including event tracking, page views, feature flags, and session replay.

日本語の概要は準備中です。原文の説明を表示しています。

0xAidan/polymarket-bot-test42026年9月4日 更新

Generate OpenAPI/Swagger documentation for an API, including endpoint schemas, request/response types, and interactive docs UI.

日本語の概要は準備中です。原文の説明を表示しています。

0xAidan/polymarket-bot-test42026年9月4日 更新

Add authentication to a web application using NextAuth.js (Auth.js), including OAuth providers, session management, and protected routes.

日本語の概要は準備中です。原文の説明を表示しています。

0xAidan/polymarket-bot-test42026年9月4日 更新

Dockerize an application with a production-ready Dockerfile, docker-compose setup, and .dockerignore.

日本語の概要は準備中です。原文の説明を表示しています。

0xAidan/polymarket-bot-test42026年9月4日 更新

Add Sentry error tracking, performance monitoring, and source maps to a web application.

日本語の概要は準備中です。原文の説明を表示しています。

0xAidan/polymarket-bot-test42026年9月4日 更新

0xAidan のスキルをすべて見る

このスキルの問題を報告する