Skip to content

Commit 4b0744d

Browse files
authored
test(desktop): await Bestie drag and profile hover endpoints (#7294)
1 parent 2ac0aa1 commit 4b0744d

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

desktop/tests/e2e/bestie.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,12 @@ test("assigns from an agent profile, reopens, drags, and offers the message acti
223223
await expect(page.getByTestId("bestie-activity-dot").last()).toBeVisible();
224224
await page.getByRole("button", { name: "Close Bestie" }).click();
225225
await waitForAnimations(page);
226+
// The Motion close morph can outlive the CSS/Web animations above. Wait for
227+
// the closed, untranslated shell before measuring the drag's starting point.
228+
const closedBloom = floatingAvatar.getByTestId("bestie-bloom-container");
229+
await expect(closedBloom).toHaveCSS("width", "48px");
230+
await expect(closedBloom).toHaveCSS("height", "48px");
231+
await expect(closedBloom).toHaveCSS("transform", "matrix(1, 0, 0, 1, 0, 0)");
226232
const beforeDrag = await floatingAvatar.boundingBox();
227233
const collapsedAvatar = floatingAvatar.getByTestId("bestie-trigger-avatar");
228234
const collapsedAvatarBeforeDrag = await collapsedAvatar.boundingBox();

desktop/tests/e2e/message-feedback-snapshots.spec.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,21 @@ test("profile hover uses the channel hover surface", async ({ page }) => {
100100

101101
const profile = page.getByTestId("sidebar-profile-card");
102102
const channel = page.getByTestId("channel-random");
103+
await expect(page.locator("html")).toHaveAttribute("data-buzz-sidebar", "");
104+
const hoverSurface = await channel.evaluate((element) => {
105+
const probe = document.createElement("span");
106+
probe.style.backgroundColor = "var(--buzz-hover-surface)";
107+
element.append(probe);
108+
const color = getComputedStyle(probe).backgroundColor;
109+
probe.remove();
110+
return color;
111+
});
112+
// Equal unfinished (transparent) surfaces must not satisfy hover parity.
113+
expect(hoverSurface).not.toMatch(/^(transparent|rgba\(.*,\s*0\))$/);
103114
await channel.hover();
104-
// Wait for the CSS transition to settle before capturing the hover color so
105-
// a mid-transition sample does not produce a value the profile card (which
106-
// uses the same token) can never match.
107-
await waitForAnimations(page);
115+
// Observe the semantic endpoint, not an intermediate transition sample or
116+
// the shared animation helper's timeout-as-success ceiling.
117+
await expect(channel).toHaveCSS("background-color", hoverSurface);
108118
const channelHoverColor = await channel.evaluate(
109119
(element) => getComputedStyle(element).backgroundColor,
110120
);

0 commit comments

Comments
 (0)