Skip to content

Commit bad2fec

Browse files
kalvinnchauam
andauthored
fix(test): observe coordination transition events (#2297)
The coordination browser test can report `animated: false` after a real disclosure transition completes between frame samples. Main [run 41693502039](https://github.com/block/buzz-app/actions/runs/41693502039), WebKit job 126119613338, failed this assertion with no geometry failures at `589c2a489fe87ab45315359014d7d46d2df4a240`. Observe the panel's `grid-template-rows` transitionstart event before clicking, and remove the observer in `finally`. Keep the existing frame-by-frame clipping, alignment, settlement, and keyboard assertions. No product changes or browser cases added/removed. Browser coverage remains necessary for actual CSS transitions and rendered geometry. Validation: - At the failing main commit, delaying only test sampling by 350ms reproduced the exact failure while recorded transition events proved motion occurred. The original hosted trace does not record those events, so its precise scheduling cause remains unproven. - The repaired test passes with the same diagnostic delayed sampler in Chromium and WebKit (8.1s / 8.3s test execution; 34.5s local runner). Diagnostic instrumentation is excluded from this change. - Disabled-motion control still fails the animation assertion (WebKit), so an absent transition remains detectable. - Normal repaired test: 2/2 per engine, Chromium 3.7–3.9s and WebKit 4.4–4.7s; 30.1s local runner. Only the affected case ran, with no retries. - At commit `8a53027b3`, the affected test passes in Chromium (4.3s) and WebKit (4.8s), 18.1s runner; head verified before and after. - Independent agent review approved with no findings. The reviewer's reduced-motion control fails in both engines as intended. The review run also inadvertently included measurement dependencies. - Hosted coordination repetition checks passed 10/10 per engine in [run 41701145383](https://github.com/block/buzz-app/actions/runs/41701145383). Attempt 1 hit the separate held-pointer travel test defect (`history-loading.spec.mjs:347`, expected ≥6 steps, got 2), already repaired by unmerged #2250. A single-job hosted retry passed at the unchanged repair head. Attempt 2 completed successfully at 19:37:26 UTC: 39 successful checks, two expected skips, none pending. This PR does not repair the held-pointer defect. No full suite invoked locally; hosted CI supplies broader validation. Native acceptance and a real relay are outside this test-only change. Signed-off-by: Kalvin Chau <[email protected]> Co-authored-by: am <6e30cd56c30e030cd31bb0939b94a7c257c9a09d5ba2d92cf2735da45629f248@buzz.block.builderlab.xyz>
1 parent a34ba4f commit bad2fec

1 file changed

Lines changed: 37 additions & 22 deletions

File tree

‎tests/browser/message-actions.spec.mjs‎

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ test("coordination keeps its first line visible throughout expansion and collaps
5151
preview.getBoundingClientRect().left - row.getBoundingClientRect().left;
5252
const failures = [];
5353
let animated = false;
54+
// A busy frame can miss the entire transition. Observe its start before
55+
// clicking; frame samples still check clipping and settlement below.
56+
const onTransitionStart = (event) => {
57+
if (
58+
event.target.matches('[class*="audiencePanel"]') &&
59+
event.propertyName === "grid-template-rows"
60+
)
61+
animated = true;
62+
};
63+
row.addEventListener("transitionstart", onTransitionStart);
5464
const sample = (opening) => {
5565
const panel = row.querySelector('[class*="audiencePanel"]');
5666
const preview = row.querySelector('[class*="audiencePreview"]');
@@ -78,30 +88,35 @@ test("coordination keeps its first line visible throughout expansion and collaps
7888
const running = panel
7989
?.getAnimations()
8090
.some((animation) => animation.playState === "running");
81-
animated ||= !!running;
8291
return { panel, running };
8392
};
84-
for (const opening of [true, false]) {
85-
const start = performance.now();
86-
button.click();
87-
await new Promise((resolve, reject) => {
88-
let settled = 0;
89-
const tick = () => {
90-
const { panel, running } = sample(opening);
91-
settled = (
92-
opening
93-
? panel && !panel.hasAttribute("data-starting-style") && !running
94-
: !panel
95-
)
96-
? settled + 1
97-
: 0;
98-
if (settled >= 2) resolve();
99-
else if (performance.now() - start > 5000)
100-
reject(new Error("Coordination transition did not settle"));
101-
else requestAnimationFrame(tick);
102-
};
103-
requestAnimationFrame(tick);
104-
});
93+
try {
94+
for (const opening of [true, false]) {
95+
const start = performance.now();
96+
button.click();
97+
await new Promise((resolve, reject) => {
98+
let settled = 0;
99+
const tick = () => {
100+
const { panel, running } = sample(opening);
101+
settled = (
102+
opening
103+
? panel &&
104+
!panel.hasAttribute("data-starting-style") &&
105+
!running
106+
: !panel
107+
)
108+
? settled + 1
109+
: 0;
110+
if (settled >= 2) resolve();
111+
else if (performance.now() - start > 5000)
112+
reject(new Error("Coordination transition did not settle"));
113+
else requestAnimationFrame(tick);
114+
};
115+
requestAnimationFrame(tick);
116+
});
117+
}
118+
} finally {
119+
row.removeEventListener("transitionstart", onTransitionStart);
105120
}
106121
return { failures, animated };
107122
});

0 commit comments

Comments
 (0)