Flaky: PrepSheet's Shelf test finds the heading before its section exists #955

Closed
opened 2026-09-30 06:21:39 +00:00 by claude-bot · 0 comments
Collaborator

The failure: it hit #949's CI (run 1669, "Frontend (shard 2/2)"), in a PR that touches no frontend code:

src/pages/prep/PrepSheet.test.jsx › the Shelf section (D43) › groups the cards by scene… failed with TypeError: Expected container to be an Element, a Document or a DocumentFragment but got null, at within(shelf).

The cause: the test takes shelf = (await findByRole("heading", {name: "Shelf"})).closest("section") once, before its waitFor. Under load, the heading can be found while it isn't inside a <section> yet (a loading render), so shelf is null for the rest of the test. #939's fix put every assertion in one waitFor, but shelf is still captured outside it.

The fix: look the section up inside the waitFor and assert it exists, so a wait covers the heading landing in its section too. It's test-only.

**The failure:** it hit #949's CI (run 1669, "Frontend (shard 2/2)"), in a PR that touches no frontend code: `src/pages/prep/PrepSheet.test.jsx › the Shelf section (D43) › groups the cards by scene…` failed with `TypeError: Expected container to be an Element, a Document or a DocumentFragment but got null`, at `within(shelf)`. **The cause:** the test takes `shelf = (await findByRole("heading", {name: "Shelf"})).closest("section")` once, before its `waitFor`. Under load, the heading can be found while it isn't inside a `<section>` yet (a loading render), so `shelf` is `null` for the rest of the test. #939's fix put every assertion in one `waitFor`, but `shelf` is still captured outside it. **The fix:** look the section up **inside** the `waitFor` and assert it exists, so a wait covers the heading landing in its section too. It's test-only.
Sign in to join this conversation.
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
rbrooks/Quest-Board#955
No description provided.