You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test(e2e): fake-user passwords, defensive afterAll, trim timer-dependent token-cache tests
Three small E2E reliability fixes uncovered while investigating
consistent CI failures across multiple suites.
1. Strong random fake-user passwords. createFakeUser built passwords
as `${email}${randomHash}`, which FAPI's compromised-password check
rejected with `form_password_compromised` (HTTP 422). Replaced with
a `fakerPassword()` helper that emits a high-entropy base64url
string with a fixed `Aa1!` prefix to satisfy default Clerk password
complexity rules.
2. Defensive afterAll cleanup. When a suite's beforeAll timed out or
threw, afterAll crashed with a TypeError on un-assigned fakeUser /
fakeOrganization / network / fakeOAuth / fakeAPIKey, masking the
real failure. Optional-chained the cleanup calls in:
- integration/tests/components.test.ts
- integration/testUtils/machineAuthHelpers.ts (apiKey, m2m, oauth)
3. Drop timer-dependent token-cache assertions. Two MemoryTokenCache
cross-tab tests assumed JWT TTL = 60s and waited 50s of wall-clock
time for the proactive-refresh setTimeout to fire. The dev test
instance now issues 300s tokens, so the timer fires at ~283s and
the tests never reached it.
- Deleted `multi-tab scheduled refreshes are deduped to a single
request` from single-session.test.ts. The same broadcast-dedup
path is exercised by the existing line-49 test via
`getToken({ skipCache: true })`.
- Rewrote multi-session.test.ts:249 (now `cross-session token
refreshes do not deduplicate`) to manually trigger
`getToken({ skipCache: true })` on each tab. Different sessions
have different tokenIds, so BroadcastChannel does NOT deduplicate
across them — unique coverage the single-session test doesn't
provide.
Proactive-refresh timer scheduling math is best validated by unit
tests that mock setTimeout, not by real-time integration tests
against a shared dev instance.
Scoped to integration/ only, no published package affected — empty
changeset.
0 commit comments