Skip to content

fix(e2e): replace flaky frame-count assertion with stable height check#2011

Merged
wesbillman merged 1 commit into
block:mainfrom
cameronhotchkies:fix/share-card-animation-frame-count-flake
Jul 17, 2026
Merged

fix(e2e): replace flaky frame-count assertion with stable height check#2011
wesbillman merged 1 commit into
block:mainfrom
cameronhotchkies:fix/share-card-animation-frame-count-flake

Conversation

@cameronhotchkies

Copy link
Copy Markdown
Contributor

Summary

Fixes flaky test agents.spec.ts:1037 ("share access controls include the selected memories").

Problem

The test sampled the share-card's CSS animation by polling height via requestAnimationFrame over a 280ms window, then asserted it observed >2 distinct rounded height values. On slow/loaded CI runners, the rAF rate is throttled, producing exactly 2 samples — one short of the threshold.

expect(2).toBeGreaterThan(2)  // the flake signature

Fix

Replace frame-counting with a deterministic approach:

  1. waitForAnimations(page) — waits for CSS animations to settle (already used elsewhere in this file)
  2. Measure height once after settle
  3. Assert expanded height > initial height

This proves the card expanded without depending on intermediate frame scheduling.

Testing

The assertion is now timing-independent: it verifies the end state (card grew) rather than sampling intermediate animation frames. No behavioral change to production code.

The share-card animation test sampled heights via requestAnimationFrame
over a 280ms window and asserted >2 distinct rounded values. On slow CI
runners the rAF rate is throttled, producing exactly 2 samples and
causing intermittent failures.

Replace the frame-counting approach with:
1. waitForAnimations(page) — waits for CSS animations to settle
2. A single height measurement after settle
3. Assert expanded height > initial height

This proves the card expanded without depending on intermediate frame
scheduling, making the test deterministic regardless of runner speed.

Co-authored-by: Cameron Hotchkies <chotchkies@block.xyz>
Signed-off-by: Cameron Hotchkies <chotchkies@block.xyz>
@cameronhotchkies
cameronhotchkies marked this pull request as ready for review July 17, 2026 01:03
@cameronhotchkies
cameronhotchkies requested a review from a team as a code owner July 17, 2026 01:03
@wesbillman
wesbillman merged commit 256542d into block:main Jul 17, 2026
25 checks passed
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.

2 participants