Notes · · 2 min read
Four bugs my browser tests caught that HTTP tests could not
Lantern Auth's integration tests all passed against a real Keycloak. In under an hour, browser tests found four bugs, and none of them could be seen over HTTP.
Lantern Auth is a learning project: staff sign-in for an invented retail chain, built on Keycloak with three Blazor apps. Its integration tests run against a real Keycloak in Testcontainers and call the apps and the API over HTTP. They were all passing on 1 October when I added Playwright tests that drive a real browser against the Docker Compose stack. Within the hour, those tests had found four bugs.
1. The apps never became interactive in Docker
The Dockerfiles restored NuGet packages before copying the source in, a common way to cache layers. For these Blazor apps it meant the published image had no _framework/blazor.web.js, so pages rendered on the server and then never came alive. Every HTTP test passed, because the HTML was correct. Restoring after copying the source fixed it.
2. Anything typed before the page was ready was lost
Blazor renders the page on the server first and attaches the interactive connection a moment later. The Staff and Promotions forms could be used during that gap, so text typed early was dropped, and creating a record posted empty values and got a 400. The controls now stay disabled until the page is interactive (RendererInfo.IsInteractive).
3. A correct PIN left the PIN pad on screen
On the till, the PIN pad and the sale screen report back to their parent through Func parameters. Invoking a Func re-renders only the child, so the till’s state changed but the screen did not. The parent now re-renders itself after updating the till.
4. Opening the wrong app could lock you out of the right one
Each app turns away people without its role, after they have signed in correctly. Keycloak’s built-in deny step reports that as a failed login, so brute-force detection counted it: opening the wrong app five times locked the account out of the apps it was allowed into, for up to 15 minutes. A small plugin step now shows the same page as a challenge instead of a failure (decision 0009).
What I took from it
HTTP tests check what the server sends. Three of these bugs lived in what the browser does with it, and the fourth only appeared when someone did something slightly wrong, the way people do. Browser tests are slower and need the whole stack running, so Lantern Auth keeps 16 of them for the journeys that matter and leaves the rest to 259 integration tests.
