Skip to content

Wait for the hero scroll frame before checking receded copy - #2006

Merged
David Pine (IEvangelist) merged 1 commit into
mainfrom
aspireagent/fix-hero-motion-scroll-frame-race
Nov 2, 2026
Merged

David Pine (IEvangelist) merged 1 commit into
mainfrom
aspireagent/fix-hero-motion-scroll-frame-race

Conversation

@davidfowl

Copy link
Copy Markdown
Contributor

Summary

This fixes a race in the homepage E2E test "uses bounded hero motion to advance product proof on large viewports". It failed on desktop in run 41103769995, job 124232348472 with:

expect(recededCopyOpacity).toBeLessThanOrEqual(0.12)
Received: 0.59168

Root cause (test-only): HomeHero.astro applies --home-hero-progress inside a requestAnimationFrame scroll handler, and .home-hero-copy opacity is 1 - progress * 0.88. The test polls after scrollTo(0, 320), but after scrollTo(0, 600) it read the opacity once. When that read lands before the next frame, it sees the previous 320px frame: progress 0.464, which gives exactly 0.59168. Site behavior is correct; the settled value is always 0.12.

Fix:

  • The final read now uses expect.poll(...).toBeLessThanOrEqual(0.12) through a small expectHeroCopyReceded helper. The threshold is unchanged and there are no new sleeps, retries or timeout changes.
  • New regression test "waits for the hero scroll frame before checking receded copy" simulates a slow frame by deferring requestAnimationFrame callbacks by 30 frames, then checks the same receded-copy contract.

No production or rendered output changes, so there are no screenshots.

Third-party links and affiliations

None.

Validation

Measured locally on the desktop-chromium project against a dev server with retries disabled, at base f05f5561:

  • Standalone probe (main): 2/10 immediate reads after scrollTo(0, 600) returned 0.59168; every settled read was 0.12. With the slow-frame deferral, 10/10 immediate reads were stale.
  • Regression test, fail-before: using the old single read, it failed 10/10 with Received: 0.59168.
  • Pass-after: both hero tests passed 30/30 (--repeat-each=15).
  • Tablet/mobile: both tests are skipped below the desktop motion breakpoint, as before.
  • Lint and units: npx eslint . --max-warnings 0 is clean, and npx vitest run passed 84 files with 1,120 tests passed and 1 skipped.
  • Overlap: no open issue or PR covers this test. Add latest release badge to homepage #1955 edits other homepage.spec.ts tests, not this one.

🤖 Posted by AspireAgent (AI Agent)

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Frontend HTML artifact ready

The latest frontend build uploaded the frontend-dist artifact for PR #2006. Use the VS Code button below to open this PR with GitHub Artifacts Explorer and browse the built HTML locally.

VS Code: Open PR #2006 artifacts

This comment updates automatically when a new frontend build artifact is uploaded.

@davidfowl
David Fowler (davidfowl) marked this pull request as ready for review October 31, 2026 04:20
Copilot AI balanced review requested due to automatic review settings October 31, 2026 04:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the homepage E2E timing-race fix.

No open issues 🎉

What changed in this PR

This PR fixes a timing race in the homepage E2E tests by waiting for the hero’s scroll-driven opacity update. Production behavior and rendered output are unchanged.

Changes:

  • Extracts shared helpers to read hero-copy opacity and poll until it reaches the existing threshold.
  • Replaces the immediate final opacity assertion with polling.
  • Adds a desktop regression test that delays animation-frame callbacks to exercise stale scroll progress.
File Description
src/​frontend/​tests/​e2e/​homepage.spec.ts Adds polling helpers and delayed-frame regression coverage for hero-copy opacity.

Review effort: Balanced

@IEvangelist

Copy link
Copy Markdown
Member

Project docs review: not applicable (test-only PR)

Reviewed main base f05f5561b1b858344124cd848ff06469627d7e6e against head e1419e3eeb5806f3f6d4c7f3a968d55b29001c6c. The complete diff changes only src/frontend/tests/e2e/homepage.spec.ts (+44/-5); no documentation pages, examples, or Aspire API/CLI/configuration claims change.

Phase A - claims verification: No documentation claims found. Claim catalog: empty; verified / verified-with-nuance / unverifiable / contradicted: 0 / 0 / 0 / 0. No upstream source repository was consulted because there is no applicable documentation claim to verify.

Phase B - blind doc-tester assessment: Not applicable: no changed documentation route, section, or user instructions to exercise. Routes exercised: none; no documentation server or sample application started. Critical issues, warnings, passed checks, recommendations, and knowledge gaps: not assessed, rather than represented as passing. Homepage E2E behavior belongs to the subsequent code review, not a fabricated documentation test.

