一键导入
playwright
Write, run, and maintain reliable end-to-end tests with Playwright. Use for test generation, CI integration, trace debugging, and cross-browser validation.
菜单
Write, run, and maintain reliable end-to-end tests with Playwright. Use for test generation, CI integration, trace debugging, and cross-browser validation.
Daily research agent for
Weekly research agent for
Daily research agent for
Build, run, and secure Docker containers with current best practices. Use for Dockerfile review, multi-stage builds, Compose orchestration, image hardening, and CI/CD integration.
Operate GitHub repositories, workflows, and PRs efficiently. Use for Actions optimization, PR hygiene, repo maintenance, and team collaboration patterns.
Deploy, manage, and troubleshoot Kubernetes workloads. Use for manifest review, Helm chart validation, resource tuning, RBAC, and cluster operations.
| name | playwright |
| description | Write, run, and maintain reliable end-to-end tests with Playwright. Use for test generation, CI integration, trace debugging, and cross-browser validation. |
| disable-model-invocation | true |
npx playwright --version
Check Playwright releases for the latest version.
getByRole, getByText, getByLabel over CSS selectors.getByRole, getByLabel, getByText)waitForTimeout — uses explicit waits (waitForSelector, waitForResponse)test.describe grouping# Generate test from user interactions
npx playwright codegen http://localhost:3000
# Run with UI mode for debugging
npx playwright test --ui
# Run with trace viewer
npx playwright test --trace on
npx playwright show-trace test-results/trace.zip
# .github/workflows/playwright.yml
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npx playwright install --with-deps
- run: npx playwright test
- uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report
path: playwright-report/
| Anti-Pattern | Why It's Wrong | Fix |
|---|---|---|
page.click('.btn-primary') | Brittle, no semantic meaning | page.getByRole('button', { name: 'Submit' }).click() |
page.waitForTimeout(1000) | Flaky, slow | page.waitForResponse('**/api/data') |
| Shared test account | State leaks between tests | Isolate data per test |
| No retries in CI | Network flakes cause failures | retries: 2 in CI |
| Screenshots on every run | Wastes storage | screenshot: 'only-on-failure' |
| Hardcoded URLs | Environment-specific breakage | Use baseURL config |
| No visual regression | UI changes break layout | Add expect(page).toHaveScreenshot() |
playwright.config.ts has fullyParallel: trueretries configured for CI (2 for CI, 0 for local)projects cover required browsers (Chromium minimum, +WebKit for Safari)trace: 'on-first-retry'globalSetup handles test data seeding if neededtestResultsDir is in .gitignore