import { defineConfig } from '@playwright/test'; /** * Electron-specific integration config. Reuses the same Stalwart fixture * bring-up (globalSetup/globalTeardown) as playwright.integration.config.ts, * but deliberately kept separate from it and scoped to only * integration/tests/11-electron-notification.spec.ts: * * - No `projects` array: that test launches its own Electron process via * _electron.launch() - it needs no Playwright-managed browser project. * - Not run as part of the main dockerized suite: `npm run test:integration` * (integration/run-tests.sh) runs the browser-based suite INSIDE the * official Playwright Docker image (to get Chromium without relying on * Playwright's own browser-download host). Electron has no such * download step - `npm install electron` already fetched a binary for * THIS host's platform, which would not run inside that (likely * different-platform) container. Run this suite directly on the host * instead - see `npm run test:integration:electron`. The main * integration config explicitly excludes this spec file for the same * reason, so a plain `npm run test:integration` never tries to launch it. */ export default defineConfig({ testDir: './integration/tests', // 11 asserts the native notification bridge fires from a real push; 12 // asserts a real delivery reaches the encrypted local search index; 13 asserts // the offline mail REPLICA still serves a synced message's full body with the // backend severed at the socket level. 12 and 13 run the REAL standalone-server // boot (no ELECTRON_LOAD_URL), because that boot is what wires the store // directory and the fd-3 key channel. testMatch: /1[123]-electron-.*\.spec\.ts/, // 13 syncs a real mailbox and then chains cycles, so it needs more than 90s; // it sets its own per-test timeout, and this is the floor for the others. timeout: 90_000, expect: { timeout: 20_000 }, fullyParallel: false, workers: 1, // Retries unconditionally (not just CI), and more than the main config's // 1: this suite runs the Electron shell against a `next dev` server (see // the spec file's header comment for why - the fixture's Stalwart is // deliberately plain HTTP), and `next dev`'s on-demand route compilation // + Fast Refresh occasionally races the SSE stream this test depends on // during the login -> inbox route transition, dropping that one push // event with no error anywhere (confirmed by running the identical test // repeatedly against an already-warm stack: same request sequence logged // every time, but the outcome isn't always the same). Root-caused, not // eliminated - a genuine dev-server-only timing hazard, not a bug in the // feature this test is verifying (the same run's own logs show the WS // circuit breaker and SSE fallback firing exactly as designed every // single time, pass or fail). retries: 2, reporter: [['list']], outputDir: 'integration/test-results-electron', // Own global-setup (not the main config's): brings up only the `stalwart` // compose service, not `webmail` - this suite boots a `next dev` server // itself (see the spec file) and never talks to the containerized // webmail on :3000. Teardown is shared - it already defaults to leaving // the stack up unless IT_TEARDOWN=1. globalSetup: './integration/tests/global-setup-electron.ts', globalTeardown: './integration/tests/global-teardown.ts', });