Overview
The webapp-testing skill provides comprehensive guidance on testing web applications, with emphasis on end-to-end testing, Playwright automation, and systematic discovery of all application routes and features.What This Skill Provides
- Deep Audit Approach: Systematically discover and test all routes
- E2E Testing Principles: Critical user flow testing
- Playwright Expertise: Browser automation and best practices
- Visual Testing: Screenshot comparison strategies
- API Testing: Backend endpoint validation
- CI Integration: Pipeline setup for automated testing
- Automated Scripts: Browser testing with Python/Playwright
Key Concepts
Deep Audit Approach
Discovery First:| Target | How to Find |
|---|---|
| Routes | Scan app/, pages/, router files |
| API endpoints | Grep for HTTP methods |
| Components | Find component directories |
| Features | Read documentation |
- Map - List all routes/APIs
- Scan - Verify they respond
- Test - Cover critical paths
Testing Pyramid for Web
Runtime Scripts
| Script | Purpose | Usage |
|---|---|---|
scripts/playwright_runner.py | Basic browser test | python scripts/playwright_runner.py https://example.com |
| With screenshot | python scripts/playwright_runner.py <url> --screenshot | |
| Accessibility check | python scripts/playwright_runner.py <url> --a11y |
pip install playwright && playwright install chromium
Use Cases
When to Use This Skill
- Testing web application user flows
- Automating browser-based tests
- Verifying all routes respond correctly
- Implementing E2E test suites
- Setting up CI/CD testing pipelines
- Visual regression testing
Example Scenarios
- Full Audit: “Test all routes in this Next.js application”
- Critical Flow: “Add E2E tests for the checkout process”
- Visual Testing: “Detect visual regressions in the UI”
- Accessibility: “Check WCAG compliance across all pages”
E2E Test Principles
What to Test
| Priority | Tests |
|---|---|
| 1 | Happy path user flows |
| 2 | Authentication flows |
| 3 | Critical business actions |
| 4 | Error handling |
Best Practices
| Practice | Why |
|---|---|
| Use data-testid | Stable selectors |
| Wait for elements | Avoid flaky tests |
| Clean state | Independent tests |
| Avoid implementation details | Test user behavior |
Playwright Principles
Core Concepts
| Concept | Use |
|---|---|
| Page Object Model | Encapsulate page logic |
| Fixtures | Reusable test setup |
| Assertions | Built-in auto-wait |
| Trace Viewer | Debug failures |
Configuration
| Setting | Recommendation |
|---|---|
| Retries | 2 on CI |
| Trace | on-first-retry |
| Screenshots | on-failure |
| Video | retain-on-failure |
Visual Testing
When to Use
| Scenario | Value |
|---|---|
| Design system | High |
| Marketing pages | High |
| Component library | Medium |
| Dynamic content | Lower |
Strategy
- Baseline screenshots
- Compare on changes
- Review visual diffs
- Update intentional changes
API Testing Principles
Coverage Areas
| Area | Tests |
|---|---|
| Status codes | 200, 400, 404, 500 |
| Response shape | Matches schema |
| Error messages | User-friendly |
| Edge cases | Empty, large, special chars |
Test Organization
File Structure
Naming Convention
| Pattern | Example |
|---|---|
| Feature-based | login.spec.ts |
| Descriptive | user-can-checkout.spec.ts |
CI Integration
Pipeline Steps
- Install dependencies
- Install browsers
- Run tests
- Upload artifacts (traces, screenshots)
Parallelization
| Strategy | Use |
|---|---|
| Per file | Playwright default |
| Sharding | Large suites |
| Workers | Multiple browsers |
Anti-Patterns to Avoid
| ❌ Don’t | ✅ Do |
|---|---|
| Test implementation | Test behavior |
| Hardcode waits | Use auto-wait |
| Skip cleanup | Isolate tests |
| Ignore flaky tests | Fix root cause |
Related Skills
- testing-patterns: General testing principles
- tdd-workflow: Test-first development
- web-design-guidelines: UI/UX testing standards
- clean-code: Test code quality
Which Agents Use This Skill
- test-engineer: Primary user for E2E testing
- qa-automation-engineer: Automated test development
Example Test
Tools Available
- Read, Write, Edit: For test files
- Glob, Grep: For discovering routes and components
- Bash: For running Playwright commands
Remember: E2E tests are expensive. Use them for critical paths only. Discover and test everything, but prioritize wisely.
