mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-05-07 04:52:50 +08:00
* fix: auto-reply not triggering when source_prefix is empty (#459) - Empty source_prefix now matches all senders (was short-circuiting as falsy) - Support regex matching with /pattern/ syntax in source_prefix - Backward compatible: plain strings still use startsWith - Use E2E_TEST_MODE switch to skip cloudflare:email import in tests - Track reply() calls in E2E mock for testability Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: update auto-reply UI labels for regex support Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update changelogs for auto-reply fix and regex feature Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: upgrade version to v1.5.0 - Update version number to 1.5.0 in all package.json files and constants.ts - Split CHANGELOG: v1.4.0 entries finalized, new v1.5.0(main) section with auto-reply changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: add error logging for invalid regex in auto-reply source_prefix Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: address CodeRabbit review suggestions - Use const object instead of let for mock state tracking - Add log when auto-reply subject/message falls back to defaults Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add source_prefix regex syntax to auto-reply docs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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:
- Starts Mailpit (SMTP on :1025, HTTP API on :8025)
- Builds and starts the Worker (wrangler dev on :8787)
- Builds and starts the Frontend (vite dev on :5173)
- 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 artifactse2e/playwright-report/— HTML report
Configuration
The E2E worker uses fixtures/wrangler.toml.e2e with:
E2E_TEST_MODE = true— enables test seed endpointDISABLE_ADMIN_PASSWORD_CHECK = true— allows unauthenticated admin callsDEFAULT_SEND_BALANCE = 10— allows sending without admin approval- SMTP pointed at Mailpit container (
mailpit:1025)