Skip to content

test(e2e): point the auth setup project at the file it was meant to run - #574

Merged
thinkclay merged 1 commit into
mainfrom
claude/e2e-office
Aug 12, 2026
Merged

thinkclay merged 1 commit into
mainfrom
claude/e2e-office

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Partly addresses #553. Does not close it — see the two blockers below.

The fix

The setup project declared testDir: "./tests/e2e", but auth.setup.ts lives under tests/infrastructure/playwright/setup/. It therefore selected nothing, tests/.auth/*.json was never produced, and every spec doing test.use({ storageState: "tests/.auth/super-admin.json" }) would fail at startup on a fresh checkout.

It failed silently — a Playwright project matching no files is not an error, which is why this went unnoticed.

before: planning 0 tests across 0 files
after:  planning 3 tests across 1 files

Verified by running it, not just listing: the project now executes and writes tests/.auth/super-admin.json and tests/.auth/user.json.

Deliberately not adding office specs to testMatch yet

#553 sequences this as "fix the setup project, then add specs to testMatch one at a time, confirming each is green." I did step 1 and then checked step 2 — the kanban spec is not green.

Running it against a live dev server with super-admin.json, all 20 tests fail at the same point: the page is the public marketing page, not /office/applications. The auth state does not get past the app's gates. The admin setup fails the same way for the same reason:

Expected pattern: /dashboard/
Received string:  "http://localhost:8081/onboarding"

No seeded user is past the onboarding gate, and there is a legal-acceptance gate behind that. Adding the spec to testMatch now would ship a known-red selection, which is the thing this issue exists to stop.

Two things that need a decision

1. The office specs are not where CI looks. e2e-nightly.yml runs cd apps/scaffald && pnpm test:e2e, which uses apps/scaffald/tests/e2e/playwright.config.ts — covering 2 specs (auth, navigation). The office specs, and 65 others, live in repo-root tests/e2e/. So the root config's testMatch allow-list that #553 describes is not what CI runs at all: 65 of 67 e2e specs are outside CI's config entirely. Whether repo-root tests/e2e/ belongs in CI is the decision the issue flagged, and it is bigger than an allow-list entry.

2. Seeded users cannot reach protected routes. Until a seeded user is past onboarding + legal acceptance, no office spec can pass regardless of configuration. That is its own piece of work.

Also worth knowing

e2e-nightly.yml last ran 2026-08-11 and failed; the four runs before that were skipped. So the 2 specs CI does cover are not passing either.

Partly addresses #553. The `setup` project declared
`testDir: "./tests/e2e"` while auth.setup.ts lives under
tests/infrastructure/playwright/setup/. It therefore selected nothing and
tests/.auth/*.json was never produced, so every spec doing
`test.use({ storageState: "tests/.auth/super-admin.json" })` would fail at
startup on a fresh checkout.

It failed silently: a Playwright project matching no files is not an error,
which is why this went unnoticed.

  before: planning 0 tests across 0 files
  after:  planning 3 tests across 1 files

Verified by running it: the project now executes and writes
tests/.auth/super-admin.json and tests/.auth/user.json.

Deliberately NOT adding office specs to `testMatch` yet. #553 sequences
this as "fix the setup project, then add specs one at a time, confirming
each is green", and the kanban spec is not green: authenticated via
super-admin.json it still lands on the public marketing page, because no
seeded user is past the onboarding and legal-acceptance gates. The admin
setup fails the same way — it reaches /onboarding and never /dashboard.
Adding the spec now would ship a known-red selection.
@thinkclay
thinkclay merged commit 1ad0a67 into main Aug 12, 2026
6 of 7 checks passed
@thinkclay
thinkclay deleted the claude/e2e-office branch August 12, 2026 00:28
thinkclay added a commit that referenced this pull request Sep 2, 2026
playwright.config.ts recorded, as the reason not to add the office specs, that
ApplicationsKanbanBoard "renders no testID, data-testid or nativeID at all".
It does. Traced end to end:

  StatusColumn        <DroppableColumn id={status}>
  DroppableColumn     <KanbanColumn id={id}>
  @scaffald/ui        testID={`kanban-column-${id}`}
  react-native-web    domProps['data-testid'] = testID
                      (createDOMProps/index.js:836)

kanban-helpers.ts tries three selectors, and only the first two — [data-column]
and [data-status] — miss. The third, getByTestId(`kanban-column-${column}`),
resolves. The ids line up as well: KANBAN_COLUMNS is
new/screen/interview/offer/hired/rejected, every one of them in the board's
STATUSES. And test-office-jobs-kanban.spec.ts already selects
[data-testid="kanban-column-${status}"] directly against the same component.

Left as a comment rather than acted on, because what remains is not a code fix
but a verified green run, and that needs the full local stack — Supabase, the
api function, a warm dev server, seeded users past onboarding. Adding the spec
without that is still a known-unknown selection, which is the thing this file
warns against.

`npx playwright test --list` plans 103 tests across 10 files, up from the 100
in 9 the issue recorded — #574's setup fix now resolves.

Refs #553

Co-Authored-By: Claude Opus 5 <[email protected]>
thinkclay added a commit that referenced this pull request Sep 2, 2026
…one broken magic link (#710)

* test(harness): the Deno suite is not flaky — it is 132 failures from one broken magic link

**#478 says the suite moves by about ±2 run to run. It does not.** Three
consecutive runs against the same database, no changes between them:

    205 passed | 185 failed  (51s)
    205 passed | 185 failed  (46s)
    205 passed | 185 failed  (48s)

and the sets of failing test *names* are byte-identical across all three — zero
in run 1 not in run 3, zero in run 3 not in run 1. Whatever produced the ±2 in
March is gone; determinism is not what is wrong with this suite now.

What is wrong is that 132 of the 185 are one root cause wearing 132 costumes:

    101x  Auth setup is incomplete. Run auth.test.ts first.
     31x  Failed to get or create auth token

Following it down: those suites call requireAuthSetup(), which reads
tests/fixtures/tokens.json, which only auth.test.ts writes — and auth.test.ts
fails first, so the file does not exist on a fresh checkout. It fails because
the magic link it is sent is unparseable:

    TypeError: Invalid URL: 'env%28EXPO_PUBLIC_URL%29/auth/confirm?token_hash=...'

config.toml:52 sets `site_url = "env(EXPO_PUBLIC_URL)"`, and the CLI never
substituted it — the running container has `GOTRUE_SITE_URL=env(EXPO_PUBLIC_URL)`
literally. `pnpm supa` loads .env via dotenv, and EXPO_PUBLIC_URL is defined
only in .env.template. So every magic link GoTrue mints is built on a
placeholder, and the whole suite falls over behind it.

Three fixes here, in increasing order of how much they matter:

**The credentials did not match the seed.** TEST_USERS.regular said
'testpassword123'; seeds/002a creates [email protected] with 'test123456'.
Measured against the running stack: the seeded password returns 200 from
/auth/v1/token, the constant here returned 400. Aligned to the seed, which is
the source of truth for local users. Worth 15 tests on its own — 185 failures
to 170.

**TEST_USERS.admin was never created by anything.** No [email protected] in
auth.users at all. New seed 002b, mirroring 002a. Deliberately an ordinary
confirmed user rather than an elevated one: the suites use it as a *second
distinct identity* — office.test.ts guards on
`tokens.admin.token !== tokens.regular.token` — not for platform privileges. If
some test does need elevation it will now fail on authorization, which is a
true failure about the thing under test rather than a setup cascade.

**The placeholder now announces itself.** completeMagicLinkAuth() checks for a
literal `env(` before `new URL()` and explains exactly what is unset and that
the stack must be restarted, instead of throwing a TypeError that reappears
132 times as "Auth setup is incomplete".

The suite still cannot pass here, because this stack is running with the bad
site_url and restarting it is not mine to do. But the next person gets one
sentence naming the cause instead of 132 failures pointing at unrelated code.

Also #680: a smoke that cannot reach the dev server now exits 97, not 1.

The Expo dev server OOMs partway through a back-to-back smoke run; everything
after fails with ERR_CONNECTION_REFUSED and reported as an assertion failure.
One observed run reported three failures that were all the dead server — and
all three passed individually against a fresh one. A gate that fails for
environmental reasons is worse than no gate, because the natural response,
re-run and see, is exactly how a real failure gets waved through.

scripts/audit/lib/dev-server.mjs adds a preflight and a finish() that every
smoke now exits through. A preflight alone would not be enough — the server
dies *during* the run and the scripts tally page errors internally — so
finish() re-checks the server at the moment it is about to report failure, and
turns "the app is broken" into "the harness lost its server, exit 97". Verified
against a dead port: exit code 97, and the output says nothing was asserted.

This is the honest half of #680. The growth itself is not diagnosed here.

Refs #478
Refs #680

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(e2e): correct the kanban selector claim that was blocking #553

playwright.config.ts recorded, as the reason not to add the office specs, that
ApplicationsKanbanBoard "renders no testID, data-testid or nativeID at all".
It does. Traced end to end:

  StatusColumn        <DroppableColumn id={status}>
  DroppableColumn     <KanbanColumn id={id}>
  @scaffald/ui        testID={`kanban-column-${id}`}
  react-native-web    domProps['data-testid'] = testID
                      (createDOMProps/index.js:836)

kanban-helpers.ts tries three selectors, and only the first two — [data-column]
and [data-status] — miss. The third, getByTestId(`kanban-column-${column}`),
resolves. The ids line up as well: KANBAN_COLUMNS is
new/screen/interview/offer/hired/rejected, every one of them in the board's
STATUSES. And test-office-jobs-kanban.spec.ts already selects
[data-testid="kanban-column-${status}"] directly against the same component.

Left as a comment rather than acted on, because what remains is not a code fix
but a verified green run, and that needs the full local stack — Supabase, the
api function, a warm dev server, seeded users past onboarding. Adding the spec
without that is still a known-unknown selection, which is the thing this file
warns against.

`npx playwright test --list` plans 103 tests across 10 files, up from the 100
in 9 the issue recorded — #574's setup fix now resolves.

Refs #553

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant