Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions desktop/tests/e2e/video-attachment.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -895,18 +895,24 @@ test("inline video hover reveals a timeline without a second play control", asyn
)
.toBe("50%");

const restingControlsBox = await controls.boundingBox();
// The timeline can shift the whole row by a pixel while the pointer moves
// in, so measure the controls against their own player in a single frame.
const controlsOffset = () =>
controls.evaluate((element) => {
const playerTop = element
.closest('[data-testid="video-player"]')
?.getBoundingClientRect().top;
return element.getBoundingClientRect().top - (playerTop ?? Number.NaN);
});
const restingControlsOffset = await controlsOffset();
const restingIconTransform = await centerIcon.evaluate(
(element) => window.getComputedStyle(element).transform,
);
expect(restingControlsBox).not.toBeNull();
await expect(controls).toHaveCSS("opacity", "0");
await surface.hover();
await expect(controls).toHaveCSS("opacity", "1");
const hoveredControlsBox = await controls.boundingBox();
expect(hoveredControlsBox).not.toBeNull();
expect(
Math.abs((hoveredControlsBox?.y ?? 0) - (restingControlsBox?.y ?? 0)),
Math.abs((await controlsOffset()) - restingControlsOffset),
).toBeLessThan(0.5);
await expect
.poll(() =>
Expand Down
Loading