Outcome: Both documentation phases were assessed for applicability; no documentation finding. This is a top-level assessment only, not a formal approval. This once-per-PR docs stage is complete; subsequent commits do not automatically rerun it.

@IEvangelist

Copy link
Copy Markdown
Member

Project code review: no actionable findings

Reviewed the complete test-only diff from main base f05f5561b1b858344124cd848ff06469627d7e6e to head e1419e3eeb5806f3f6d4c7f3a968d55b29001c6c, following the repository code-review skill. No high-confidence correctness, isolation, or important coverage defect found. This follows the docs applicability assessment.

Synchronization and assertions: HomeHero.astro schedules scroll progress through requestAnimationFrame; copy opacity is 1 - progress * 0.88. The shared helper waits for the same existing <= 0.12 endpoint instead of reading before the frame commits. Polling remains bounded by Playwright's assertion timeout; it does not weaken the numeric threshold. The original intermediate-opacity and advancing-product-position assertions remain intact. Production files are unchanged.

Regression and isolation: The new test delays callbacks through 30 native frames, waits for an intermediate fade at scroll 320, then checks the final endpoint at scroll 600. Its init script is installed before reload. The override and pending callback chains stay inside this test's Playwright-owned page/browser context, which fixture teardown disposes; they do not alter another test's browser APIs. No application navigation requiring cancellation fidelity is exercised by this test.

Test coverage and evidence

At the exact reviewed head, CI run 41166311445 completed successfully. I inspected the actual job logs, not just the check badge:

  • Desktop shard 2/2: bun run playwright test --project=desktop-chromium --shard=2/2 passed (243 tests). The original bounded-motion test passed in 2.1s, and the added delayed-frame regression passed in 4.9s.
  • The corresponding hero tests are explicitly skipped in the tablet and mobile shard logs, consistent with the production desktop-only motion breakpoint (1152 x 768 minimum). These are not claimed as tablet/mobile executions of hero motion.
  • Existing reduced-motion, forced-colors, and homepage axe checks remain in the spec. This PR changes no production markup, routes, or accessibility behavior; no new unit/axe scenario is required for the polling-only change.

Limits: No local E2E run or independent exact-base timing reproduction: this checkout has neither Bun on PATH nor frontend dependencies. No dependency restore, local production build, live browser/device session, Firefox/WebKit run, or new CI run was performed. CI evidence is Chromium with configured desktop/tablet/mobile emulation, not physical-device coverage. The logs show the new regression passes; I did not establish a deterministic failing mutation/control for reverting only the polling helper.

Cleanup: No tracked files edited, PR checkout created, server/browser process started, or fixes pushed. Read-only fetch and source/CI inspection only. No formal approval/change request or merge action. This once-per-PR code stage is complete, including this clean result; subsequent commits do not automatically rerun it.

@IEvangelist David Pine (IEvangelist) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved following the completed Project docs applicability and clean code review at this unchanged head, approval recommendation, and passing CI. Approval and merge authorized by the user.

The bounded hero motion test read the hero copy opacity once right after
scrolling to 600px. HomeHero applies scroll progress in a requestAnimationFrame
callback, so the read could observe the previous 320px frame (0.59168) and fail
the <= 0.12 assertion. Poll the receded opacity with the same threshold and add
a slow-frame regression that fails 10/10 with the single read.

Co-authored-by: Copilot <[email protected]>
@davidfowl
David Fowler (davidfowl) force-pushed the aspireagent/fix-hero-motion-scroll-frame-race branch from e1419e3 to 3acda9e Compare November 2, 2026 00:28

Copy link
Copy Markdown
Contributor Author

Rebased onto main (new head 3acda9efb2f2c608e7ca8d056587a8925a0b024a) to fix the merge conflict with #2005. The only conflict was the @playwright/test import line in tests/e2e/homepage.spec.ts, where #2005 added type Locator. I merged the two imports, and there are no logic changes. Locally, ESLint passes, and the 3 hero E2E tests pass on desktop-chromium.

David Pine (@IEvangelist) your earlier approval was on the previous head (e1419e3e). Could you re-approve the rebased head?

🤖 Posted by AspireAgent (AI Agent)

@IEvangelist
David Pine (IEvangelist) merged commit 708ea27 into main Nov 2, 2026
19 checks passed
@IEvangelist
David Pine (IEvangelist) deleted the aspireagent/fix-hero-motion-scroll-frame-race branch November 2, 2026 14:50
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.

3 participants