todos-contra-el-fuego-web/e2e/playwright.config.js
vjrj a3f2929ff7 test(e2e): browser suite for the flows the server tests cannot see
Playwright under e2e/, its own npm project so Meteor never sees the dependency
(.meteorignore keeps the directory out of the bundle — a config file at the app
root is otherwise eagerly loaded into the server and crashes it).

Covers what the phase asked for: sign up / log in, creating a zone from the map
and watching the union get painted on /subscriptions and /zones, removing it
again, commenting on a fire, and switching language. The zone spec is the flow
that froze staging on 2026-07-30 — it passes only if the server is still
answering DDP while the union is recomputed.

docker-compose.e2e.yml is a throwaway stack (Mongo on tmpfs, no named volume) so
the destructive seeds cannot be pointed at anything real by accident;
playwright.config.js refuses to start against the staging or production domains.

i18n.spec.js leaves a test.fixme on a real bug found while writing it: the
language chosen in the profile does not survive a page reload.
2026-08-01 18:44:09 +02:00

42 lines
1.6 KiB
JavaScript

import { defineConfig, devices } from '@playwright/test';
// E2E_BASE_URL points at a THROWAWAY stack — the compose in docker-compose.e2e.yml
// or a local dev server. Never at testfuegos.comunes.org or anything else with
// data in it: these tests create users and subscriptions, and the seed step wipes
// collections.
const baseURL = process.env.E2E_BASE_URL || 'http://localhost:3100';
if (/testfuegos|fuegos\.comunes|fires\.comunes/.test(baseURL)) {
throw new Error(`Refusing to run the e2e suite against ${baseURL}: it seeds and writes data.`);
}
export default defineConfig({
testDir: './tests',
// Meteor's first page load compiles and ships a big bundle; the map then waits
// for tiles and DDP subscriptions.
timeout: 90 * 1000,
expect: { timeout: 20 * 1000 },
// Every spec creates its own user, but they share one Mongo and one union
// recompute queue; running them in parallel makes failures much harder to read
// for very little wall-clock on a runner that only has one job slot anyway.
workers: 1,
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
reporter: process.env.CI
? [['list'], ['html', { open: 'never', outputFolder: 'playwright-report' }]]
: [['list']],
use: {
baseURL,
// Both on first retry only: a trace per test would be gigabytes of artifacts
// for a suite that is green most of the time.
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
actionTimeout: 20 * 1000,
locale: 'es-ES'
},
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }
]
});