test(desktop): await Bestie drag and profile hover endpoints (#7294)

This commit is contained in:
Logan Johnson
2026-09-03 23:52:55 -04:00
committed by GitHub
parent 2ac0aa1dd1
commit 4b0744d7f3
2 changed files with 20 additions and 4 deletions

View File

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

View File

@@ -100,11 +100,21 @@ test("profile hover uses the channel hover surface", async ({ page }) => {
const profile = page.getByTestId("sidebar-profile-card");
const channel = page.getByTestId("channel-random");
await expect(page.locator("html")).toHaveAttribute("data-buzz-sidebar", "");
const hoverSurface = await channel.evaluate((element) => {
const probe = document.createElement("span");
probe.style.backgroundColor = "var(--buzz-hover-surface)";
element.append(probe);
const color = getComputedStyle(probe).backgroundColor;
probe.remove();
return color;
});
// Equal unfinished (transparent) surfaces must not satisfy hover parity.
expect(hoverSurface).not.toMatch(/^(transparent|rgba\(.*,\s*0\))$/);
await channel.hover();
// Wait for the CSS transition to settle before capturing the hover color so
// a mid-transition sample does not produce a value the profile card (which
// uses the same token) can never match.
await waitForAnimations(page);
// Observe the semantic endpoint, not an intermediate transition sample or
// the shared animation helper's timeout-as-success ceiling.
await expect(channel).toHaveCSS("background-color", hoverSurface);
const channelHoverColor = await channel.evaluate(
(element) => getComputedStyle(element).backgroundColor,
);