This skill should be used when the user asks for "browser tests", "playwright tests", "end-to-end testing", "test user flows", "E2E coverage", "integration tests for UI", "page object pattern", "/e2e command", or discusses automated browser testing. Covers the E2E test loop workflow, Playwright patterns, page objects, and selector strategies.
View on GitHubSomtoUgeh/somto-dev-toolkit
somto-dev-toolkit
skills/e2e-test-loop/SKILL.md
January 24, 2026
Select agents to install to:
npx add-skill https://github.com/SomtoUgeh/somto-dev-toolkit/blob/main/skills/e2e-test-loop/SKILL.md -a claude-code --skill e2e-test-loopInstallation paths:
.claude/skills/e2e-test-loop/# E2E Test Loop - Browser Automation Testing
**Current branch:** !`git branch --show-current 2>/dev/null || echo "not in git repo"`
The E2E test loop systematically adds end-to-end tests for user flows using
Playwright, with page objects for maintainable test code.
## State Management
**Single Source of Truth**: `.claude/e2e-state-{session}.json` stores all state including
the embedded progress log. No separate progress.txt file.
**What Hook Updates:**
- Appends to state.json's `log` array automatically
- Iteration markers are optional (hook auto-detects from git)
## When to Use E2E Test Loop
- Need to test critical user flows
- Adding browser automation tests
- Ensuring features work end-to-end
- Integration testing across components
## Starting the Loop
```bash
/e2e "Cover checkout flow" # Basic
/e2e "Test auth" --max-iterations 5 # Limited
/e2e "Add E2E" --test-command "npx playwright test" # Custom command
```
## Iteration Workflow
Each iteration follows this sequence:
1. **Identify flow** - Find user flow lacking E2E coverage
2. **Create page object** - `*.e2e.page.ts` for reusable locators/actions
3. **Write ONE test** - `*.e2e.ts` using page objects
4. **Run linters** - Ensure code quality
5. **Verify passing** - Run the E2E test
6. **Run reviewers** - code-simplifier + kieran reviewer (MANDATORY)
7. **Commit** - `test(e2e): describe user flow`
## File Naming Convention
```
e2e/
├── checkout.e2e.page.ts # Page object (locators, setup, actions)
├── checkout.e2e.ts # Test file (concise tests)
├── auth.e2e.page.ts
└── auth.e2e.ts
```
## Playwright Patterns
### Locator Priority (Semantic First)
| Priority | Locator | Example |
|----------|---------|---------|
| 1 | `getByRole` | `page.getByRole('button', { name: 'Submit' })` |
| 2 | `getByLabel` | `page.getByLabel('Email address')` |
| 3 | `getByText` | `page.getByText('Welcome back')` |
| 4 | `getByTestId` | `page.getByTestId('submit-btn')`