From 269bab7354dbc9f483dd344370f02c42b9c91e23 Mon Sep 17 00:00:00 2001 From: Badcuban <108198679+badcuban@users.noreply.github.com> Date: Mon, 16 Nov 2026 05:21:55 -0500 Subject: [PATCH] test(web): the panel-corner test reads the layer tree once fades have ended While an element fades (a pill or button appearing in the chat), the browser lifts the content it overlaps onto layers of their own until the fade ends. On a busy runner the test sometimes read the tree mid-fade and took the chat content's overlap layer (651x4144, reason Overlap, beside an ActiveOpacityAnimation layer) for the rounded clip's mask. It now waits for animations that end, then reads a fresh report. With the old rounded clip restored the test still fails (4 mask layers). --- .../ChatView.desktop-window.browser.tsx | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/apps/web/src/components/ChatView.desktop-window.browser.tsx b/apps/web/src/components/ChatView.desktop-window.browser.tsx index 9f9bbe766..5388c067a 100644 --- a/apps/web/src/components/ChatView.desktop-window.browser.tsx +++ b/apps/web/src/components/ChatView.desktop-window.browser.tsx @@ -133,17 +133,30 @@ describe("ChatView (full app): the desktop app's window", () => { }); await session.send("LayerTree.enable"); // The tree is reported on the next frame the page draws, and again as - // it changes: wait for the one where the chat's scroller is drawn on - // its own, so there is something to mask (an early frame can come - // before it is). - // A busy runner can take seconds to composite the chat after first paint. - await vi.waitFor( - () => { - document.body.style.outline = document.body.style.outline ? "" : "0 solid transparent"; - expect(layers?.some((layer) => layer.drawsContent && layer.backendNodeId)).toBe(true); - }, - { timeout: 5_000 }, + // it changes: wait for one where the chat's scroller is drawn on its + // own, so there is something to mask (an early frame can come before + // it is). A busy runner can take seconds to composite the chat. + const awaitScrollerLayer = () => + vi.waitFor( + () => { + document.body.style.outline = document.body.style.outline ? "" : "0 solid transparent"; + expect(layers?.some((layer) => layer.drawsContent && layer.backendNodeId)).toBe(true); + }, + { timeout: 5_000 }, + ); + await awaitScrollerLayer(); + // While something fades (a pill or button appearing in the chat), the + // browser lifts what it overlaps onto layers of their own until the + // fade ends. The rounded clip's masks stay for good: read the tree + // once the fades that end have ended (a spinner never does). + await Promise.all( + document + .getAnimations() + .filter((animation) => animation.effect?.getComputedTiming().endTime !== Infinity) + .map((animation) => animation.finished.catch(() => undefined)), ); + layers = null; + await awaitScrollerLayer(); const masks = layers!.filter( (layer) => layer.drawsContent &&