Chuyển đến nội dung
Skillpedia
Kiểm thử33k · #8787

playwright-e2e-builder

Skill này làm gì

Skill này giúp AI của bạn xây dựng các bộ kiểm thử trình duyệt với Playwright. Nó dành cho lập trình viên muốn có kiểm thử tự động cho các luồng người dùng quan trọng như đăng ký hoặc thanh toán.

Khi nào nên dùng

  • ✓Khi bạn muốn cài đặt Playwright từ đầu trong một dự án có sẵn.
  • ✓Khi bạn cần kiểm thử end-to-end cho các luồng quan trọng như đăng ký hoặc thanh toán.
  • ✓Khi bạn muốn các kiểm thử Playwright chạy trong CI với sharding và thử lại.

Liên kết skill

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/playwright-e2e-builder/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/playwright-e2e-builder/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Hãy thiết lập kiểm thử Playwright cho luồng đăng ký và thanh toán của tôi, rồi chạy chúng trong GitHub Actions.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent trước tiên khám phá framework, các route và luồng đăng nhập của dự án, và đặt câu hỏi để lên kế hoạch. Sau đó nó xây dựng kiểm thử theo mẫu page object và trạng thái xác thực đã lưu.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Playwright E2E Test Suite Builder

When to use

Use this skill when you need to:

  • Set up Playwright from scratch in an existing project
  • Build E2E tests for critical user flows (signup, checkout, dashboards)
  • Implement Page Object Model for maintainable test architecture
  • Configure authentication state persistence across tests
  • Set up visual regression testing with screenshots
  • Integrate Playwright into CI/CD with sharding and retries

Phase 1: Explore (Plan Mode)

Enter plan mode. Before writing any tests, explore the existing project:

Project structure

  • Find the tech stack: is this React, Next.js, Vue, SvelteKit, or another framework?
  • Check if Playwright is already installed (playwright.config.ts, @playwright/test in package.json)
  • Look for existing test directories (e2e/, tests/, __tests__/)
  • Check for existing E2E tests in Cypress, Selenium, or other frameworks (migration context)
  • Find the dev server command and port (npm run dev, next dev, etc.)

Application structure

  • Identify the main routes/pages (look at router config, pages directory, or route files)
  • Find authentication flow (login page URL, auth API endpoints, token storage)
  • Check for test IDs in components (data-testid, data-test, data-cy attributes)
  • Look for API routes that tests might need to seed data through
  • Check .env files for test-specific environment variables

CI/CD

  • Check for existing CI config (.github/workflows/, .gitlab-ci.yml, Jenkinsfile)
  • Look for Docker or docker-compose setup (useful for consistent test environments)
  • Check if there's a staging/preview environment URL pattern

Phase 2: Interview (AskUserQuestion)

Use AskUserQuestion to clarify requirements. Ask in rounds.

Round 1: Scope and critical flows

Question: "What are the critical user flows to test?"
Header: "Flows"
multiSelect: true
Options:
  - "Authentication (signup, login, logout, password reset)" — Core auth flows
  - "Core CRUD (create, read, update, delete main resources)" — Primary data operations
  - "Checkout/payments (cart, billing, confirmation)" — E-commerce or payment flows
  - "Dashboard/admin (data views, filters, exports)" — Admin panel interactions
Question: "How many pages/routes does the application have approximately?"
Header: "App size"
Options:
  - "Small (< 10 routes)" — Landing page, auth, a few feature pages
  - "Medium (10-30 routes)" — Multiple feature areas, settings, profiles
  - "Large (30+ routes)" — Complex app with many sections and user roles

Round 2: Authentication strategy for tests

Question: "How does your app handle authentication?"
Header: "Auth type"
Options:
  - "Cookie/session based (Recommended)" — Server sets httpOnly cookies after login
  - "JWT in localStorage" — Token stored in browser localStorage
  - "OAuth/SSO (Google, GitHub, etc.)" — Third-party auth provider redirect flow
  - "No auth (public app)" — No login required

Question: "How should tests authenticate?"
Header: "Test auth"
Options:
  - "Login via UI once, reuse state (Recommended)" — storageState pattern: login in setup, share cookies across tests
  - "API login in beforeEach" — Call auth API directly before each test, skip UI login
  - "Seed auth token in fixtures" — Inject pre-generated tokens, no login flow needed
  - "Test login UI every time" — Actually test the login form in each test suite

Round 3: Test data and environment

Question: "How should test data be managed?"
Header: "Test data"
Options:
  - "API seeding in fixtures (Recommended)" — Call API endpoints to create/clean test data before each test
  - "Database seeding (direct SQL)" — Run SQL scripts or ORM commands to populate test database
  - "Shared test environment (pre-populated)" — Tests run against a persistent staging environment with existing data
  - "Mock API responses" — Intercept network requests and return mock data

Question: "What environment do E2E tests run against?"
Header: "Environment"
Options:
  - "Local dev server (Recommended)" — Start dev server before tests, run against localhost
  - "Preview/staging URL" — Run against a deployed preview or staging environment
  - "Docker Compose stack" — Full stack in containers, tests run outside or inside

Round 4: CI and parallelization

Question: "How should tests run in CI?"
Header: "CI"
Options:
  - "GitHub Actions (Recommended)" — Native Playwright support with sharding
  - "GitLab CI" — Docker-based ru
Câu hỏi thường gặp

Nó có viết kiểm thử ngay không?

Không. Nó khám phá dự án và lên kế hoạch trước, đặt câu hỏi trước khi viết kiểm thử.

Nó có kiểm thử trực quan không?

Có. Nó có thể thiết lập kiểm thử hồi quy trực quan bằng ảnh chụp màn hình.

Nó có chạy kiểm thử song song không?

Có. Kế hoạch bao gồm song song hóa và sharding trong CI.

Chi tiết

Mô tả gốc của tác giả

Plan and build comprehensive Playwright E2E test suites with Page Object Model, authentication state persistence, custom fixtures, visual regression, and CI integration. Uses interview-driven planning to clarify critical user flows, auth strategy, test data approach, and parallelization before writing any tests.

repo: davila7/claude-code-templates

Độ phổ biến

Sao GitHub
33k
Vị trí xếp hạng
#8787
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự