The end-to-end suite drives the built web client against a real, seeded server with Playwright. It runs as part of npm run ci:local, which is run for changes to code and on every release commit; a red run stops a release. It records how the product behaves and looks today, so a change that alters a flow, a screen, an accessibility result or a page budget shows up as a failing test.
What the suite covers
| Area | Specs | What is exercised |
|---|---|---|
| Public site | e2e/specs/public/ | Home page, a CMS page, the not-found state |
| Authentication | e2e/specs/auth/ | Register, login, login with 2FA (player and admin), forgot and reset password, verify email, guest redirects |
| Lobby | e2e/specs/lobby/ | Tabs, search and filters, joining a table, private table create and join by invite code |
| Cashier | e2e/specs/cashier/ | Deposit and withdrawal against the manual provider, transfer, history filter |
| Profile and friends | e2e/specs/profile/ | Profile tabs, edit profile, change password, affiliate dashboard, leaderboard |
| Admin: every page | e2e/specs/admin/all-pages.spec.ts | Smoke test of every static admin route at phone, tablet and desktop widths: each renders inside the admin shell with one page heading, nothing throws, the error boundary stays out of sight, and the three overflow checks below pass (ADMIN_PAGES_ONLY narrows a local run to some route prefixes) |
| Admin shell | e2e/specs/admin/shell.spec.ts | Sidebar (groups open independently, the current one opens on arrival, the collapse to the icon rail is remembered), the header’s page title and breadcrumb, the icon rail’s fly-outs at tablet and laptop widths, the phone menu drawer as a modal dialog, the command palette (Ctrl+K and /), the light/dark switch (persisted), the help and account menus, logging out, the in-shell "Page not found", no horizontal page scroll |
| Admin colour scheme | e2e/specs/admin/color-scheme.spec.ts | The admin is light by default and dark on request (computed colours of real elements and role-class probes), and neither scheme reaches the player site or the agent portal |
| Admin home | e2e/specs/admin/home.spec.ts | The operations dashboard: real numbers, a request budget on first load, waiting queues linking to their filtered pages, the setup guide, a limited-permission admin seeing nothing it cannot open, an inline error with Retry when one endpoint fails |
| Admin: Players | e2e/specs/admin/players.spec.ts | Users (search, filters and the open drawer in the URL; add, edit, block and unblock with a confirmation naming the player; bulk group moves; the drawer’s balance adjustment link), cards and sheets on phone and tablet, Groups & Permissions create, edit and delete |
| Admin: Games | e2e/specs/admin/games.spec.ts, bots.spec.ts | Tables (create with field validation, edit, duplicate, delete; cards on tablet) and Tournaments (level length in minutes, duplicate, named start and delete confirmations); every Games › Bots page (list cards, URL state, Bot Scheduler start/stop confirmation, strategy profiles and identities) |
| Admin: Game Scheduler | e2e/specs/admin/game-scheduler.spec.ts | Quick setup (field errors, Back/Next keep choices, the review step, generating mocked, "Discard changes?" on close), templates (create, edit, disable and delete with named confirmations, filters in the URL), phone and tablet widths, the switched-off state linking to Features & Modules; the scheduler itself is never started |
| Admin UI kit | e2e/specs/admin/ui-kit.spec.ts | Layout in real pages: list cards in two columns on a tablet and one on a phone, a table on desktop; the sticky page action bar; a tab row that scrolls sideways and keeps the selected tab in view; no sideways page scroll (read-only) |
| Admin: Money | e2e/specs/admin/money.spec.ts | Withdrawals end to end with no seeded inbox messages: a throwaway player cashes out through the player cashier (manual provider), above the auto-approve threshold it waits as a pending transaction with the balance debited, at or below it it is paid at once; the admin queue (player, amount, destination; the sidebar badge and the dashboard’s "Withdrawals to approve" count it), approve (completes without touching the balance again, the player is told), reject (reason required, amount refunded, reason sent), withdrawals held for AML review or with a provider (say why, no decision, not counted), the flow at 360×740, ?search= and ?status=PENDING deep links, paging over a long mixed queue, and a request message from an older version resolving by its id. Also the deposit queue, the transactions deep link and the balance adjustment pre-fill. Runs on a throwaway admin and players removed at the end |
| Admin: Risk and inbox | e2e/specs/admin/risk-inbox.spec.ts | The Support Inbox without approval tabs, KYC review (approve with a tier, reject with a preset reason, notes saved, the queue moves on, the document viewer on phone and tablet), Fraud Cases at tablet width |
| Admin: Growth | e2e/specs/admin/promotions.spec.ts, agents.spec.ts | Bonuses (create, edit, duplicate, deactivate, delete), Coupons (create, batch generate, deactivate, search, CSV export), Email Campaigns form validation, Affiliates tabs, a limited admin who sees the lists but no button whose endpoint would refuse them; Agents (add, drawer tabs in the URL, role tier and suspend confirmations, "Migrate all" cancelled), role tiers and commission templates |
| Admin: Site & Content | e2e/specs/admin/site-content.spec.ts, content-pages.spec.ts, system-emails.spec.ts | Every Site & Content page has the shell title and one matching heading; the page and block editors at tablet and phone widths; menu reorder; a language disabled, enabled and deleted; table styles, pages, groups and languages list and create flows; a system email toggled and a test send logged in Email Logs |
| Admin: Extensions | e2e/specs/admin/extensions.spec.ts | The plugins list (cards on phone and tablet, a table on desktop), plugin details in a side panel, plugin settings (field validation, unsaved-changes guard), a Developer API partner and its API key, every Developer API page |
| Admin: Settings | e2e/specs/admin/settings-system.spec.ts | Settings tabs in the URL, the save model (dirty indicator, unsaved-changes guard, save and reload), settings search, the confirmation on sensitive feature switches, System Logs tabs, the License & Updates alias and the Email Logs redirect |
| Test support | e2e/specs/admin/support-db.spec.ts | The e2e support’s removeUsers removes a flagged throwaway account without touching other accounts (no browser) |
| Gameplay | e2e/specs/game/ | A cash hand on the standard table (sit, fold, check, call, bet, raise, all-in, time bank, chat, showdown), the spectator view, a network drop and reconnect |
| Table styles | e2e/specs/table-styles/ | The player allow-list endpoint and its enforcement, the style select on the admin Tables form and the private-game form, a sit & go copying its style onto its table, the spectator view on the standard layout, and the live style refresh on the table page and spectator view |
| Tournaments | e2e/specs/tournament/ | Lobby detail and registration, a floor-started tournament through a blind change, a break and an elimination, a sit & go that starts when it fills |
| Progression plugin | e2e/specs/plugins/progression-*.spec.ts | The auto-discovered progression plugin, with fresh accounts per run: a rigged split-pot hand against a scripted socket opponent shows +N XP in the hand-result slot, level badges on the seats, "First hand" and "First win" toasts and in-app notifications, the live header level chip and the profile Progression tab; the daily mission "play 1 hand" paying 100 virtual chips once, the lobby missions card, the admin overview granting XP with a live level-up toast and level reward, the leaderboard XP tab; a two-seat sit & go awarding position-based XP, "First tournament" and the one-time tournament mission |
| Visual regression | e2e/specs/visual/ | Screenshots of lobby, login, home, cashier, profile, admin dashboard, admin users, admin plugins (in the admin’s default light scheme), the standard table and the spectator view at every device-matrix viewport |
| Accessibility | e2e/specs/a11y/ | axe-core on every page, compared against a recorded baseline |
| Performance | e2e/specs/perf/ | Lighthouse budgets on the public pages |
| Suite guards | e2e/specs/suite/ | The device matrix matches the product’s certified viewport list |
| Content machinery | e2e/specs/content/ | The six page templates and sections composed through the page editor, sidebars and menus in their locations, the front-page setting, reserved slugs, sanitised HTML sections, a section with bad data, and a pre-existing page rendering unchanged |
| Theme runtime | e2e/specs/runtime/ | A mocked theme (served by page.route, no server endpoints needed) replaces a view and a part, falls back to default when it throws, is deactivated without a reload, is refused on a contract mismatch, and cannot reach the socket or a store |
| Built-in theme | e2e/specs/default-theme/ | A fresh install runs on default (public theme endpoints, no theme markup on player pages, the built-in row and its tokens on Customise); default previewed and activated again while a child theme is live, with players returning to it without a reload. The upgrade path from a pre-theme database is src/tests/integration/default-theme-install.test.ts (Vitest, runs when DATABASE_URL names a *_test database) |
| Sample themes | e2e/specs/themes/ | The six sample child themes of default (themes-src/samples/), built with the theme CLI at run time: every sample except sample-bad through upload, validation report, preview, activate, customise, live update in a second browser, upgrade and rollback, deactivate without a reload, and delete; sample-bad rejected with its rule and file:line; sample-table‘s skin of the standard layout certified by the harness and an uncertified copy never mounting its layout on a live table; a fresh document differs from default in exactly what each sample overrides |
| User-selectable themes | e2e/specs/user-themes/ | sample-light (built from themes-src/samples/ at run time) on the players’ allow-list through the Player theme choice panel: a player opens Settings from the player menu, switches to sample-light (live and on a fresh document; guests keep the site theme, data-color-scheme follows) and back; with an expired access cookie and a valid refresh cookie the saved theme follows once the session is refreshed; an open page follows the allow-list and the choice being turned off live, with one token sheet and no reload; a slug outside the list is refused (400); with the choice off the link is gone, the page says so, the API answers 403 and the server serves the site theme despite the saved choice |
| Daily Wheel plugin | e2e/specs/plugins/daily-wheel.spec.ts | The auto-discovered daily-wheel plugin with a one-segment wheel set through the admin settings API: the lobby banner and header indicator offer a spin, the wheel turns to the server’s result, the virtual balance grows by the prize, a second spin is refused with the cooldown message (UI and 429 SPIN_COOLDOWN), the cooldown and history survive a reload, and the admin stats page shows the one spin. Runs as the seeded e2e_wheel and clears the plugin’s stored data first |
| Notifications plugin | e2e/specs/plugins/notifications-claim.spec.ts, notifications-email.spec.ts, notifications-preferences.spec.ts | The auto-discovered notifications plugin: the admin creates and enables a manual campaign with a virtual reward in the admin page and sends it to a fresh player, who gets the live toast and the notification, opens the claim link and claims once (balance grows, a second claim is refused with 409 CLAIM_ALREADY_CLAIMED); a marketing email is skipped for a player without consent (not_opted_in, nothing in Email Logs) and sent through the outbox with List-Unsubscribe to one who opted in (SMTP switched on for the spec and restored); turning a category off on the preferences page skips the next send; enabling the seeded win-back campaign and running its trigger delivers to a player whose lastSeenAt is 7.5 days old |
| Plugins | e2e/specs/plugins/admin-plugins.spec.ts | A plugin scaffolded and packed with the plugin CLI at run time (e2e/support/plugins.ts) through Extensions › Plugins: upload; Activate opens the consent dialog listing every declared capability with its description; Cancel leaves it inactive; Grant and activate activates it, with capability chips on the row and the grants and scheduled job in its details; its lobby.sidebar fill appears in an open lobby without a reload; the json (with a schema) and list settings refuse invalid JSON, schema violations and non-text list items with a message, then save; an upgrade to 0.2.0 keeps the settings and grants and swaps the open lobby to the new bundle; Deactivate removes the fill without a reload; Delete removes the row, the record and the install folder |
| Plugin wallet caps | e2e/specs/plugins/admin-plugin-wallet-caps.spec.ts | Extensions › Plugins as the spec’s own super admin: the auto-discovered progression plugin’s details show Wallet daily caps with real money at 0 (blocked) from the default; a real-money daily limit of 25.50 and unlimited tickets save, the rows switch to the Admin source, the admin API and Plugin.walletCaps hold the new caps, the editor shows them after a reload, and axe finds no violation in the details panel. Restores the plugin’s walletCaps afterwards |
| Plugin realtime | e2e/specs/plugins/plugin-realtime.spec.ts | Two players in two browser contexts with the test plugin active: realtime.toUser reaches only the caller’s page, realtime.broadcast reaches both, and engine.socket.for(providerType).emit('ping') reaches the plugin’s realtime.on('ping') handler, whose toUser answer comes back to the sender only |
The all-scripted bot soak (npm run bots:soak) uses the same test server for its live and live-fast modes: one per shard, each on its own throwaway database. The soak tool (tools/bot-soak/) is internal and no release includes it.
Opponents in gameplay specs are scripted socket players (e2e/support/socket-player.ts) that go through the real Socket.IO API, so every move is validated by the server. The first hand of a gameplay scenario is dealt from a rigged deck through the admin "set cards" control, which the test server enables (RIGGED_DECK_CONTROLS_ENABLED).
Running the suite
npm ci && npx prisma generate
NODE_ENV=production npm run build:client # the suite serves client/dist
npm run e2e # everything (compares visual baselines on Linux)
npm run e2e -- --project=flows # one project: setup, visual, a11y, flows, perf
npm run e2e -- e2e/specs/cashier # one folder or file
npm run e2e:ui # Playwright's UI mode
npm run e2e:report # open the last HTML report
The Playwright config (playwright.config.ts) starts two servers and waits for them:
- the backend (
e2e/bin/api-server.ts): runsprisma migrate deploy, the product seed and the e2e seed, then the real server on port 3101; - the built client (
e2e/bin/web-server.ts): a static preview ofclient/diston port 5191 that proxies/apiand/socket.iolike nginx does in production.
Database
The suite needs its own disposable PostgreSQL database. It never uses the development database and never runs prisma migrate reset or db push. The default connection is a local Postgres on port 54329:
postgresql://postgres:postgres@127.0.0.1:54329/poker_engine_e2e
Point it elsewhere with E2E_DATABASE_URL. Specs that create accounts, tables or tournaments do so under unique, prefixed names, so a database can be reused across local runs; counts shown on data-driven screens (the admin dashboard, the lobby) then drift from the CI baselines, which are captured on a fresh database. Recreate the database when you want the same picture CI sees. A quick throwaway server with Homebrew’s PostgreSQL 16:
initdb -D /tmp/poker-e2e-pg -U postgres --auth=trust
pg_ctl -D /tmp/poker-e2e-pg -o "-p 54329" -l /tmp/poker-e2e-pg.log start
createdb -h 127.0.0.1 -p 54329 -U postgres poker_engine_e2e
Environment
Everything the server needs is set by e2e/config/env.ts (test-only placeholders). Two values pass through from your shell:
LICENSE_KEYandLICENSE_DOMAIN: the product gates private-table creation behind a valid license, so the private-games spec needs them. UnderNODE_ENV=testthe server itself skips its license middleware (src/app.ts), but/healthstill reports the license asnot_configuredwithout a key, and the lobby then hides private-table creation and its join buttons (useLicenseStatus). CI uses the release-readiness license secret.E2E_API_PORT,E2E_WEB_PORT: change the ports if they collide with something on your machine.
Playwright reuses servers you already have running on those ports outside CI, so you can start them once (npx tsx e2e/bin/api-server.ts and npx tsx e2e/bin/web-server.ts) and iterate on specs quickly.
Seed data
e2e/seed/seed.ts runs after the product seed and owns everything the specs rely on: accounts prefixed e2e_ (one per role or flow, so a password change or a session revoke in one spec never disturbs another), tables prefixed e2e-, one CMS page and one table style using the standard (V2) renderer. It is idempotent and resets what earlier runs left behind with targeted deletes. The only product setting it changes, through the admin API, is the "one account per IP at a table" rule, because all players share one machine.
Visual baselines
Baselines live in e2e/__screenshots__/pages.spec.ts/<page>--<viewport>.png, one per page and device-matrix viewport (e2e/device-matrix.ts, mirrored from the product’s certified viewport list). Comparison is strict: maxDiffPixels: 0, animations disabled, a fixed browser clock, reduced motion. Only genuinely dynamic regions are masked, and each mask is listed in the spec:
- admin users: the "Joined" dates (seed timestamps), the column in the table layout and the date text on the cards;
- admin plugins: the "Installed" and "Health" columns (set when the server discovers the demo plugin and runs its background health check);
- lobby: the leagues plugin’s "ends in 4d 16h" line in its lobby panel (it counts down to the real calendar week’s end).
The first-party plugins under plugins/ with a committed dist/ are auto-discovered by the e2e server, so their fills are part of the baselines (the login page’s guest button, the lobby banners and missions card, the header badges, their rows in Extensions › Plugins and their admin menu entries). A plugin whose dist/ is git-ignored (steem-provider, telegram-stars-provider) is not in the CI snapshot, so npm run e2e:docker and npm run e2e:update-baselines cover each ignored plugins/*/dist with an empty volume: a local build of one of them never reaches a run or a baseline.
The standard table and the spectator view are not screenshotted from a live hand. A live table has a running action clock, a server that acts for a slow hero, and seat pods placed from a fractional --t-scale, and three rounds of masks and settle waits never made it pixel-stable (docs/prd/issues/S0-3.md). Instead the spec replays the recorded fixture e2e/fixtures/table-sessions/texas_holdem.session.json (see "Fixture recorder" below) through the real client: e2e/support/table-replay.ts answers the page’s Socket.IO connection with a mock polling server (page.route on /socket.io/), delivers one recorded table_state and, for the seated hero, its action_required, and the browser clock is paused (page.clock.pauseAt), so the action timer and every other timer stand still. REST calls still go to the seeded server. The fixture’s accounts and table are rewritten to the seeded ones (e2e_visual as the hero, e2e_villain6 as the villain, E2E Visual Table with its six seats); the hand itself (cards, bets, pot, street, whose turn) is the recording’s: hand 1 on the flop, hero to act facing a bet, with fold, call and raise available. Each viewport renders on its own freshly opened page, and the screenshot waits for --t-scale to match the table’s width and for the seat boxes to stop moving. No part of the table is masked.
Baselines are rendered by the pinned Playwright Linux image (mcr.microsoft.com/playwright:v<version>-noble, the version in package.json). On macOS or Windows the visual project skips itself, because local rendering differs from CI; set E2E_VISUAL=1 to force a local comparison.
Updating a baseline
A baseline changes only with a stated reason in the pull request. Docker (colima start) produces Linux baselines: npm run e2e:update-baselines runs the visual project with --update-snapshots in the pinned image and writes the new files into e2e/__screenshots__. npm run e2e:docker runs the whole suite the same way, with its own disposable PostgreSQL sidecar; everything after -- goes to Playwright, so npm run e2e:docker -- --project=visual --grep "mid-hand" --repeat-each 20 repeats one test and npm run e2e:docker -- --project=visual --update-snapshots recaptures. A run in this container compares byte-for-byte with the committed baselines; it is the feedback loop for visual work.
Review the diff images in the Playwright report before accepting a new baseline.
A fixed release state for admin pages
The admin’s update banner, the dashboard’s update entry and its licence row follow the latest published release, so an admin screenshot or smoke check would change each time a release is published while the branch under test still carries the previous version. e2e/support/release-state.ts pins that state:
stubReleaseUpToDate(pageOrContext)makes it "up to date, licence valid";stubUpdateAvailable(pageOrContext, version)shows "version X is available".
Only the release fields of GET /api/v1/admin/updates and GET /api/v1/admin/license are rewritten. Each request still goes to the real server, the rest of its answer is passed through, and /health is left alone, so licence-dependent behaviour elsewhere is not hidden. The visual spec and all-pages.spec.ts call stubReleaseUpToDate on their admin contexts, and the "update available" banner is covered by the shell spec. Call it in any new spec that screenshots or measures an admin page.
Admin overflow checks
e2e/specs/admin/all-pages.spec.ts runs three overflow checks on every static admin route, at phone, tablet and desktop widths:
- The page does not scroll sideways. This is measured on the settled document, after the admin
<main>is attached. - Nothing the operator can use sits out of reach at the side. A button, link or input beyond the edge of the box that clips it fails, unless that box is made to be scrolled sideways: a tab list, or a labelled, focusable region (
role="region"or"group", anaria-labelandtabindex="0"). - No content is cut off inside the page.
<main>clips sideways (overflow-x: clip) instead of scrolling, so a table, card or line of text wider than the content column would not show up in the document measure. The check finds every box in<main>that clips sideways without scrolling while its content is wider than it, and names the element that sticks out. Deliberate truncation (text-overflow: ellipsis, a line clamp), boxes that scroll, decoration (aria-hidden, invisible, screen-reader-only, fixed-position) and less than 2px are not counted.
Fix a failure in the page. If a fix has to wait, add the route, width and element to KNOWN_CLIPPED with the reason. An entry that no longer matches anything fails the run, so remove it with the fix.
Accessibility baseline
e2e/a11y/baseline.json records, per page, the axe rules that fail today and how many nodes fail them. A page with a rule that is not in its baseline, or more failing nodes than recorded, fails. Fixing a violation leaves the entry stale; lower it in the same pull request. Regenerate with:
E2E_UPDATE_AXE_BASELINE=1 npm run e2e:docker -- --project=a11y # in the pinned container (preferred)
E2E_UPDATE_AXE_BASELINE=1 npm run e2e -- --project=a11y # against your local server and database
The container run passes E2E_UPDATE_AXE_BASELINE through and rewrites e2e/a11y/baseline.json against a fresh database and a production build, the way the visual baselines are made. A local run counts nodes on whatever your database holds, so data-driven pages can record different numbers. Review the diff of baseline.json before committing it, like any other baseline.
Performance budgets
e2e/specs/perf/lighthouse.spec.ts audits the public pages with Lighthouse through the pinned Chromium and keeps the JSON reports under e2e/lighthouse-reports/. The budgets (category scores and LCP, TBT and CLS) are in the spec; tighten them as CI history accumulates.
Policy
- Shared storage-state accounts (
e2e_player,e2e_visual, the admins) are read-only: a spec that seats a player, or otherwise changes an account’s server-side state, creates its own account (ensurePlayerwithuniqueSuffix) and signs it in through the login page. A shared account left seated turns every later spec’s socket connection into a reconnecting player, which can lose the lobby’s subscription (docs/prd/issues/S0-7.md). - A player’s access cookie lasts 15 minutes and the suite runs longer, so the stored player sessions (
e2e_player,e2e_visual) are renewed during the run. An automatic fixture ine2e/support/fixtures.tssigns the account in again before each test when its stored cookie has less than five minutes left (e2e/support/auth-session.ts). It signs in with the auth API from a page and hands the session to the client (window.__pokerEngine.auth.login), never through the login page: the renewal runs before whichever test comes next, and specs that activate a theme (riverhouse,neo, the samples) have that theme’s own login page live then. Without that, the first page opened after the cookie expires rotates the stored refresh token, and every later page presents a used token, which the server answers by revoking the session, so the page starts signed out. A spec that opens a stored session must therefore importtestfrome2e/support/fixtures.ts, not from@playwright/test. The admin session is not renewed: its access cookie lasts 60 minutes. The certification harness (e2e/harness/certify.ts) does not use the stored sessions; it signs the hero in afresh (auth API, thenwindow.__pokerEngine.auth.login) for each certification. retries: 0, in CI as well. A flaky test is fixed, or quarantined with an issue, never retried into green.- Every lane adds or updates the specs for what it touches, under its own folder in
e2e/specs/. - No product code changes for the sake of a test: select by role, label or text, or by test ids that already exist.
- Test assets never ship:
e2e/,playwright.config.tsandscripts/fixtures/are excluded from the Docker image, the enterprise source zip and GitHub source archives.
Sample themes
themes-src/samples/ holds six child themes of default that exist only to test the theme system and anchor the tutorial (theme plan section 6 item 7, decision 36): sample-tokens, sample-parts, sample-sections, sample-table, sample-light and sample-bad. Their table and folder README say what each one changes. They are never bundled as product themes and never shipped: .dockerignore, .gitattributes and scripts/source-release/exclude.txt exclude themes-src/, and e2e/specs/themes/sample-sources.spec.ts checks it.
No archive is committed. e2e/support/samples.ts copies a sample to a temporary folder, sets the version it needs, and runs the theme CLI there (theme build, theme pack), so the archive always matches its source:
sample-tableis uploaded and activated without a record first (the uncertified copy), certified by the harness (certifyLayoutwith{ id: 'sample-table', theme: 'sample-table' }: the theme is live on the server, and in the harness’s own browser contexts the table style names the layout and the theme configuration lists it as certified, so the table page mounts the real layout component; the run fails if the standard layout renders instead, and is held to no known findings and only the host page’s axe entries), then packed again with the record ascertification.json. The harness signs withTHEME_CERTIFICATION_KEY, whiche2e/config/env.tsgives the e2e server andplaywright.config.tsthe runner (a test-only value), so the server’s gate verifies the record;sample-badgetstamper.json‘s line inserted into the builtdist/theme.jsand is packed with--skip-validation.
The lifecycle spec (e2e/specs/themes/sample-lifecycle.spec.ts) gives every test its own super admin (the 20-writes-per-minute limit is per admin) and uses a guest, or for the table a player account the spec creates, as the second browser. Never open a second page on an account another page already uses: the newer page takes over that account’s socket session and the first stops receiving broadcasts.
For sample-table the spec points the spectated live table at a style naming the sample-table layout. With the unverified copy active, the open table keeps the standard layout (with the sample’s tokens and skin) and the server lists no mountable layout; enabling it mounts the layout on the open table and turning it off removes it again; once the certified 0.2.0 is uploaded the same open table mounts the layout without a reload; rolling back to 0.1.0 puts the standard layout back at once.
Token and custom-CSS changes are checked on a fresh document in that spec; since lane S13 open pages also re-read the token sheet (/api/v1/config/theme.css) on appearance_updated, which e2e/specs/user-themes/ checks live.
Felthouse
npm run e2e:felthouse runs the felthouse project (e2e/specs/felthouse/): guest onboarding to the welcome gift and the email upgrade, a split pot between two browsers on a heads-up table that no bot joins (a per-table auto-fill rule of one player; the rigged deck deals its first hand; payouts, chip conservation, balances after leaving), the Home rewards (timed chips, the daily spin landing on the paid slice, the streak), a Sit & Go to its 65/35 payout, buying and equipping cosmetics (the table shows them), Home with reward plugins off, and:
table-flows.spec.ts, against a socket opponent the spec answers prompt by prompt (ScriptedVillaininfelthouse-support.ts): pre-actions ("Call any" calls a later bet, "Check / fold" checks when free and folds facing a bet, each cleared once fired and on a new street), the turn clock running out (bar and ring on the host’s clock, the time bank pill, the server acting for the hero), sit out / sit back in / top up / "Leave after this hand" with exact balances, a rigged bust (the host’s out-of-chips dialog in the Felthouse look, the out-of-chips offer paying daily-rewards’ refill once, seating again) and a three-player side pot (a side-pot pill on the felt before the showdown, each pot to its winner, the side pot named on its own result line, chips conserved);scheduled-tournament.spec.ts: register from the schedule, the floor start at the start time (the e2e server runs no tournament clock), the level line on the table, "Join late" in the schedule and a late registration from the detail, play to the payout in play chips (socket entrants that drop are auto-folded by the engine while away);private-table.spec.ts: a home game created from Play › Private, joined by code and password from a second browser, played on the Felthouse layout;member-screens.spec.ts: the auth and member screens (two-factor step included) are Felthouse’s, the host pages it does not draw sit in its frame, and with the Cashier on the Store screen carries deposit and withdrawal;live-switches.spec.ts: each of the eleven plugins off and on again under an open session (blocks go and come back live, no errors, no layout holes), and "Show the active theme to players" off and on without a reload.
Build the client first; the specs pack the theme from themes-src/felthouse themselves. A single spec against an already provisioned site: E2E_FELTHOUSE=1 npx playwright test --project=felthouse --no-deps e2e/specs/felthouse/<file> (with FELTHOUSE_KEEP_SITE=1 on the run that provisioned it).
The Felthouse projects exist only when E2E_FELTHOUSE=1 (the npm script sets it), so npm run e2e and the CI e2e job leave them out: the provisioning switches the whole site to Felthouse (theme, features, plugins, table style, bots), which would change the site under the product specs running in the same run. Run npm run e2e:felthouse on its own database. Local CI does exactly that in its own felthouse job (see CI), so the suite gates every merge.
The project is self-contained (it does not use the shared storage states): site.setup.ts provisions the site exactly as the operator guide describes, through the admin API (e2e/support/felthouse-site.ts: the packed theme uploaded and activated, feature toggles, plugin presets, the felthouse table style, the stake ladder, bots, Sit & Go and Jackpot Spin templates, the scheduled tournaments), and site.teardown.ts removes it and puts the default theme back (FELTHOUSE_KEEP_SITE=1 keeps it for exploring). To set the site up by hand on a running e2e stack: node_modules/.bin/tsx e2e/bin/felthouse-site.ts (--teardown removes it, --theme rebuilds and reinstalls only the theme).
Two test-only allowances: the provisioning allows several players from one IP at a table (every browser is 127.0.0.1) and more guests per IP, and each browser context reads the license as valid (the e2e server has no license key, and the lobby hides its join buttons without one; the server’s own checks are unchanged). Creating and joining private tables needs no license key in this suite: the server skips its license middleware under NODE_ENV=test, which is how the e2e server runs (src/app.ts). The provisioning’s admin clients wait out the admin write limit once (a re-run within a minute of the previous provisioning would otherwise hit it). The table layout itself is certified separately: npx playwright test -c e2e/harness/playwright.config.ts felthouse.
Plugins
Plugins under plugins/
The e2e backend runs from the repository root, so the plugin loader auto-discovers every folder in plugins/ that has a built server entry (dist/server/index.js) and starts it active with all declared capabilities granted (the development convenience described in docs/developer/plugins/capabilities.md). No environment variable is needed. Today that is every first-party plugin (FIRST_PARTY_PLUGINS in tools/plugin/src/first-party.ts, demo-plugin included), whose dist/ is committed: their header badges, login button and lobby banners are part of the screenshots, and their rows are what the admin-plugins screenshot and axe entries show. Plugins without a committed dist/ are skipped. A folder whose entry throws on import is logged and skipped; the server still starts (checked with a deliberately broken plugin while writing the plugin specs). A plugin deactivated in the admin stays inactive across restarts.
The test plugin (e2e/support/plugins.ts)
No plugin archive is committed. packTestPlugin({ workDir, providerType, displayName, version }) runs plugin create (tools/plugin/cli.ts) into a temporary folder, writes the test plugin’s manifest and sources over the scaffold, lends it the engine’s node_modules (a symlink, for tsc and esbuild) and runs plugin pack, which type-checks, bundles, validates and npm packs it. One build takes a few seconds. The plugin declares storage, realtime, scheduler and notify:in-app, registers the hourly no-op job heartbeat, has text, json (with a schema) and list settings, serves GET /info, POST /to-me (realtime.toUser for the caller) and POST /broadcast, answers realtime.on('ping') with a pong to the sender, and fills lobby.sidebar with a panel (e2e-plugin-fill-<providerType>) that shows its version and lists what it receives on engine.socket.for(providerType) (e2e-plugin-event-<kind>).
The admin API helpers take an ApiClient signed in as a super admin: uploadPlugin, activatePlugin(api, id, grant), installAndActivate (upload, then activate granting every declared capability), deactivatePlugin, upgradePlugin, deletePlugin, removePlugin (best-effort cleanup by providerType), findPlugin (the admin row, with declared and granted capabilities), getPluginJobs, getPluginSettings and savePluginSettings. In the browser, callPluginRoute and emitPluginEvent go through engine.http and engine.socket on the page, and markDocument/sameDocument prove that a change arrived without a reload.
Every spec gives its plugin a unique providerType starting with e2e- (and a unique display name: Plugin.name is unique), creates its own super admin and players with ensureAdmin/ensurePlayer and removes them, the plugin and its build folder afterwards. An uploaded plugin is installed where the product installs uploads, plugins/<providerType>/ in the checkout; .gitignore ignores plugins/e2e-*/, and the e2e seed deletes those folders and every e2e-* plugin row (settings, jobs, storage) before the server starts, so a run that was cut short never leaves a plugin behind for auto-discovery.
External sign-in
e2e/specs/auth/external-*.spec.ts drive the core external sign-in (plugin API 1.4: docs/developer/plugins/auth-providers.md) through the real UI. The identity provider is the mock OIDC provider (e2e/support/mock-oidc/, started by Playwright global setup on E2E_MOCK_OIDC_PORT, default 4455) and the login providers are mock-oidc and mock-credential, registered by the repository-only plugins/test-auth-provider (configured through the admin API by e2e/support/test-auth-provider.ts). Never a real provider. The shared helpers are in e2e/support/external-auth.ts (accounts, the provider picker, enableExternalAuth) and e2e/support/external-auth-api.ts (the start → provider → callback → exchange flow at the API, for wire-level checks).
What the environment has to provide, all already set by e2e/config/env.ts and the helpers:
EXTERNAL_AUTH_ALLOW_INSECURE_ISSUERS=1on the e2e API server: the mock provider is plain http on127.0.0.1, which the engine’s outbound rules accept only with this override and never in production.- The Site URL setting is the web origin. Core builds the provider callback URL from it (default
http://localhost:3000), soenableExternalAuthsets it toE2E_WEB_URLanddisableExternalAuthputs the previous value back. - A client IP of its own for every test (
testfromexternal-auth.ts, which setsX-Forwarded-For): the e2e server trusts one proxy hop and the preview proxy forwards the header. Registration, and with itcomplete-signup, is limited to 3 per hour per IP, a budgetregister.spec.tsalso draws on; start, exchange and credential are limited per minute. A per-test address gives each test its own budget without changing a product limit. - An admin of its own per spec (
adminApi): admin writes are limited to 20 per minute per admin and the specs write plugin settings often.
The binding cookie is __Host-pe_auth_flow (Secure, Path=/, no Domain) under NODE_ENV=test, as in production; only plain http development (NODE_ENV=development) uses the unprefixed pe_auth_flow, and the server reads only the current mode’s name. Follow-up tickets (complete-signup, link, re-auth) each get their own cookie, __Host-pe_auth_ft_<hash prefix>, under the same rules. Chromium stores and sends it on http://localhost (a secure context), which external-negative.spec.ts checks. The bundled-theme spec builds riverhouse and neo from themes-src/ with the theme CLI (build, then pack), uploads and activates them, and removes them afterwards; in each theme it also renews a stored player session the way the automatic renewal does.
Fixture recorder
npm run fixtures:record (scripts/fixtures/record-table-session.ts) replays a live Socket.IO standards scenario in-process (src/game/verification/live-socket-standards.ts: Prisma tables, rigged decks, real socket players) and writes the recorded session, with every table_state, the thirteen standards events, the action trace and the engine snapshots, to e2e/fixtures/table-sessions/<variant>.session.json. These fixtures are the input for the table-rendering harness, and the visual spec replays texas_holdem.session.json for the standard-table and spectator screenshots (see "Visual baselines"). Re-recording that fixture changes the hand those screenshots show, so recapture their baselines in the same pull request. It needs DATABASE_URL for a disposable database, for example the e2e one:
DATABASE_URL="postgresql://postgres:postgres@127.0.0.1:54329/poker_engine_e2e?schema=public" npm run fixtures:record -- --variant TEXAS_HOLDEM
CI
npm run ci:local has three browser and gameplay jobs (see CI/CD and Releases):
e2e(scripts/ci/jobs/e2e.sh): the whole suite inside the pinned Playwright image with a PostgreSQL sidecar, followed by the certification harness (e2e/harness/) on its own fresh database: the standard layout and thesample-tabletheme layout must certify, the broken test layouts must fail, and each record’s results digest (geometry findings by verdict, not by pixel) must equal the value pinned in the job. The report, traces of failed tests, Lighthouse reports and the certification records land in.ci/runs/<id>/e2e/.gameplay(scripts/ci/jobs/gameplay.sh): starts the same seeded stack on the product’s development ports and runsnpm run gameplay:verify. A red run fails local CI like the suite does.felthouse(scripts/ci/jobs/felthouse.sh):npm run e2e:felthousein the same pinned image on a fresh database, then the Felthouse layout’s certification (npx playwright test -c e2e/harness/playwright.config.ts felthouse) on another, which must produce an ok record (thee2ejob’s harness run leaves this layout out). No visual baselines. Reports, traces and the record land in.ci/runs/<id>/felthouse/. Skipped wherethemes-src/felthouseis absent (source distributions);npm run ci:local -- --only felthouseruns it on its own.
To repeat the suite as a flake check: npm run e2e:docker -- --runs 5.