What my fake login could not tell me about a real browser login
My browser tests could pretend a user was signed in while skipping the provider context the page needed to render.
The failure became visible when the header used Clerk’s UserButton. The old test path could bypass ClerkProvider, leaving a provider-dependent component without its provider.
The June 29 test migration switches the browser suite to Clerk’s Playwright integration and always mounts the provider. It changes which boundary those tests cross.
The old fixtures checked useful things
The earlier arrangement had a local JWKS server and test-signed JWTs. That let the backend verify a token against controlled keys without contacting the real identity provider.
It could check middleware behavior with known claims. It couldn’t establish that the real browser SDK, provider state, and provider-dependent components worked together.

Illustration: a model and the full setting can answer different questions.
That limit connects to the previous two production failures. A local JWKS override could bypass the publishable-key hostname parser. A token fixture always supplying email could miss the absent-email fallback.
The fixture wasn’t useless. I had to avoid treating what it replaced as something it tested.
What the migrated browser test does
The new test uses the provider helper:
await page.goto('/')
await clerk.signIn({ page, emailAddress: '[email protected]' })
The address is a test identity from the setup code. The global setup creates or reuses provider-side test users, updates their expected role metadata, and saves their provider IDs for the suite. Backend seeding then uses those IDs to connect the test users with local application data.
A sanitized path derived from that code is:
Provision/reuse provider test user
-> seed matching local user
-> load page with ClerkProvider
-> provider test-helper sign-in
-> request protected application page
This is a map of the test flow, not a newly recorded browser session or a report that every migrated test passed.
The setup is now part of the test
The browser and backend need the intended test-instance configuration. The suite depends on provider access for user setup, not only a locally served public key.
Those users are deliberately reused by the setup helper. Resetting local application data and deleting provider accounts are therefore different cleanup decisions. Removing one doesn’t automatically clean up the other.
The migration also keeps unit-test mocks for the Clerk hooks. A component test doesn’t need to become a provider integration test just because the browser suite now exercises that path.