test(card-view): read every frame card B lasts after leaving a comparison (#1128)
Before: the card view's reduced-motion test, "a comparison opens and closes in place, and opens again", failed on WebKit every time (PR #1126's Full E2E, 3 of 3). After BACK it waited for four frames of card B at opacity 0. Card B stays only for the exit's 480 ms, and WebKit drew that stay in three frames, so the test read ['0', '0', '0'] and failed, although every frame it read was hidden.
After: leaving a comparison, the test reads card B as the mode flips and then on every frame card B lasts, and checks that each reading is 0. It passes however many frames a browser draws in those 480 ms, and fails when leaving flies card B back, or when card B shows again at any point in its stay. No app code changes.
How: sampleCardB, when leaving, also listens for data-mode with a MutationObserver, which runs after the exit's layout effect has hidden card B, so there is one reading however late the next frame comes. Its frame loop then reads until card B is gone. Entering a comparison it still reads the first four frames. The leaving check is one Set comparison, which also shows the opacities read when it fails. E2E_TESTS.md describes the new check.
Checked in Chromium:
- The old test fails with
FLIP_DURATIONcut to 50 ms (['0', '0', '0'], as on WebKit). The new one passes with it cut to 1 ms. - With
runExitFLIP's reduced-motion branch skipped, the new test fails (Set {"1"}). - With card B shown again 200 ms into its stay, the old test passes and the new one fails (
Set {"0", "1"}). - Each push's pre-push ran every spec on chromium and mobile-chrome (580 passed, none failed). The first push passed on all five browsers in CI;
full-e2ereruns them on this one.
Closes #1128
🤖 Generated with Claude Code