This document describes the automated testing suite for verifying user-facing functionality on protocol-guide.com using Puppeteer browser automation.
# Run the full test suite
pnpm test:site
# View screenshots after testing
open test-screenshots/Purpose: Verify the homepage loads successfully without errors.
Checks:
- Page loads within timeout (30s)
- Page title is present
- Body content exists
- No critical console errors
Expected Outcome: Homepage renders with content visible.
Common Issues:
- Timeout errors (site down or slow)
- Empty page (build/deployment issue)
- JavaScript bundle errors
Purpose: Verify search functionality works correctly.
Checks:
- Search input field is accessible
- User can type query
- Submit button exists or Enter key works
- Response appears after submission
Expected Outcome: User can enter "cardiac arrest" and trigger search.
Common Issues:
- Input field not found (DOM selector mismatch)
- Search doesn't submit (event handler issue)
- No response after search (API/backend issue)
Purpose: Verify site adapts to different screen sizes.
Checks:
- Desktop viewport (1920x1080) renders correctly
- Mobile viewport (375x667) renders correctly
- No horizontal overflow on mobile
- Content is readable on small screens
Expected Outcome: Site layout adapts without breaking.
Common Issues:
- Horizontal scrolling on mobile (CSS overflow)
- Content cut off or hidden
- Touch targets too small on mobile
Purpose: Verify site loads efficiently and handles network requests.
Checks:
- Page load time under 5 seconds
- No failed network requests (404, 500 errors)
- Assets load successfully (CSS, JS, images)
Expected Outcome: Fast load time with no failed requests.
Common Issues:
- Slow API responses
- Missing assets (404 errors)
- CDN or hosting issues
Purpose: Verify essential UI components are present.
Checks:
- Buttons are present on page
- Links are present on page
- Interactive elements are accessible
Expected Outcome: Page has interactive UI elements.
Common Issues:
- Missing components (build issue)
- Empty or broken layout
Purpose: Detect runtime JavaScript errors.
Checks:
- No uncaught exceptions
- No console.error() calls
- React/framework errors don't occur
Expected Outcome: No JavaScript errors in console.
Common Issues:
- Uncaught TypeErrors (undefined properties)
- React rendering errors
- Third-party library errors (Supabase, tRPC, etc.)
Purpose: Verify basic accessibility compliance.
Checks:
- Images have alt text attributes
- Heading hierarchy exists (h1, h2, h3)
- Semantic HTML structure
Expected Outcome: Content is accessible to screen readers.
Common Issues:
- Missing alt text on images
- No heading structure
- Non-semantic div soup
All screenshots are saved to /test-screenshots/ with timestamps:
test-screenshots/
1-homepage-loads-1708123456789.png
2-search-interface-1708123456790.png
3-responsive-layout-1708123456791.png
4-network-performance-1708123456792.png
5-basic-ui-elements-1708123456793.png
6-javascript-errors-1708123456794.png
7-content-accessibility-1708123456795.png
================================================================================
PROTOCOL GUIDE WEBSITE TEST RESULTS
================================================================================
Total Tests: 7
Passed: 6 ✓
Failed: 1 ✗
Warnings: 3
✓ PASS 1. Homepage Loads (2341ms)
📸 /path/to/test-screenshots/1-homepage-loads-1708123456789.png
✗ FAIL 2. Search Interface (1523ms)
Error: Timeout waiting for selector 'input[type="text"]'
⚠ Console: TypeError: Cannot read property 'map' of undefined
📸 /path/to/test-screenshots/2-search-interface-error-1708123456790.png
- ✓ PASS: Test completed successfully
- ✗ FAIL: Test threw an error and failed
- ⚠ Warning: Test passed but with non-critical issues
| Warning | Meaning | Action |
|---|---|---|
| "Page load time is slow: 6234ms" | Site taking >5s to load | Check backend performance, CDN, or API response times |
| "Console: TypeError: ..." | JavaScript error detected | Review error in browser DevTools, check source maps |
| "X images missing alt text" | Accessibility issue | Add alt attributes to <img> tags |
| "No heading elements found" | Accessibility issue | Add semantic heading structure (h1, h2, h3) |
| "Could not find search input field" | DOM selector mismatch | Check if component structure changed |
After automated tests, manually verify:
- Sign-in/auth flows work (Google, Apple)
- State filter dropdown shows all states
- Agency filter shows LEMSAs for selected state
- Protocol detail page loads with content
- Favorites/bookmarking works
- Profile page accessible
- Admin panel accessible (for admin users)
- Subscription/payment flow works
- Offline functionality (PWA)
Update CHROME_PATH in scripts/test-site-v2.ts:
// macOS default
const CHROME_PATH = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
// Alternative (if using Chromium)
const CHROME_PATH = '/Applications/Chromium.app/Contents/MacOS/Chromium';Increase timeout in script:
const TIMEOUT = 60000; // 60 secondsOr check if site is down:
curl -I https://protocol-guide.comCheck permissions:
ls -la test-screenshots/Manually create directory:
mkdir -p test-screenshots
chmod 755 test-screenshots- Run tests after deployment: Verify production site after Netlify deploy
- Compare screenshots: Look for visual regressions between runs
- Monitor warnings: Even passing tests can have issues
- Test on staging first: Don't wait for production to catch errors
- Check mobile screenshots: Mobile issues often differ from desktop
To run in CI (GitHub Actions, Netlify, etc.):
- name: Test Production Site
run: |
pnpm test:site
env:
CI: trueFor headless environments, ensure Chrome/Chromium is installed:
- name: Install Chrome
run: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
apt-get update
apt-get install google-chrome-stable -y- CLAUDE.md - Project configuration
- EMS_ARCHITECTURE.md - Architecture details
- CONTRIBUTING.md - Development workflow
- 2026-02-18: Initial automated test suite created
- Tests cover: homepage, search, responsive design, performance, UI, JS errors, accessibility