mirror of
https://github.com/block/buzz.git
synced 2026-10-27 12:40:30 +00:00
test(desktop): await Bestie drag and profile hover endpoints (#7294)
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user