The root CI workflow runs for every pull request.
It installs the pinned pnpm workspace, runs lint and type checks, builds both apps, and runs the API Jest suite and the frontend unit tests.
Pull requests currently skip the browser tests.
The workflow is meant to install the Playwright browsers and run pnpm test on pull requests, but its condition inputs.browser-tests != false is false when there is no input, as on a pull request, so those two steps are skipped.
The same happens on a manual run of the workflow.
This is a known bug that has not been fixed (noted 2026-11-30).
CI checks formatting, vets, builds and tests apps/worker in the same job, in every run, the deploy workflows included (worker tests).
Superseded: this said that CI did not build or check the worker.
CI restores the local Turborepo cache (.turbo/cache), so lint, type-check and build results of an unchanged app are replayed.
The test task is never cached: the suites depend on a database, and the web browser tests also run the API's code (2026-11-30).
The four deploy workflows (api-production, api-production-dev, web-prodtest, web-production-dev) call the same workflow with browser-tests: false (since 2026-11-19).
They lint, type-check and build, then run only the API Jest suite and the frontend unit tests, and skip the Playwright install and browser suite, which took about 25 minutes of a 27 minute deploy.
Superseded, 2026-11-30: this section said that pull requests still run the full suite; see the condition bug above.
The PR preview workflow web-prtests was removed on 2026-11-29 (security).
The workflow uses the pull_request event, read-only repository permissions, and no repository secrets, so fork contributions can run the same checks safely.
The GitHub ruleset for main requires the validate check for pull requests and requires one approval with review threads resolved.
Tamal's account is the only bypass actor, so he can push directly to main.
apps/web has two kinds of automated tests. A Playwright E2E suite (apps/web/e2e/), added September 2026, replaced an earlier Cypress setup (cypress/e2e/smoke.spec.js, organizationSetup.spec.js) that existed but was never actually wired into CI. Vitest unit tests for pure functions were added in November 2026 (see "Unit tests (Vitest)" below). There is still no component or hook test runner for this app - see "What this doesn't cover" below.
This suite is deliberately full-stack: a real browser (via Playwright) drives a real, running apps/web dev server, which itself makes real HTTP requests to a real, running apps/api instance — nothing here is mocked, except email delivery (see "The password-reset outbox" below). apps/api has its own, separate Jest+Supertest suite for API-level coverage; see apps/api/docs/specs/testing.md for that side. Running pnpm test from the repo root runs both suites, via Turborepo, at the same time — that's what "test the API and the UI at once" means in this repo.
apps/web/e2e/ is organized feature-first, mirroring apps/web/src/features/<name>/ — the same convention docs/specs/README.md describes for the app itself. Each feature folder under e2e/ has its own README.md naming exactly what it covers, what it deliberately doesn't, and why:
| Folder | Feature | Coverage doc |
|---|---|---|
e2e/authentication/ |
Sign up, sign in, forgot/reset password, the route guard | README |
e2e/landing-home/ |
The marketing home page, hero CTA, footer newsletter | README |
e2e/onboarding-profile/ |
Individual editor navigation/save/exit and retired profile URLs; browser specs updated but not rerun for removal | README |
e2e/organizations/ |
The organization signup→draft→live setup wizard, responsive layout of the directory and public profile, and the directory's endless scroll | README |
e2e/events/ |
Public event directory filtering and responsive layout, organizer publishing, the attendee journey, online-event publishing, and editing and cancelling an event, leaving, capacity, the attendee list and the optional details (on 2026-11-23 the folder (then 50 tests) ran on Chromium, Firefox and WebKit, 13 of the 150 results failed (a real My Events label bug and three stale test expectations), and after the fixes every one passed). on 2026-11-29 the whole folder, including event-create-stepper.spec.ts, passed 273 of 273 on the three browsers |
README |
e2e/smoke.spec.ts stays at the top level — it's cross-cutting infrastructure (backend reachability, basic nav) rather than any one feature's own behavior. e2e/env.ts and e2e/global-setup.ts are shared plumbing, not tests.
Before adding coverage for a feature, check whether it already has a folder here and read that folder's README.md first — it documents what's already covered, what's deliberately skipped and why (often because the underlying app code is unreachable/dead, not because testing it was skipped), and any test-data gotchas specific to that feature. A feature with no folder yet (dashboard, donations/payments) has no E2E coverage at all — see "What this doesn't cover".
Cypress runs inside the browser, which makes cross-origin flows (this app's Google OAuth popup — see authentication.md) and multi-tab scenarios structurally awkward. Playwright drives the browser from outside via CDP, so cross-origin and multi-tab both work naturally, it runs Chromium/Firefox/WebKit from one API (all three run by default here — see playwright.config.ts's projects), and it has a native API-request context so the same test runner can also hit REST endpoints directly with no browser involved (e2e/smoke.spec.ts's "Backend reachability" tests, and every feature folder's API-seeding helpers, do exactly this).
A developer's normal pnpm dev runs the web app on port 3000 and the API on port 5050, against whatever development database is configured (see AGENTS.md / the memory note on local dev startup). The Playwright suite must never collide with, or read/write, that real session - so it uses entirely separate, dedicated infrastructure:
| Local dev | Playwright e2e | |
|---|---|---|
| Web port | 3000 | 3001 |
| API port | 5050 | 5051 |
| Database | karmacircle_dev |
karmacircle_e2e, emptied each run |
| Outgoing email | an in-memory development outbox, never a real send | an in-memory test outbox, never a real send |
apps/web/e2e/env.tsis the single source of truth for the two e2e ports — imported byplaywright.config.ts,global-setup.ts, and every spec file that needs to call the API directly.apps/web/playwright.config.ts'swebServerarray starts both servers itself before any test runs, and tears them down after (locally,reuseExistingServer: truekeeps them warm across repeatedpnpm testruns in the same session) - a clean checkout needs a running local PostgreSQL server, and beyond that onlypnpm install --frozen-lockfileandnpx playwright install.- The API entry runs
apps/api/tests/e2e/server.ts- a real, listening instance of the API backed by its own PostgreSQL database, distinct from how Jest drives the samecreateApp()in-process with nothing listening. Seeapps/api's own testing spec for that file's details, including the test-onlyPOST /__test__/resetroute it exposes. Since November 2026 that server is an outer Express app that mountstests/e2e/test-routes.tsin front ofcreateApp(). It adds one E2E-only route,POST /__test__/events/:uid/backdate(body{ daysAgo }, a positive number, default 1), which moves an event into the past:startTimebecomesdaysAgodays before now,endTimetwo hours later, andstartDate/endDatethe matching UTC day starts. It returns204,400for a baddaysAgo, or404for an unknown uid, and leaves registrations untouched. It exists because the API refuses to create a past event and refuses to join one that has started, so browser tests publish a future event, optionally join it, then backdate it. It exists only on the isolated E2E server (port 5051), never in the real app. - The web entry runs
vite --port 3001 --strictPortwithVITE_API_URLoverridden to the e2e API's URL, so the dev server built for this run points at the isolated API, not local dev's 5050. - Both commands run via
npx <bin>with an explicitcwd, notpnpm --filter/pnpm exec— pnpm itself isn't guaranteed to be onPATHin every environment (this repo's local dev has the same gap; pnpm is invoked vianpx pnpm@<version>when it isn't installed globally).npxresolves each package's own local devDependency bin from its ownnode_modules/.binregardless of what's onPATH.
- The API entry runs
apps/web/e2e/global-setup.tsruns once, after the servers are up and before any test, andPOSTs the e2e API's/__test__/reset— guaranteeing the suite starts from an empty database every run.
apps/api/src/config/mailer.ts never calls Resend unless NODE_ENV==="production".
Development and test capture reset links in an in-memory outbox, readable through loopback-only GET /__dev__/last-reset-url?email=... locally or GET /__test__/last-reset-url?email=... in the isolated e2e server.
This lets e2e/authentication/password-reset.spec.ts complete a real forgot→reset→sign-in-with-the-new-password round trip without a real mail provider.
See apps/api's testing spec and that spec file's own comments for the details.
Playwright runs spec files in parallel across workers by default (fullyParallel: true). A mid-suite database reset would race whichever other file's tests are running concurrently, so there isn't one. Instead, every spec generates its own unique data — almost always a Date.now()-based suffix on emails/names (see any feature folder's uniqueEmail() helper) — the same isolation pattern the Cypress specs this suite replaced already used, kept because it's still the right approach under Playwright's parallelism.
Added November 2026 for pure functions (no DOM, no components). Vitest ^5.1.0 is an apps/web devDependency; the config is apps/web/vitest.config.mjs, deliberately separate from vite.config.mjs (no PWA, SVGR, React or Tailwind plugins) and from playwright.config.ts. It includes only src/**/*.test.ts (tests sit next to the helper they test) and excludes e2e/**, so neither runner can pick up the other's files. The environment is node, and the config pins TZ=UTC and LC_ALL/LANG=en_US.UTF-8 so date and currency assertions are deterministic on every machine and in CI. Its path aliases mirror vite.config.mjs and tsconfig.json; keep all three in sync when an alias is added.
pnpm test:unit(vitest run) - run once.pnpm test:unit:watch- watch mode.- The
testscript is nowvitest run && playwright test, sopnpm testfromapps/weband rootpnpm test(Turborepo) run the unit tests before Playwright. CI currently runstest:uniton its own, without Playwright (see Continuous integration). - Last run, 2026-11-23: 17 test files passed, 244 tests passed and no todo (the
formatDurationandfundedPercentbad-input cases are now real tests), addingcalendarLinks.test.ts(6) and removinggetFormattedDate.test.tswith the unused code it covered. Earlier run, 2026-11-16: 13 test files passed, 196 tests passed and 2 todo (198 total), addingeventMode.test.ts,eventTags.test.ts,eventTimezone.test.ts,richText.test.ts,components/RichText.test.tsandconstants/eventTypes.test.tsto the files below (RichText.test.tsrenders withreact-dom/server, so it needs no DOM). Before those, 7 files and 121 tests. The files areformatEventFacts.test.ts(includingformatSpotsLeft),toDisplayEvent.test.ts(which also covers the cancelled mapping and the capacity counts),eventToFormState.test.ts,buildEventChanges.test.tsandeventDetailFields.test.tsundersrc/features/events/utils/, andsrc/utils/formatMoney.test.ts. - Added 2026-11-26:
validateEvent.test.ts,joinLinkNote.test.tsandmyEvents.test.tsundersrc/features/events/utils/, andsrc/features/authentication/utils/returnPath.test.ts. - Not covered: components and hooks.
Superseded:
convertToBase64was listed here; the helper has been deleted.
From apps/web, or from the repo root with --filter karmacircle-frontend:
pnpm test- runs the Vitest unit tests, then Playwright headless on all configured browser projects.pnpm test:ui— Playwright's interactive UI mode (time-travel through a run, pick a single test).pnpm test:headed— headed (visible) browser windows.pnpm test:report— reopen the last run's HTML report.CAPTURE_TOUR=1 pnpm test— also saves numbered screenshots of the organization-setup journey intotest-results/tour/.npx playwright test e2e/<folder>/— run just one feature's spec files.
From the repo root, plain pnpm test runs this suite and apps/api's Jest suite together (Turborepo runs each workspace's own test script; neither depends on the other, so they run concurrently).
CI does not currently run the Playwright suite (see Continuous integration), so run it locally. No Playwright run is recorded since the move to PostgreSQL.
Real, current app behavior the suite had to be written against — not aspirational — plus a handful of genuine bugs and stale-doc corrections the suite surfaced along the way (see each feature folder's own README.md and known-issues.md for the full writeups):
- Playwright's
getByRolerespects real ARIA semantics; Cypress'scy.contains("button", …)didn't. The signup flow's account-type switch is arole="tab"pair (a deliberate design choice — seeAuth.tsx), notrole="button", even though it's a<button>element. - Playwright is strict about ambiguous matches; Cypress silently took the first one.
getByText(...)throws if more than one element matches — several assertions need.first(),{ exact: true }, or a role-scoped locator where Cypress'scy.contains()would have quietly picked an element and moved on. Watch for this especially with short/common words ("Live" collides with the setup page's rotating testimonial quote; "Profile" collides with the account-menu's own "Your Profile" link). - Client (Redux/
localStorage) state only changes through the app's own actions. Seeding an account directly against the e2e API sets up a database record but touches no client state. A test that needsisLoggedIntrue has to go through the real signup/signin UI at least once. OrganizationSetup.tsx's Continue button reports as unavailable viaaria-disabled, not the nativedisabledattribute, whenever a required question is blank —toBeDisabled/toBeEnabledtreat the two the same (both resolve through Playwright's owngetAriaDisabled), but onlyaria-disabledleaves the element clickable, so a press while blocked still reaches theonSubmitguard and shows the redsetup-required-notemessage rather than doing nothing. A genuinely in-flight save (saving) still uses the native attribute. Exercising the clickable-while-blocked path needs.click({ force: true })— Playwright's own actionability check refuses a plain.click()on anythingaria-disabled.- A live organization never sees the setup questions -
OrganizationSetup.tsxrenders the profile editor once the record is live, andorganization-setup.spec.tsasserts that. Superseded: this entry saidback()from the first question was a silent no-op for a live organization. - Saving the second setup step switches the page to the editor. An organization goes live once
about/reach's required fields are saved, and the optionalpresencestep (the support toggle) is then never shown, so a test should expect the "Edit organization" heading rather than a redirect to the public profile. Superseded: this entry said the wizard kept going through apresencestep of logo, socials, address, leadership and sponsorship questions. /organizations' search field can render a live-suggestions dropdown (DirectoryToolbar'sCombobox) with an option matching the same text as a result card — a plaingetByText(name, { exact: true })after typing into the search field is a strict-mode violation between the two; scope to the card's ownh2(getByRole("heading", { level: 2, name })) instead.- The retired
/user/:userNameroute remains covered as a not-found case. The active individual editor is/user/setup; the E2E coverage documents both the removed route and the current editor flow ine2e/onboarding-profile/README.md. - Use
pressSequentially, notfill, for autocomplete-style fields (the organization setup city field). The suggestion dropdown is driven by real keystroke events;fill()sets the value in one shot and never triggers it. Plain text fields (name, description, email, etc.) work fine withfill().
- No component or hook-level tests exist for
apps/web. Vitest covers pure helpers only (see "Unit tests (Vitest)"); components and hooks have no existing pattern to follow, and would need a DOM environment (jsdom or happy-dom) first. - Feature folders with no E2E coverage at all yet:
dashboard,donate-shop-trending(payments). The products module was removed on 2026-12-02. The Events feature has directory, publishing, attendee-journey, edit and cancel coverage (see the Events README). See each feature's own summary spec (docs/specs/<feature>.md) before writing tests for one of these - several have the same "less is actually reachable than the docs used to claim" texture theauthentication/onboarding-profilework above surfaced. - Google OAuth sign-in isn't covered anywhere — it needs a real (or mocked) Google consent screen, which this suite doesn't attempt.
- Animation/motion is not asserted on anywhere in this suite (see
landing-home/README.md). Responsive layout is checked in places, by specs that set their own viewport size (for exampleevents-responsive.spec.ts,organizations-responsive.spec.tsandnavbar-menus.spec.ts); the three configured projects are desktop browsers, and this repo has no visual-snapshot tooling. Superseded, 2026-11-30: this said responsive breakpoints were asserted on nowhere.
If you add a new feature folder under e2e/, add it to the table above (and give the folder its own README.md, matching the existing ones' shape: a file table, test-data notes, what's not covered and why, a "keeping this honest" note). If you change the dedicated ports, the reset strategy, the outbox, or the browser projects, update this file and apps/api/docs/specs/testing.md together — they describe two ends of one integration. If you fix one of the "known sharp edges" items above, remove it from here (and from wherever else it's documented) in the same change.