Testing Suite (E2E)
Relevant source files
The following files were used as context for generating this wiki page:
The Testing Suite (E2E) for Mailiner provides end-to-end validation by driving the web application in a real browser environment. It utilizes Playwright to test the mailiner-app Dioxus instance, which is cross-compiled to WebAssembly (WASM). These tests verify critical user flows, such as first-run onboarding, by interacting with the application as a user would, ensuring that the frontend, WASM logic, and browser storage (localStorage) function correctly together.
The suite is designed to run against a dx serve instance of the application. Because the application relies on WebSockets via ws-tcp-proxy to circumvent browser TCP limitations, the E2E environment typically requires a local proxy setup to connect to real IMAP accounts during testing.
Sources: e2e/README.md:3-6, README.md:10-18
Architecture and Configuration
The testing infrastructure is built on Playwright and integrated into the project's root directory. The suite automatically manages the lifecycle of the development server using the Dioxus CLI (dx).
Test Orchestration Flow
The following diagram illustrates how the E2E suite initializes the environment and executes tests.
The suite compiles the workspace to WASM before starting the test runner. Sources: e2e/README.md:17-21, playwright.config.ts:38-43
Configuration Parameters
The suite is configured via playwright.config.ts with specific adjustments for the high compilation overhead associated with Rust/WASM builds.
| Option | Value / Default | Description |
|---|---|---|
testDir | ./e2e/tests | Directory containing specification files. |
timeout | 30,000ms | Individual test timeout. |
webServer.timeout | 5 minutes | Time allowed for dx serve to compile and start. |
webServer.command | dx serve -p mailiner-app | Command used to spawn the target application. |
baseURL | http://127.0.0.1:8080 | Default URL for the application under test. |
Sources: playwright.config.ts:18-44
Execution Commands
Tests are managed through standard npm scripts defined in the root package.json.
- Standard Run:
npm run test:e2e- Executes tests in headless mode. - UI Mode:
npm run test:e2e:ui- Launches the Playwright interactive UI for debugging. - Report:
npm run test:e2e:report- Opens the HTML results from the previous run.
Users can point the suite at an existing server by setting the MAILINER_E2E_BASE_URL environment variable.
Sources: package.json:6-10, e2e/README.md:32-41
Test Case Implementation
Current test implementations focus on the application state when browser localStorage is empty. This triggers the "NeedsOnboarding" state, redirecting the user to the onboarding flow.
Onboarding Verification
The suite validates that the onboarding shell is visible and that the main application chrome (the #app element) is not rendered until a successful connection is established.
Sources: e2e/tests/app.spec.ts:3-12
Prerequisites and Environment
Running the suite requires specific tools to handle the Rust-to-WASM pipeline and the Playwright browser dependencies.
- Node.js: Version 20+ is required for the Playwright runner.
- Dioxus CLI (
dx): Must be on the systemPATHto serve the application. - Rust Target: The
wasm32-unknown-unknowntarget must be installed viarustup. - Browsers: Playwright Chromium dependencies must be installed via
npx playwright install.
Sources: e2e/README.md:8-15
Summary
The Mailiner E2E Testing Suite provides a robust mechanism for validating the WASM application within Chromium. By automating the dx serve process and focusing on the critical onboarding path, it ensures that account creation and the initial security state remain functional across builds. The generous timeouts in the configuration specifically account for the intensive compilation required by the Rust/WASM workspace.