test: the browser suites can read an approval screen before the page has shown it #502

Open
opened 2026-10-08 06:47:36 +02:00 by clawbot · 2 comments
Collaborator

visible() in tests/e2e/harness.js waits only for Playwright's state: "visible". In an approval window that can be true before the page's stylesheet has applied: every view still lays out as visible, so visible() passes for a screen the page has not shown yet, and the test reads its fields before the page's script has filled them. Found by the review of #501 (#501 (comment)): one Chrome run failed its network-switch test with the prompt's fields empty. It is the likely cause of an earlier run on the same PR in which every test waiting for an approval window failed, while reruns passed.

The existing approval tests read their screens the same way, so any of them can fail like this.

Definition of done

  • Waiting for a screen in the browser suites means waiting until the page itself has shown it (for example, the stylesheet has applied and the view is the one the page displays), not only that the element lays out.
  • The cause is shown: a run that reproduces the early read fails before the fix and passes after, or the PR explains how the race was confirmed.
  • Both browser suites pass; TODO.md updated in the same commit.

Model: opus-5-5

`visible()` in `tests/e2e/harness.js` waits only for Playwright's `state: "visible"`. In an approval window that can be true before the page's stylesheet has applied: every view still lays out as visible, so `visible()` passes for a screen the page has not shown yet, and the test reads its fields before the page's script has filled them. Found by the review of https://git.eeqj.de/sneak/AutistMask/pulls/501 (https://git.eeqj.de/sneak/AutistMask/pulls/501#issuecomment-133243): one Chrome run failed its network-switch test with the prompt's fields empty. It is the likely cause of an earlier run on the same PR in which every test waiting for an approval window failed, while reruns passed. The existing approval tests read their screens the same way, so any of them can fail like this. ## Definition of done - [ ] Waiting for a screen in the browser suites means waiting until the page itself has shown it (for example, the stylesheet has applied and the view is the one the page displays), not only that the element lays out. - [ ] The cause is shown: a run that reproduces the early read fails before the fix and passes after, or the PR explains how the race was confirmed. - [ ] Both browser suites pass; `TODO.md` updated in the same commit. Model: opus-5-5
Author
Collaborator

Plan: reproduce the early read on purpose, then make the harness wait until the page itself shows the requested screen, not only until the element lays out. No extension code changes. Both browser suites run at least twice.

Model: opus-5-5

Plan: reproduce the early read on purpose, then make the harness wait until the page itself shows the requested screen, not only until the element lays out. No extension code changes. Both browser suites run at least twice. Model: opus-5-5
Author
Collaborator

Built in #504: the screen wait in both browser suites now also waits for the page to finish loading and for the screen to be the one the page shows. Confirmed by serving the approval window's stylesheet 3 seconds late in a throwaway edit, which made the network switch test read an empty prompt without the fix.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/AutistMask/pulls/504: the screen wait in both browser suites now also waits for the page to finish loading and for the screen to be the one the page shows. Confirmed by serving the approval window's stylesheet 3 seconds late in a throwaway edit, which made the network switch test read an empty prompt without the fix. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#502