Skip to content

test(cypress): consolidate component test suite - #105

Open
yahyafakhroji wants to merge 5 commits into
mainfrom
chore/consolidate-cypress-tests
Open

test(cypress): consolidate component test suite#105
yahyafakhroji wants to merge 5 commits into
mainfrom
chore/consolidate-cypress-tests

Conversation

@yahyafakhroji

@yahyafakhroji yahyafakhroji commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Consolidates the Cypress component test suite by merging single-assertion tests
into table-driven ones. Fewer reported tests, same coverage.

  • Related tests become table rows, each labelled so a failure names the case.
  • A few exact duplicates removed, each verified to repeat another test's call
    and expectation.
  • Some specs folded into siblings covering the same production module.
  • Titles name the primary behaviour; specifics live in the row labels.

Security-relevant guards stay standalone so they fail in isolation: returnTo and
same-origin redirect validation, passkey management, session-ownership gates,
MFA lockout and escape-hatch routing, IdP link ownership, the OIDC silent-auth
gate, and input-validation rejections.

No production or test-harness code is touched.

Test plan

  • Component suite, typecheck, lint, build all green
  • CI green

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Summary

Job Status
E2E (fast, fake provider) ✅ success
Unit Tests (component) (0) ✅ success
Unit Tests (component) (1) ✅ success
Unit Tests (component) (2) ✅ success

View workflow run

yahyafakhroji

This comment was marked as outdated.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Summary

Job Status
E2E (fast, fake provider) ✅ success
Unit Tests (component) (0) ✅ success
Unit Tests (component) (1) ✅ success
Unit Tests (component) (2) ✅ success

View workflow run

@yahyafakhroji
yahyafakhroji force-pushed the chore/consolidate-cypress-tests branch from b2f70e7 to 8b8968c Compare July 28, 2026 10:41
@yahyafakhroji yahyafakhroji changed the title test(cypress): consolidate component suite 678 → 518 tests (no coverage lost) test(cypress): consolidate component test suite Jul 28, 2026
@yahyafakhroji yahyafakhroji self-assigned this Jul 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Summary

Job Status
E2E (fast, fake provider) ✅ success
Unit Tests (component) (0) ✅ success
Unit Tests (component) (1) ✅ success
Unit Tests (component) (2) ✅ success

View workflow run

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Summary

Job Status
E2E (fast, fake provider) ✅ success
Unit Tests (component) (0) ✅ success
Unit Tests (component) (1) ✅ success
Unit Tests (component) (2) ✅ success

View workflow run

mattdjenkinson
mattdjenkinson previously approved these changes Jul 31, 2026
Merge single-assertion tests into table-driven ones across routes,
components, modules, and resources. Assertions are preserved; a few exact
duplicates were removed after verifying each one repeats another test's
call and expectation.

Each row carries a label so a failure names the case that broke.
Security-relevant guards remain standalone tests rather than table rows.

A few specs were folded into siblings already covering the same production
module, and a type-only spec was renamed out of the spec glob while staying
type-checked.
Titles name the primary behaviour; per-row labels carry the specifics.

Also restores one outcome table to its own test rather than a helper called
from a sibling — assertions living in a plain function are only as alive as
their call site.
Applies the same treatment to the specs that arrived with the usernameless
passkey work.

- passkey-discover: the five user-dependent failures become one table. They
  all assert the identical opaque 400, which IS the enumeration-parity
  contract — as separate tests it reads as coincidence rather than intent.
  Operator-facing audit reasons stay asserted per row.
- discovery-loader and conditional-passkey-loader: the suppression lists
  become arming tables, each including the stale-entry row that must NOT
  suppress, so a row flipping state is the whole regression signal.
- conditional-passkey-loader: the two hint-cookie cases are paired, since
  they suppress alike but treat the cookie oppositely — a hint naming a
  missing user is cleared, one naming a passkey-less user survives.
- use-conditional-passkey-discovery: drops a test whose assertions the
  abort test already makes on an identical mount.

Left standalone: the crafted-POST supersede guard and the INVALID_INPUT
schema boundary in passkey-discover, and the cross-organization stale-entry
regression guard in conditional-passkey-loader.
Applies the merges surviving an adversarial audit: each candidate was
proposed, then independently challenged by a refutation pass and a
security pass, and kept only if neither objected. Four proposals were
rejected — mostly ones that would have faked shape-identity by quietly
adding or dropping an assertion.

Covers the passkey loaders and discovery action, the auth-action hooks,
brand-logo, back-link, webauthn ceremony errors, a11y guard, accounts-row,
signup default-org, setup guard, login-view, sso-callback, zitadel index
and authorize logout.

One deletion: conditional-passkey-loader's hintless baseline made a
byte-identical call to discovery-loader's first test and asserted the same
thing, which that test still asserts.

Left standalone throughout: named regression guards, distinct attacks
(crafted POST, enumeration, identity takeover, CSRF), the anti-forgery
freshness gate, and any test asserting a different error contract than its
neighbours.
Second audit pass over every remaining spec with two or more tests. Seven
merges applied; each was proposed, then independently challenged on both
correctness and security grounds, and kept only if neither objected.

Covers env, legacy redirects, path builders, the SSO provider-error link,
auth error messages and codes, and CSP frame-ancestors parsing.

Left standalone: the device-code regression guard, the tamper-echo/XSS
invariant on the error catalog, the catalog closure property, and the
wildcard clickjacking footgun in frame-ancestors.

Not applied: the sudo freshness merge, which an earlier survey marked
do-not-touch as a re-auth boundary. The proposal was sound — it orders
accept rows before reject rows so a fail-open regression cannot be masked
— but it buys one test on a security gate, so the earlier decision stands.

Also not applied: an accounts-loader-action merge proposed by the first
audit. The second pass caught that those tests sit under a banner citing
issue #99, making them a named regression guard.
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Summary

Job Status
E2E (fast, fake provider) ✅ success
Unit Tests (component) (0) ✅ success
Unit Tests (component) (1) ✅ success
Unit Tests (component) (2) ✅ success

View workflow run

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.

2 participants