4.8 KiB
4.8 KiB
Test Case Templates
55 ready-to-use, parametrizable Playwright test templates. Each includes TypeScript and JavaScript examples with {{placeholder}} markers for customization.
Usage
Templates are loaded by /pw:generate when it detects a matching scenario. You can also reference them directly:
/pw:generate "login flow" → loads templates/auth/login.md
Template Index
Authentication (8)
| Template | Tests |
|---|---|
| login.md | Email/password login, social login, remember me |
| logout.md | Logout from nav, session cleanup |
| sso.md | SSO redirect flow, callback handling |
| mfa.md | 2FA code entry, backup codes |
| password-reset.md | Request reset, enter new password, expired link |
| session-timeout.md | Auto-logout, session refresh |
| remember-me.md | Persistent login, cookie expiry |
| rbac.md | Role-based access, forbidden page |
CRUD Operations (6)
| Template | Tests |
|---|---|
| create.md | Create entity with form |
| read.md | View details, list view |
| update.md | Edit entity, inline edit |
| delete.md | Delete with confirmation |
| bulk-operations.md | Select multiple, bulk actions |
| soft-delete.md | Archive, restore |
Checkout (6)
| Template | Tests |
|---|---|
| add-to-cart.md | Add item, update cart |
| update-quantity.md | Increase, decrease, remove |
| apply-coupon.md | Valid/invalid/expired codes |
| payment.md | Card form, validation, processing |
| order-confirm.md | Success page, order details |
| order-history.md | List orders, pagination |
Search & Filter (5)
| Template | Tests |
|---|---|
| basic-search.md | Search input, results |
| filters.md | Category, price, checkboxes |
| sorting.md | Sort by name, date, price |
| pagination.md | Page nav, items per page |
| empty-state.md | No results, clear filters |
Forms (6)
| Template | Tests |
|---|---|
| single-step.md | Simple form submission |
| multi-step.md | Wizard with progress |
| validation.md | Required, format, inline errors |
| file-upload.md | Single, multiple, drag-drop |
| conditional-fields.md | Show/hide based on selection |
| autosave.md | Draft save, restore |
Dashboard (5)
| Template | Tests |
|---|---|
| data-loading.md | Loading state, skeleton, data |
| chart-rendering.md | Chart visible, tooltips |
| date-range-filter.md | Date picker, presets |
| export.md | CSV/PDF download |
| realtime-updates.md | Live data, websocket |
Settings (4)
| Template | Tests |
|---|---|
| profile-update.md | Name, email, avatar |
| password-change.md | Current + new password |
| notification-prefs.md | Toggle, save prefs |
| account-delete.md | Confirm deletion |
Onboarding (4)
| Template | Tests |
|---|---|
| registration.md | Signup form, validation |
| email-verification.md | Verify link, resend |
| welcome-tour.md | Step tour, skip |
| first-time-setup.md | Initial config |
Notifications (3)
| Template | Tests |
|---|---|
| in-app.md | Badge, dropdown, mark read |
| toast-messages.md | Success/error toasts |
| notification-center.md | List, filter, clear |
API Testing (5)
| Template | Tests |
|---|---|
| rest-crud.md | GET/POST/PUT/DELETE |
| graphql.md | Query, mutation |
| auth-headers.md | Token, expired, refresh |
| error-responses.md | 400-500 status handling |
| rate-limiting.md | Rate limit, retry-after |
Accessibility (3)
| Template | Tests |
|---|---|
| keyboard-navigation.md | Tab order, focus |
| screen-reader.md | ARIA labels, live regions |
| color-contrast.md | Contrast ratios |