Writing end-to-end tests is challenging. This skill provides battle-tested patterns for Playwright and Cypress to create stable, maintainable tests that catch bugs before users do.
下載技能 ZIP
在 Claude 中上傳
前往 設定 → 功能 → 技能 → 上傳技能
開啟並開始使用
測試它
正在使用「e2e-testing-patterns」。 Create a login test with Playwright
預期結果:
- Step 1: Create LoginPage class with locators for email, password, and submit button
- Step 2: Implement goto() and login(email, password) methods
- Step 3: Write test using page object with assertions for URL and success message
- Step 4: Add error handling test for invalid credentials
正在使用「e2e-testing-patterns」。 How do I debug a flaky test?
預期結果:
- 1. Replace fixed waitForTimeout with explicit waits
- 2. Use trace viewer: npx playwright test --trace on
- 3. Add screenshots on failure
- 4. Check for race conditions in async operations
- 5. Isolate test data to prevent cross-test pollution
安全審計
安全All 63 static findings are false positives. The analyzer incorrectly interprets markdown code fences as Ruby shell commands, JavaScript operators as cryptographic issues, and test configuration as system reconnaissance. This is a documentation skill with educational content about E2E testing patterns using Playwright and Cypress. No actual security risks exist.
風險因素
⚙️ 外部命令 (32)
🌐 網路存取 (4)
🔑 環境變數 (8)
品質評分
你能建構什麼
Set Up E2E Tests for New Project
Configure Playwright or Cypress from scratch with proper structure, reporters, and CI integration
Fix Flaky Tests
Replace brittle selectors and fixed timeouts with proper waiting strategies and stable locators
Scale Test Execution
Implement parallel execution and test sharding to reduce CI pipeline time from hours to minutes
試試這些提示
Create an end-to-end test for a login page using Playwright. Include proper selectors, assertions, and error handling for both successful and failed login attempts.
Show how to mock an API response in Cypress to test error handling without relying on a real backend service.
Configure Playwright to run tests in CI with parallel execution, retry logic, and HTML report generation.
Implement accessibility testing using axe-core to ensure the application meets WCAG guidelines.
最佳實務
- Use data-testid or semantic roles instead of CSS selectors for stable locators
- Keep tests independent with proper setup and teardown of test data
- Run tests in parallel in CI to reduce execution time
避免
- Using fixed timeouts like waitForTimeout(3000) - causes flakiness
- Testing implementation details instead of user-visible behavior
- Sharing state between tests - leads to cascade failures