test-ui
npx skills add https://github.com/ajaywadhara/agentic-sdlc-plugin --skill test-ui
Agent 安装分布
Skill 文档
Arguments: $FEATURE (or “all” to test entire app)
Read CLAUDE.md before doing anything else. Read docs/PRD.md for acceptance criteria. Read docs/SCREENS.md for the full screen inventory. If wireframes/ exists, read wireframes/INDEX.html for expected layouts.
PREREQUISITE CHECK:
- Confirm the dev server is running (if not, start it)
- Confirm Playwright MCP is available (browser_navigate tool exists)
- If $FEATURE is specified, identify every screen and flow for that feature
- If “all”, use docs/SCREENS.md as the full checklist
ââââââââââââââââââââââââââââââââââââââââââââââââââââ PHASE 1 â SCREEN-BY-SCREEN VISUAL WALKTHROUGH ââââââââââââââââââââââââââââââââââââââââââââââââââââ
For EVERY screen listed in docs/SCREENS.md (or the feature subset):
- browser_navigate to the screen’s URL
- browser_take_screenshot â save as qa/browser-tests/$FEATURE/[screen]-initial.png
- browser_snapshot â capture the accessibility tree
- VERIFY against the wireframe or PRD:
- Are all expected elements present? (buttons, inputs, links, text)
- Is the layout correct? (sidebar on left, header at top, etc.)
- Are labels and text content correct?
- Is the navigation functional? (links go where they should)
- Log findings to qa/browser-tests/$FEATURE/walkthrough.md: | Screen | URL | Status | Missing Elements | Layout Issues | Notes |
DO NOT SKIP SCREENS. Every screen in the inventory must be visited.
ââââââââââââââââââââââââââââââââââââââââââââââââââââ PHASE 2 â INTERACTION TESTING (every clickable element) ââââââââââââââââââââââââââââââââââââââââââââââââââââ
For EVERY screen, systematically test every interactive element:
BUTTONS: – browser_click every button on the page – Verify: correct action happens (navigation, modal, form submit, state change) – Verify: button is visible, has accessible name, is not disabled unexpectedly
FORMS: – browser_type into every input field – Test valid data â verify success state – Test empty submission â verify validation messages appear – Test invalid data (wrong format, too long, special characters) â verify error handling – Test form reset / cancel
NAVIGATION: – browser_click every link – Verify: correct destination screen loads – browser_navigate_back â verify you return to the previous screen – browser_navigate_forward â verify forward works
DROPDOWNS / SELECT: – browser_select_option for each dropdown – Verify: correct option selected, dependent UI updates
MODALS / OVERLAYS: – Trigger every modal (click the button that opens it) – Verify: modal appears with correct content – browser_press_key Escape â verify modal closes – Click outside modal â verify it closes (if designed to) – Test modal form submission
KEYBOARD NAVIGATION: – browser_press_key Tab through the entire page – Verify: focus order is logical (top to bottom, left to right) – Verify: all interactive elements receive focus – browser_press_key Enter on focused buttons â verify they activate – browser_press_key Space on checkboxes â verify they toggle
Log every interaction result to qa/browser-tests/$FEATURE/interactions.md: | Element | Action | Expected Result | Actual Result | Pass/Fail |
ââââââââââââââââââââââââââââââââââââââââââââââââââââ PHASE 3 â HAPPY PATH END-TO-END FLOWS ââââââââââââââââââââââââââââââââââââââââââââââââââââ
Read the P0 Happy Path from docs/PRD.md. For EACH Given/When/Then:
- Navigate to the starting point
- Execute the exact user journey described:
- browser_type to fill forms
- browser_click to submit / navigate
- browser_wait_for expected outcomes
- browser_take_screenshot at each step
- Verify the “Then” condition is met:
- browser_verify_text_visible for expected messages
- browser_verify_element_visible for expected UI changes
- browser_snapshot to confirm state changes in the a11y tree
- Save screenshots as flow sequence: qa/browser-tests/$FEATURE/flow-[name]-step-[N].png
ALSO TEST THESE VARIANTS OF EACH HAPPY PATH:
- What happens if the user refreshes mid-flow?
- What happens if the user navigates away and comes back?
- What happens with the minimum valid input?
- What happens with the maximum valid input?
ââââââââââââââââââââââââââââââââââââââââââââââââââââ PHASE 4 â EMPTY STATES & ERROR STATES ââââââââââââââââââââââââââââââââââââââââââââââââââââ
EMPTY STATES (for every screen that displays a list or data):
- Navigate to the screen with no data (new user or cleared state)
- browser_take_screenshot
- Verify: helpful empty state message is shown (not a blank page or error)
- Verify: there is a clear call-to-action to add first item
- browser_click the CTA â verify it works
ERROR STATES:
- Network error: Use browser_evaluate to intercept fetch and simulate offline
window.__originalFetch = window.fetch; window.fetch = () => Promise.reject(new Error('Network error')); - Trigger an action that requires network â verify graceful error message
- Restore network:
window.fetch = window.__originalFetch; - Server error: Use browser_evaluate to mock 500 responses
- Auth error: Navigate to a protected route without auth â verify redirect to login
browser_take_screenshot for every error state. Verify: no raw error messages, stack traces, or blank screens shown to user.
ââââââââââââââââââââââââââââââââââââââââââââââââââââ PHASE 5 â RESPONSIVE TESTING (3 viewports) ââââââââââââââââââââââââââââââââââââââââââââââââââââ
For the 3 most important screens (identified from PRD P0 features):
DESKTOP (1440 Ã 900): browser_resize width=1440 height=900 Navigate to each screen browser_take_screenshot â qa/browser-tests/$FEATURE/responsive/[screen]-desktop.png browser_snapshot â verify all elements visible Verify: layout uses full width appropriately
TABLET (768 à 1024): browser_resize width=768 height=1024 Navigate to each screen browser_take_screenshot â qa/browser-tests/$FEATURE/responsive/[screen]-tablet.png browser_snapshot â verify all elements still accessible Verify: navigation adapts (hamburger menu if applicable) Verify: no horizontal scrollbar Verify: text is readable, buttons are tappable size (â¥44px)
MOBILE (375 à 812): browser_resize width=375 height=812 Navigate to each screen browser_take_screenshot â qa/browser-tests/$FEATURE/responsive/[screen]-mobile.png browser_snapshot â verify all elements still accessible Verify: no content cut off or overlapping Verify: forms are usable (inputs full-width, keyboard doesn’t obscure) Verify: touch targets are â¥44px Test the happy path on mobile â complete the main flow at this viewport
ALSO CHECK: – Landscape mobile (812 Ã 375): browser_resize and screenshot – Very narrow (320px): browser_resize width=320 and check nothing breaks
ââââââââââââââââââââââââââââââââââââââââââââââââââââ PHASE 6 â ACCESSIBILITY AUDIT ââââââââââââââââââââââââââââââââââââââââââââââââââââ
For EVERY screen:
-
browser_snapshot â capture the full accessibility tree
-
Analyze the tree for:
- Every image must have alt text (or role=”presentation” if decorative)
- Every form input must have an associated label
- Every button must have an accessible name
- Heading hierarchy must be logical (h1 â h2 â h3, no skipping)
- Color contrast: if design tokens exist, verify text/background ratios
- ARIA roles are used correctly (not aria-label on divs that should be buttons)
- Focus indicators are visible (Tab through and verify)
-
Log accessibility findings to qa/browser-tests/$FEATURE/accessibility.md: | Screen | Issue | Severity | Element | Recommendation |
Severity levels: CRITICAL â screen reader users cannot complete the task MAJOR â significantly degraded experience for assistive tech users MINOR â best practice violation, not blocking
ââââââââââââââââââââââââââââââââââââââââââââââââââââ PHASE 7 â CONSOLE & NETWORK HEALTH CHECK ââââââââââââââââââââââââââââââââââââââââââââââââââââ
While on each screen during testing:
browser_console_messages â check for: – Any JavaScript errors (red) â log as bugs – Any unhandled promise rejections â log as bugs – Deprecation warnings â log as technical debt – Any sensitive data logged to console â log as security issue
browser_network_requests â check for: – Any failed requests (4xx, 5xx) â log as bugs – Any requests to unexpected domains â log as security concern – Any excessively large responses (>1MB for API calls) â log as performance issue – Any requests without proper auth headers when auth is required
Save to: qa/browser-tests/$FEATURE/health.md
ââââââââââââââââââââââââââââââââââââââââââââââââââââ PHASE 8 â AUTO-GENERATE PLAYWRIGHT TEST FILES ââââââââââââââââââââââââââââââââââââââââââââââââââââ
THIS IS THE KEY STEP. Convert every interaction you just tested into permanent, repeatable Playwright test files.
For each flow and interaction tested above:
-
Use browser_generate_playwright_test to create a .spec.ts file from the browser session
-
If the generated test needs refinement, manually write it using the selectors discovered via browser_snapshot and browser_generate_locator
-
Save generated tests to: tests/e2e/$FEATURE-ui.spec.ts â happy path + interaction tests tests/e2e/$FEATURE-responsive.spec.ts â responsive viewport tests tests/e2e/$FEATURE-a11y.spec.ts â accessibility assertions tests/e2e/$FEATURE-errors.spec.ts â error state tests
-
EVERY test must use semantic locators only: ALLOWED: getByRole(‘button’, { name: ‘Submit’ }) ALLOWED: getByLabel(‘Email’) ALLOWED: getByText(‘Welcome back’) ALLOWED: getByTestId(‘transaction-list’) FORBIDDEN: page.$(‘.class-name’) FORBIDDEN: page.$(‘#id’) FORBIDDEN: page.$x(‘//xpath’)
-
Run every generated test: npx playwright test tests/e2e/$FEATURE-ui.spec.ts npx playwright test tests/e2e/$FEATURE-responsive.spec.ts npx playwright test tests/e2e/$FEATURE-a11y.spec.ts npx playwright test tests/e2e/$FEATURE-errors.spec.ts
-
Fix any failing tests â the test should pass since you just verified the behavior interactively. If it fails:
- Selector issue â use browser_generate_locator to find stable selector
- Timing issue â add proper await and toBeVisible() waits
- Real bug â log to qa/bugs/
-
Run the FULL test suite to confirm nothing else broke: npx playwright test
ââââââââââââââââââââââââââââââââââââââââââââââââââââ PHASE 9 â COVERAGE REPORT ââââââââââââââââââââââââââââââââââââââââââââââââââââ
Generate qa/browser-tests/$FEATURE/REPORT.md:
UI Test Report: $FEATURE
Generated: [date]
Summary
| Metric | Count | Pass | Fail |
|---|---|---|---|
| Screens tested | |||
| Interactive elements | |||
| Happy path flows | |||
| Empty states | |||
| Error states | |||
| Responsive viewports | |||
| Accessibility issues | |||
| Console errors found | |||
| Tests generated | |||
| Tests passing |
Generated Test Files
- tests/e2e/$FEATURE-ui.spec.ts ([N] tests)
- tests/e2e/$FEATURE-responsive.spec.ts ([N] tests)
- tests/e2e/$FEATURE-a11y.spec.ts ([N] tests)
- tests/e2e/$FEATURE-errors.spec.ts ([N] tests)
Issues Found
[List every bug, accessibility issue, or UI problem discovered]
Screenshots
[Reference all screenshots taken during testing]
Coverage Assessment
- Screens with 100% element coverage: [list]
- Screens with gaps: [list with what’s missing]
- Flows fully tested: [list]
- Flows partially tested: [list with what’s missing]
âââ FINAL OUTPUT âââ
If all tests pass: “UI testing complete for $FEATURE. [N] screens tested, [N] interactions verified, [N] test files generated. All [N] generated Playwright tests passing. Report: qa/browser-tests/$FEATURE/REPORT.md Next: run /qa-run $FEATURE for the full QA loop.”
If issues found: “UI testing complete for $FEATURE. Found [N] bugs, [N] accessibility issues, [N] console errors. [N] tests generated, [N] passing, [N] failing. Report: qa/browser-tests/$FEATURE/REPORT.md Fix issues first, then run /qa-run $FEATURE.”