fix: page a list that appends at the end, and retry a screenshot after navigation

Merged
OK
13d ago
+122-18

Two failures on main, both a timer that returned before the page had caught up.

  • scroll_to({ text }) treated two polls of an unchanged screen as the end of the list. On the Playwright 1.65 runner, the web agent recording for infinite-scroll died there: 13 screens, stopped at item 60 while "Loading more" was still up, REPLAY_STALE (action-failed, LOCATOR_NOT_FOUND). An unchanged page is re-read for a second after the first held-still look, so an append that lands in that second keeps the paging going. docs/reference/agent.mdx.
  • app.screenshot already retries when the document is replaced, but only after framenavigated has been delivered. Node 24's spec job rejected page.screenshot with "Execution context was destroyed" before that event, so the shot failed instead of capturing the new document. The capture waits up to 250ms for the event, then takes the new document.

Verified

Ran it locally: yes

The new tests failed on the old code and pass on this branch.

mainthis branch
scroll_to of a page that turns 400ms after the swipe: LOCATOR_NOT_FOUND in 378mspasses, 2 swipes, finds Row 7
screenshot whose framenavigated arrives on the next macrotask: ENGINE_FAILUREmasked capture, page.screenshot called twice
$ pnpm --filter e2e exec vitest run --project integration tests/integration/agent-scroll-pages.test.ts tests/integration/agent-scroll-settle.test.ts tests/integration/agent-scroll-smooth.test.ts
Test Files  3 passed (3)
Tests  20 passed (20)

$ pnpm --filter @e2e-dev/web exec vitest run --project integration tests/integration/screenshot-navigation.test.ts
Test Files  1 passed (1)
Tests  6 passed (6)

Also green: e2e and web unit tests, the web integration suite (383 passed, 1 skipped), lint, typecheck for both packages, dead-code, changeset bumps, docs anchors and mdx.

Infinite-scroll's committed recording replayed twice here under --strict-cache (3.7s, 3.8s). This machine is slower than the CI runner that failed the same recording in 1.1s, so the 400ms test is the one that forces the gap.

Open in Web Open in Cursor