Skip to main content
CharleOS uses Cypress for end-to-end testing of critical user flows. This page covers how to write and run E2E tests.

Test Users

E2E tests use dedicated test accounts that are isolated from real user data: Important: Always run 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

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

Always use the dedicated test accounts:
Focus on what users actually do:
Prefer data-testid attributes over CSS classes:
Each test should work in isolation:
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:

Testing Overview

Testing strategy

Unit Tests

Vitest unit tests

Cypress Docs

Official Cypress docs