Test Users
E2E tests use dedicated test accounts that are isolated from real user data:| Access Level | Work Type | Use For | |
|---|---|---|---|
test-admin@charle.co.uk | Admin | CSM | Admin features, settings, full access |
test-manager@charle.co.uk | Manager | PM | Management features, scheduling |
test-staff@charle.co.uk | Staff | Development | IC features, task assignment |
npm run db:seed:e2e before running E2E tests to ensure test users exist.
Custom Commands
Login Commands
What to E2E Test
Focus on critical user journeys and integration points:Authentication
Sign in, sign out, session management
Core Workflows
Create task, approve quote, assign subtask
Client Portal
Client sign-in, view tasks, submit tickets
Permissions
Admin vs manager vs staff access
Test Structure
File Organization
Basic Test Example
Cypress Features
Navigation
Locators
Interactions
Assertions
Common Test Patterns
Authentication Flow
Task Viewing
Permission Tests
Running E2E Tests
Basic Commands
Watch Mode
Debugging
Screenshots and Videos
Cypress automatically captures screenshots on failure and videos of test runs:Debug Commands
Run in Headed Mode
Best Practices
Use Dedicated Test Users
Use Dedicated Test Users
Always use the dedicated test accounts:
Test Real User Flows
Test Real User Flows
Focus on what users actually do:
Use Reliable Selectors
Use Reliable Selectors
Prefer data-testid attributes over CSS classes:
Keep Tests Independent
Keep Tests Independent
Each test should work in isolation:
Use Content Assertions
Use Content Assertions
Verify actual page content loaded, not just URL or body existence:Content assertions ensure the page has fully loaded and rendered the expected content,
catching issues that URL-only or body-visibility checks would miss.
CI Integration
E2E tests run automatically on pull requests to main:Related Documentation
Testing Overview
Testing strategy
Unit Tests
Vitest unit tests
Cypress Docs
Official Cypress docs