fix(e2e): match the destructive error box by class substring #476

Merged
nrupard merged 1 commit from fix/BUNYIP-480-e2e-destructive-selector into main 2026-08-05 20:40:52 +02:00
Owner

Fixes the tests/auth/login.spec.ts failure (hub login did not leave /login (current: /login/2fa) - no error message rendered) introduced by BUNYIP-464.

Root cause

BUNYIP-464 renamed the destructive error TEXT class from text-destructive to text-destructive-text (the dark-mode-legible token) in views/ui.rs::error_box and the auth surfaces. The /login/2fa "Invalid verification code" error is rendered on the 2FA card via error_box (auth_pages.rs:664), so it now carries text-destructive-text.

e2e/lib/login.ts selected .text-destructive at three sites. A CSS class selector .text-destructive does not match an element whose class is text-destructive-text, so the selector matched nothing. That blinded the 2FA single-use-collision recovery in fillTotpStep: setup's login and the auth-ui login can land in the same 30s TOTP step, so the second submission carries an already-consumed code and bunyip re-renders "Invalid verification code"; the helper detects that, waits out the step, and resubmits a fresh code. With the selector blind, readLoginError returned null, fillTotpStep assumed a navigation race and returned early, and the spec failed reporting "no error message rendered" even though the page visibly showed the error.

Fix

Broaden the three selectors to the attribute-substring [class*="text-destructive"], which matches both the legacy text-destructive and the current text-destructive-text (and any future text-destructive-*). On /login and /login/2fa the only text-destructive* elements are the error surfaces, so the match stays false-positive-free. The two coupling comments now name text-destructive-text and explain the substring match, so the next token rename does not re-break the suite.

Verification

tsc --noEmit clean. The fix restores the recovery path the spec relies on; the E2E suite confirms end to end.

#BUNYIP-480

Fixes the `tests/auth/login.spec.ts` failure (`hub login did not leave /login (current: /login/2fa) - no error message rendered`) introduced by BUNYIP-464. ## Root cause BUNYIP-464 renamed the destructive error TEXT class from `text-destructive` to `text-destructive-text` (the dark-mode-legible token) in `views/ui.rs::error_box` and the auth surfaces. The `/login/2fa` "Invalid verification code" error is rendered on the 2FA card via `error_box` (`auth_pages.rs:664`), so it now carries `text-destructive-text`. `e2e/lib/login.ts` selected `.text-destructive` at three sites. A CSS class selector `.text-destructive` does not match an element whose class is `text-destructive-text`, so the selector matched nothing. That blinded the 2FA single-use-collision recovery in `fillTotpStep`: setup's login and the auth-ui login can land in the same 30s TOTP step, so the second submission carries an already-consumed code and bunyip re-renders "Invalid verification code"; the helper detects that, waits out the step, and resubmits a fresh code. With the selector blind, `readLoginError` returned null, `fillTotpStep` assumed a navigation race and returned early, and the spec failed reporting "no error message rendered" even though the page visibly showed the error. ## Fix Broaden the three selectors to the attribute-substring `[class*="text-destructive"]`, which matches both the legacy `text-destructive` and the current `text-destructive-text` (and any future `text-destructive-*`). On `/login` and `/login/2fa` the only `text-destructive*` elements are the error surfaces, so the match stays false-positive-free. The two coupling comments now name `text-destructive-text` and explain the substring match, so the next token rename does not re-break the suite. ## Verification `tsc --noEmit` clean. The fix restores the recovery path the spec relies on; the E2E suite confirms end to end. #BUNYIP-480
fix(e2e): match the destructive error box by class substring
All checks were successful
E2E PR gate / Install + reachability (no deployment secrets) (pull_request) Successful in 14s
Check / fmt + clippy + build + tests (pull_request) Successful in 4m10s
Create release / Create release from merged PR (pull_request) Has been skipped
6039855953
The login helper selected `.text-destructive`, but BUNYIP-464 renamed the error_box text token to `text-destructive-text`, so the selector matched nothing and the 2FA single-use-collision recovery went blind, failing login.spec with "no error message rendered". Broaden the three selectors to `[class*="text-destructive"]` so they match both the legacy and current tokens (false-positive-free on the login pages) and survive a future rename.

#BUNYIP-480
nrupard deleted branch fix/BUNYIP-480-e2e-destructive-selector 2026-08-05 20:40:52 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/bunyip!476
No description provided.