一键导入
e2e
Generate and run end-to-end tests with Playwright. Creates test journeys, runs tests, captures screenshots/videos/traces, and uploads artifacts.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate and run end-to-end tests with Playwright. Creates test journeys, runs tests, captures screenshots/videos/traces, and uploads artifacts.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | e2e |
| description | Generate and run end-to-end tests with Playwright. Creates test journeys, runs tests, captures screenshots/videos/traces, and uploads artifacts. |
This command invokes the e2e-runner agent to generate, maintain, and execute end-to-end tests using Playwright.
Use /e2e when:
The e2e-runner agent will:
User: /e2e Test the product search and view flow
Agent (e2e-runner):
# E2E Test Generation: Product Search and View Flow
## Test Scenario Identified
**User Journey:** Product Search -> View Results -> Click Product -> View Details
**Test Coverage:**
1. Navigate to products page
2. Perform search
3. Verify search results
4. Click on first result
5. Verify product details page loads
6. Verify content renders
## Generated Test Code
```typescript
// tests/e2e/products/search-and-view.spec.ts
import { test, expect } from '@playwright/test'
import { ProductsPage } from '../../pages/ProductsPage'
import { ProductDetailsPage } from '../../pages/ProductDetailsPage'
test.describe('Product Search and View Flow', () => {
test('user can search products and view details', async ({ page }) => {
const productsPage = new ProductsPage(page)
await productsPage.goto()
await expect(page).toHaveTitle(/Products/)
await productsPage.searchProducts('electronics')
await page.waitForResponse(resp =>
resp.url().includes('/api/products/search') && resp.status() === 200
)
const productCards = productsPage.productCards
await expect(productCards.first()).toBeVisible()
const firstProductTitle = await productCards.first().textContent()
await productCards.first().click()
await expect(page).toHaveURL(/\/products\/[a-z0-9-]+/)
const detailsPage = new ProductDetailsPage(page)
await expect(detailsPage.productName).toBeVisible()
await expect(detailsPage.contentSection).toBeVisible()
})
})
## Test Artifacts
When tests run, the following artifacts are captured:
**On All Tests:**
- HTML Report with timeline and results
- JUnit XML for CI integration
**On Failure Only:**
- Screenshot of the failing state
- Video recording of the test
- Trace file for debugging (step-by-step replay)
- Network logs
- Console logs
## Viewing Artifacts
```bash
# View HTML report in browser
npx playwright show-report
# View specific trace file
npx playwright show-trace artifacts/trace-abc123.zip
# Screenshots are saved in artifacts/ directory
open artifacts/search-results.png
If a test fails intermittently:
FLAKY TEST DETECTED: tests/e2e/products/checkout.spec.ts
Test passed 7/10 runs (70% pass rate)
Common failure:
"Timeout waiting for element '[data-testid="confirm-btn"]'"
Recommended fixes:
1. Add explicit wait: await page.waitForSelector('[data-testid="confirm-btn"]')
2. Increase timeout: { timeout: 10000 }
3. Check for race conditions in component
4. Verify element is not hidden by animation
Quarantine recommendation: Mark as test.fixme() until fixed
Tests run on multiple browsers by default:
Configure in playwright.config.ts to adjust browsers.
Add to your CI pipeline:
# .github/workflows/e2e.yml
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run E2E tests
run: npx playwright test
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: playwright-report/
DO:
DON'T:
/plan to identify critical journeys to test/tdd for unit tests (faster, more granular)/e2e for integration and user journey tests/code-review to verify test qualityThis command invokes the e2e-runner agent located at:
~/.claude/agents/e2e-runner.md
# Run all E2E tests
npx playwright test
# Run specific test file
npx playwright test tests/e2e/products/search.spec.ts
# Run in headed mode (see browser)
npx playwright test --headed
# Debug test
npx playwright test --debug
# Generate test code
npx playwright codegen http://localhost:3000
# View report
npx playwright show-report
Scan project, then generate or reconcile .primeignore patterns for smarter /prime loading
Run WCAG accessibility audits on frontend projects. Checks HTML semantics, ARIA usage, color contrast, and keyboard navigation patterns.
Generate OpenAPI specs from code, validate API contracts, and check for breaking changes between versions.
Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.
Incrementally fix TypeScript and build errors one at a time with verification. Invokes the build-error-resolver agent.
Create or verify a checkpoint in your workflow