e2e: cover logged-in state; fix rating-button contrast and login-page JS error - #13366
Merged
Conversation
The Playwright suite only ever ran anonymously. Add a login() helper and
'when logged in' blocks (home, work, login, a11y, new my-books spec).
Running pages logged in surfaced:
- login.html rendered the LOCAL_DEV autofill hint for logged-in users,
whose form isn't rendered, so index.js threw on a null #username.
- .star-messaging ("Clear my rating") used the non-text --mid-grey token
and failed WCAG contrast (2.48:1).
The 'invalid credentials' login test was passing vacuously: the mock IA
auth accepts any non-empty password, so it was actually logging in.
Mock now rejects the sentinel 'bad_password' so the error path is real.
Claude-Session: https://claude.ai/code/session_01Vmhke1AR5VjcNKP7KnciCJ
The loading indicator is only rendered for authenticated patrons — my_books/dropdown_content.html emits it under `$if async_load: $if ctx.user` — but initLoadingAnimation always started its interval. For anonymous visitors the callback dereferenced null every 1.5 seconds, throwing for as long as the page stayed open, on every page carrying a dropper. This showed up as an intermittent failure in edition.spec.ts, whose console-error assertion only observes the error when the test happens to outlive the first interval tick. clearInterval(null) is a no-op, so returning null leaves updateReadingLists() unchanged.
lokesh
marked this pull request as ready for review
August 26, 2026 05:22
This was referenced Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes tests
Our Playwright e2e suite only tested the site as a logged-out visitor. That means the logged-in experience — which is most of what an active patron actually sees — had no automated coverage at all. This PR adds a simple way for any e2e test to log in first, and then re-runs our key checks (page loads, console errors, accessibility scans) as a logged-in user.
That new coverage immediately surfaced a category of bug we were blind to before: problems that only exist for logged-in users. Two got fixed here:
It also exposed a test that was passing without testing anything: our "invalid credentials" login test was actually logging in successfully, because the dev-environment mock accepts any password. The mock now has a way to reject a bad password, so the test genuinely verifies login failure.
Testing
Locally: 36 passed, 7 skipped (opt-in visual snapshots). Both fixes were verified failing before and passing after.
Screenshot
Stakeholders