Skip to content

Wait for the router's heading focus and the page's own scroll in the browser harness - #196

Open
pournasserian wants to merge 3 commits into
mainfrom
193-firefox-rows
Open

pournasserian wants to merge 3 commits into
mainfrom
193-firefox-rows

Conversation

@pournasserian

Copy link
Copy Markdown
Member

Closes #193

Two causes in the harness, one fix each. No timeout raised, no retry, no check loosened.

Skeleton row: a pixel read off the screen

Reproduced. The row never failed alone (240 runs, also at 1.5 CPUs). Under the full Firefox suite at 4 CPUs (fl-linux container) it failed in 8 of 11 runs of a whole mode (static, server and wasm).

Cause. A scroll log in ReadPixelAsync showed the sequence:

  1. After TypeAsync("spring") the page is at scrollTop 1354, with the search field in view.
  2. ScrollIntoViewIfNeededAsync scrolls to 3413 to show the reset button.
  3. Before that call returns, Firefox scrolls back to 2033 to show the caret of the typed text.

That caret scroll is queued when the text is typed. Under load it runs after the read's scroll, not before. The rest check then sees nothing move, and the button's box is 1774 px down in an 800 px window. The values were the same in every failure.

Fix. ReadPixelAsync waits for the page to rest before it scrolls the indicator into view, so a scroll the page still owes runs first. It then asserts that the point is in the window, so a box off the screen fails with its position, not with Playwright's clip error.

Focus rows: keys before the router's heading focus

Cause. FocusOnNavigate focuses the h1 through a call that comes after the render that sets data-interactive="true". A test that starts on the keys in that gap has its focus taken.

  • Shift+Tab row (server): the first Tab stop it recorded was the heading. That is only possible if the heading took focus after StartAtTopAsync.
  • Empty-state row (wasm): the heading is one of the two :focus matches, and the test did not wait for it.

Fix. GalleryFixture.WaitUntilReadyAsync (used by OpenAsync) also waits, in an interactive mode, until the page's h1, if it has one, is the active element. This is the selector the router uses. It covers every test that uses the keys after opening a page, not only these two. The explicit FormsPage.FocusSettledAsync calls are kept: some follow an in-app navigation, and the ones right after an open now return at once.

Proof. The new HarnessGuardTests.ReadyWaitsForTheRouterToFocusTheHeading holds the router's focus back by one second. It fails in server and wasm without the fix (2/2) and passes with it.

Field row (wasm): not reproduced

This row already waited for the heading before it used the keys. A probe recorded every focus() call and focus event in Firefox wasm: the router focuses the heading once (5 of 5 runs), so a late second focus does not explain it. It did not fail in 2 full wasm runs or in 20 single-row runs in wasm. It was seen once in CI (46546226030). The CI log shows two elements matching :focus at once, the heading and the field reached. I could not explain that from the page, and this PR doesn't claim to fix it. The new wait does not change this row.

Results

Check Result
dotnet build -warnaserror 0 warnings, 0 errors
Component tests 797 passed
markdownlint (CONTRIBUTING.md) 0 issues
Chromium, three modes: guard, KeyboardSamples, EmptyStateTests, FieldTests and the 12 classes that use TabToAndAssertPaintChangeAsync 230 passed
Branch nightly 46678873360 all 8 browser jobs and the startup job green
Firefox full suite in the container, with the fix running; added when done
The four rows and the guard, 30 runs in a row running; added when done

Unrelated: under the same load, ComboboxTests.RapidTextsShowOnlyTheAnswerToTheLatestOne and CommandPaletteTests.APointerRunsAResult… (server) failed once each, without this PR's changes. They are not among this issue's rows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Three Firefox rows meet the router's heading focus or read a pixel outside the window

1 participant