Files
SRCmail/playwright.integration.config.ts
T
Stefan HildebrandtandLinus Rath 8d8bc7cb13 test(integration): dockerized webmail⇆Stalwart Playwright sync suite
Add an end-to-end integration harness that runs the webmail against a real
Stalwart mail server in Docker and drives it with Playwright, focused on the
mail/folder synchronisation behaviour (unread/total counters, folder-list
sync, account-scoped Unified Mailbox) that the unified-mailbox work touches.

- integration/ stack: Stalwart (declarative bootstrap: alice/bob/carol,
  submission + IMAP listeners, permissive CORS) + webmail (dev mode, so the
  browser's plaintext cross-origin JMAP calls aren't blocked by the prod CSP).
- Helpers: dependency-free SMTP submit client, JMAP client for seeding /
  inspecting server state, and page helpers (login, add/switch account,
  locale-independent folder-counter reads).
- Specs: login, single-account sync (receive/read/move/delete/folder-create/
  burst) and multi-account (per-account isolation + cross-account Unified
  Inbox aggregation + background-account delivery). 12 tests, all green.
- Add focused data-testid hooks to the mail UI (folder rows + counters, email
  list items, account switcher, composer) for stable selectors.
- Exclude examples/ and integration/ from tsconfig/eslint/.dockerignore.
2026-07-16 17:59:52 +02:00

33 lines
1.2 KiB
TypeScript

import { defineConfig } from '@playwright/test';
/**
* Integration test config: drives the containerised webmail (+ Stalwart) stack
* managed by integration/tests/global-setup.ts. Distinct from the root
* playwright.config.ts (fast UI smoke tests against `npm run dev`).
*
* Run: npx playwright test -c playwright.integration.config.ts
*/
const WEBMAIL_URL = process.env.IT_WEBMAIL_URL ?? 'http://localhost:3000';
export default defineConfig({
testDir: './integration/tests',
// next dev compiles routes lazily and each test logs in fresh, so give
// individual tests and their polling assertions generous headroom.
timeout: 90_000,
expect: { timeout: 20_000 },
fullyParallel: false,
workers: 1,
retries: process.env.CI ? 1 : 0,
reporter: [['list'], ['html', { open: 'never', outputFolder: 'integration/playwright-report' }]],
outputDir: 'integration/test-results',
globalSetup: './integration/tests/global-setup.ts',
globalTeardown: './integration/tests/global-teardown.ts',
use: {
baseURL: WEBMAIL_URL,
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
video: 'retain-on-failure',
},
projects: [{ name: 'chromium', use: { browserName: 'chromium' } }],
});