Files
cloudflare_temp_email/e2e
Dream Hunter 5dbb6107dd feat: add user send mail and sent box (#1122)
* feat: add user send mail client

* fix: align user mail navigation

* fix: shorten address credential action

* test: cover user mail ownership boundaries

* fix: address user mail review feedback

* fix: disambiguate user mail e2e heading

* fix: minimize shared sent box changes

* refactor: isolate user send mail page

* refactor: reuse bound address lookup

* fix: clarify user sent box naming

* refactor: decouple user send API from roles

* fix: align user send mail behavior

* fix: align user send role and rate limits

* test: isolate user send rate limits

* test: initialize rate limit worker database

* refactor: simplify user send rate limit

* refactor: inline user send rate limit path

* refactor: simplify user send limiter key

* refactor: keep existing rate limit behavior

* style: simplify user send rate limit condition

* style: group user send rate limit condition

* fix: bind user role token to account

* fix: keep user sender selection available
2026-08-25 14:14:42 +08:00
..

E2E Tests

End-to-end tests for Cloudflare Temp Email using Playwright and Mailpit, fully containerized with Docker Compose.

Prerequisites

  • Docker and Docker Compose

Quick Start

cd e2e

# Build, start all services, run tests, and exit
npm test

# Clean up containers and volumes
npm run test:down

npm test runs docker compose up --build, which:

  1. Starts Mailpit (SMTP on :1025, HTTP API on :8025)
  2. Builds and starts the Worker (wrangler dev on :8787)
  3. Builds and starts the Frontend (vite dev on :5173)
  4. Builds and runs the E2E runner (Playwright), which waits for services, initializes the DB, and runs all tests

The exit code reflects the test result.

Test Structure

Project Directory What it tests
api tests/api/ Worker API endpoints — health check, address CRUD, send mail via SMTP
browser tests/browser/ Frontend UI — login, inbox view, reply with HTML, XSS sanitization

Services

Service Container Port Purpose
Mailpit SMTP mailpit 1025 Captures outgoing emails
Mailpit HTTP mailpit 8025 API to verify captured emails
Worker worker 8787 Backend API with E2E config
Frontend frontend 5173 Vue frontend dev server

Test Results

Test results and HTML reports are exported via volumes:

  • e2e/test-results/ — test artifacts
  • e2e/playwright-report/ — HTML report

Configuration

The E2E worker uses fixtures/wrangler.toml.e2e with:

  • E2E_TEST_MODE = true — enables test seed endpoint
  • DISABLE_ADMIN_PASSWORD_CHECK = true — allows unauthenticated admin calls
  • DEFAULT_SEND_BALANCE = 10 — allows sending without admin approval
  • SMTP pointed at Mailpit container (mailpit:1025)