Skip to content

Latest commit

 

History

History
193 lines (150 loc) · 5.19 KB

File metadata and controls

193 lines (150 loc) · 5.19 KB

Test Patterns Reference

Common test patterns organized by category. Use these as starting points when building test plans.

Authentication

Login (Happy Path)

  1. Navigate to login page
  2. Fill username/email
  3. Fill password
  4. Click submit
  5. Assert: URL changes to dashboard/home, welcome message visible, login form gone

Login (Invalid Credentials)

  1. Navigate to login page
  2. Fill wrong credentials
  3. Click submit
  4. Assert: Error message visible, URL stays on login page, form fields still present

Login (Empty Submission)

  1. Navigate to login page
  2. Click submit without filling fields
  3. Assert: Validation errors shown for required fields

Logout

  1. Start from authenticated state
  2. Find and click logout
  3. Assert: Redirected to login/home, protected routes inaccessible

Session Persistence

  1. Login successfully
  2. Reload the page
  3. Assert: Still authenticated, not redirected to login

Navigation

Top-Level Links

  1. Take snapshot of navigation
  2. Click each nav link
  3. Assert: Correct page loads, URL matches, active state on nav item

Back Button

  1. Navigate page A → page B
  2. Press browser back
  3. Assert: Returns to page A with correct state

404 Handling

  1. Navigate to non-existent URL path
  2. Assert: 404 page shown (not blank page or server error), navigation still works

Deep Linking

  1. Navigate directly to a deep URL (e.g., /settings/notifications)
  2. Assert: Page loads correctly, not redirected to home

Forms

Required Fields

  1. Submit form with all fields empty
  2. Assert: Validation errors for each required field, form not submitted

Valid Submission

  1. Fill all fields with valid data
  2. Submit
  3. Assert: Success message/redirect, data persisted (reload and verify)

Field Validation

For each field, test boundary conditions:

  • Too short / too long input
  • Invalid format (email without @, phone with letters)
  • Special characters
  • Leading/trailing whitespace

Auto-save / Draft

  1. Fill some fields, don't submit
  2. Navigate away, come back
  3. Assert: Data preserved or explicitly cleared with warning

File Upload

  1. Find upload input
  2. Upload a file: agent-browser upload @eN /path/to/file
  3. Assert: File name shown, preview if applicable, submit works

CRUD Operations

Create

  1. Navigate to create form/page
  2. Fill required fields
  3. Submit
  4. Assert: New item appears in list, success feedback shown

Read

  1. Navigate to list view
  2. Click an item
  3. Assert: Detail view shows correct data matching list entry

Update

  1. Open existing item for editing
  2. Change a field
  3. Save
  4. Assert: Updated value persists after reload

Delete

  1. Find delete action for an item
  2. Confirm deletion (check for confirmation dialog)
  3. Assert: Item removed from list, appropriate feedback shown

Delete Confirmation

  1. Click delete
  2. Cancel/dismiss the confirmation
  3. Assert: Item still exists, not deleted

Error Handling

Network Error Simulation

  1. Set offline mode: agent-browser set offline on
  2. Attempt an action that requires network
  3. Assert: Graceful error message, no crash
  4. Restore: agent-browser set offline off

Console Errors

  1. Navigate through each major page
  2. Run agent-browser errors on each
  3. Assert: No uncaught JS errors

Empty States

  1. Navigate to a list/table view with no data
  2. Assert: Empty state message shown (not blank or broken layout)

Responsive

Mobile Viewport (375×667)

agent-browser set viewport 375 667

Check: navigation collapses to hamburger, content doesn't overflow horizontally, touch targets are large enough, text is readable without zooming

Tablet Viewport (768×1024)

agent-browser set viewport 768 1024

Check: layout adapts, sidebars collapse or resize, images scale

Desktop Viewport (1920×1080)

agent-browser set viewport 1920 1080

Check: content doesn't stretch excessively, max-width constraints work

Accessibility Quick Checks

Keyboard Navigation

  1. Press Tab repeatedly
  2. Assert: Focus moves through interactive elements in logical order
  3. Assert: Focus indicator visible on each element

Headings Structure

  1. Take full snapshot (no -i flag)
  2. Assert: Headings follow hierarchy (h1 → h2 → h3), no skipped levels

Image Alt Text

  1. Check snapshot for images
  2. Assert: Images have meaningful alt text (not empty or "image")

Form Labels

  1. Snapshot interactive elements
  2. Assert: Every input has an associated label (visible in accessibility tree)

Performance Indicators

Slow Page Load

  1. Navigate to page
  2. Use wait --load networkidle
  3. If it takes noticeably long (>5s), flag it
  4. Check network requests for large/slow resources

Console Warnings

  1. Run console after page load
  2. Flag excessive warnings, deprecation notices, or repeated errors

Environment Comparison

Staging vs Production

agent-browser diff url {STAGING} {PROD} --screenshot

Look for: content differences, missing elements, layout shifts, broken images

Pre/Post Deploy

  1. Screenshot before deploy
  2. Deploy
  3. diff screenshot --baseline before.png
  4. Flag pixel differences above threshold