8.5 KiB
E2E Test Suite Documentation
Overview
Comprehensive end-to-end test suite for WorkRoot IT Solutions website covering all critical user journeys and interactions.
Test Suites
1. Smoke Suite (e2e-smoke-suite.spec.ts)
Priority: P0 - Must pass before any deployment Runtime: < 2 minutes Purpose: Rapid verification of critical functionality
Coverage:
- All critical pages load (9 pages)
- Core navigation flows work
- Contact form basic submission
- Blog navigation basics
- Performance checks (< 3s load time)
- No JavaScript errors
- Responsive layout (Mobile/Tablet/Desktop)
- SEO basics (meta tags)
- Security headers present
- Accessibility basics
- Critical assets load
When to run: Every commit, before deployment, CI/CD pipeline
2. Critical User Journeys (e2e-critical-paths.spec.ts)
Priority: P0 Runtime: 3-5 minutes Purpose: Test complete user flows from entry to conversion
User Journeys Tested:
-
First Time Visitor → Contact
- Homepage → Services → Contact → Form Submission
-
Technical Reader → Blog → Contact
- Homepage → Blog → Read Post → Contact
-
Portfolio Exploration
- Portfolio → About → Contact
-
Mobile First-Time Visitor
- Mobile navigation → Services → Contact form
-
Quick Information Seeker
- Footer links → Privacy → Terms → Home
-
Return Visitor - Direct Blog Access
- Bookmark/Search → Blog Post → Listing
-
Security & Trust Verification
- HTTPS check → Privacy Policy → Terms
-
Multi-page Session
- All pages visited in sequence
- No console errors
- No layout shifts
3. Form Interactions (e2e-form-interactions.spec.ts)
Priority: P1 Runtime: 4-6 minutes Purpose: Deep testing of contact form functionality
Coverage:
-
Happy Path:
- Successful submission with all fields
- Loading states
- Success messages
- Form clearing
-
Validation:
- Empty submission
- Invalid email format
- Name too short
- Message too short
- Real-time validation
- Error message display
-
Security:
- Honeypot protection (bot detection)
- Multiple submission prevention
-
UX Features:
- Phone field formats
- Subject dropdown
- Focus states
- Keyboard navigation (Tab order)
-
Accessibility:
- Labels associated with inputs
- Error announcements
- Submit button states
-
Mobile:
- Touch interactions
- Keyboard types (email, tel)
- Viewport fit
4. Blog Navigation (e2e-blog-navigation.spec.ts)
Priority: P1 Runtime: 5-7 minutes Purpose: Comprehensive blog functionality testing
Coverage:
-
Navigation Flows:
- Homepage → Blog → Post → Back
- Multiple post reading
- Direct URL access
-
Reading Experience:
- Deep reading (scrolling)
- Content structure
- Typography
- Image loading
- Code blocks
-
Metadata & SEO:
- Dates visible
- Categories/tags
- Social sharing
-
Mobile Reading:
- Responsive layout
- Font sizes
- Image adaptation
- Scroll performance
-
Reading Patterns:
- Skimming behavior
- Deep reading scroll
- Code block interaction
-
Performance:
- Listing load time < 3s
- Post load time < 3s
- Lazy loading
-
Edge Cases:
- Direct URL access
- 404 handling
- Empty state
Test Execution
Quick Start
# Run all E2E tests
npm run test
# Run only smoke tests (fast)
npm run test tests/e2e-smoke-suite.spec.ts
# Run specific suite
npm run test tests/e2e-critical-paths.spec.ts
# Run on specific browser
npm run test:chromium
npm run test:firefox
npm run test:webkit
# Mobile testing
npm run test:mobile
CI/CD Integration
# Pre-commit: Smoke suite only
npm run test tests/e2e-smoke-suite.spec.ts -- --project=chromium
# Pre-merge: All critical tests
npm run test tests/e2e-smoke-suite.spec.ts tests/e2e-critical-paths.spec.ts
# Nightly: Full regression
npm run test
Test Reports
# View HTML report
npm run test:report
# Generate JSON report (for CI)
npm run test -- --reporter=json > test-results/report.json
Test Environment
Prerequisites
- Node.js installed
- Dependencies installed (
npm install) - Server running on
http://localhost:10000
Starting the server
# Terminal 1: Start server
npm run dev
# Terminal 2: Run tests
npm run test
Environment Variables
No environment variables required for E2E tests.
Test Data
Blog Posts Used
getting-started-with-astro- Main test post
Form Test Data
{
name: "John Doe",
email: "john.doe@example.com",
phone: "+1 555-123-4567",
subject: "web-development",
message: "I am interested in..."
}
Coverage Matrix
| Feature | Smoke | Critical Paths | Form | Blog | Total Tests |
|---|---|---|---|---|---|
| Page Loads | ✅ 9 | ✅ 6 | ✅ 1 | ✅ 3 | 19 |
| Navigation | ✅ 2 | ✅ 8 | - | ✅ 7 | 17 |
| Forms | ✅ 1 | ✅ 3 | ✅ 20 | - | 24 |
| Mobile | ✅ 3 | ✅ 1 | ✅ 2 | ✅ 2 | 8 |
| Performance | ✅ 2 | ✅ 1 | - | ✅ 3 | 6 |
| Accessibility | ✅ 2 | - | ✅ 3 | ✅ 1 | 6 |
| Security | ✅ 1 | ✅ 1 | ✅ 2 | - | 4 |
| Total | 20 | 20 | 28 | 16 | 84 |
Browser Support
Tested Browsers
- ✅ Chromium (Chrome, Edge, Brave)
- ✅ Firefox
- ✅ WebKit (Safari)
- ✅ Mobile Chrome (Pixel 5)
- ✅ Mobile Safari (iPhone 12)
- ✅ Tablet (iPad Pro 11)
Test Matrix Strategy
- Smoke Suite: Chromium only (speed)
- Critical Paths: All browsers
- Form Tests: Chromium + Mobile
- Blog Tests: Chromium + Mobile Safari
Flaky Test Prevention
Strategies Implemented
- Explicit Waits:
waitForLoadState('networkidle') - Element Visibility Checks: Before interaction
- Retry Logic: Playwright built-in (2 retries in CI)
- Stable Selectors: Semantic selectors over CSS classes
- Timeouts: Generous timeouts for slow environments
Known Issues
- None currently identified
Debugging Failed Tests
Screenshot on Failure
Screenshots automatically saved to test-results/ on failure.
Video Recording
# Enable video for all tests
npm run test -- --video=on
Trace Viewer
# Tests run with trace on first retry
# View trace:
npx playwright show-trace test-results/.../trace.zip
Debug Mode
# Run in headed mode with slow-mo
npm run test -- --headed --slow-mo=1000
Maintenance
Adding New Tests
- Identify user journey or feature
- Choose appropriate suite file
- Write test following existing patterns
- Run locally:
npm run test path/to/test.spec.ts - Update this README with coverage
Updating Selectors
When UI changes:
- Run tests to identify failures
- Update selectors in failed tests
- Prefer semantic selectors (
getByRole,getByLabel) - Verify across all browsers
Performance Benchmarks
Current baselines:
- Homepage load: < 3s
- Blog listing load: < 3s
- Blog post load: < 3s
- Form submission: < 2s
Update these if intentional changes occur.
Best Practices
DO ✅
- Use semantic selectors
- Wait for element visibility
- Test user journeys, not implementation
- Keep tests independent
- Clean up test data
- Use descriptive test names
DON'T ❌
- Use fixed delays (
waitForTimeoutsparingly) - Test implementation details
- Make tests depend on each other
- Hardcode credentials
- Ignore flaky tests
CI/CD Pipeline Integration
GitHub Actions Example
name: E2E Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: npm ci
- run: npx playwright install --with-deps
- run: npm run build
- run: npm run preview &
- run: npx wait-on http://localhost:10000
- run: npm run test
- uses: actions/upload-artifact@v3
if: always()
with:
name: test-results
path: test-results/
Contact & Support
For questions about E2E tests:
- Check test file comments for specific test logic
- Review Playwright documentation: https://playwright.dev
- Contact QA team for test strategy questions
Changelog
2026-03-21
- ✅ Initial E2E test suite creation
- ✅ 84 comprehensive tests across 4 suites
- ✅ Full coverage of critical user journeys
- ✅ Mobile and desktop testing
- ✅ Performance and security checks
- ✅ Accessibility validation