Skip to content

Commit dfd5db4

Browse files
TheSentinel454codex
andcommitted
Scope video menu probes to emitted messages
Bind each context-menu interaction to the exact mock message returned by the emitter so same-second ordering cannot select the wrong video. Co-authored-by: Codex <[email protected]> Signed-off-by: tornquist <[email protected]>
1 parent 7e3e142 commit dfd5db4

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎desktop/tests/e2e/video-attachment.spec.ts‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,12 +1513,14 @@ test("right-click menus expose distinct selectors for links, relay video, and of
15131513

15141514
// ── Relay video menu: Download video + Copy link, appearing only once the
15151515
// relay origin resolves (the reactivity fix) ─────────────────────────────
1516-
await emitVideoMessage(page, {
1516+
const relayMessage = (await emitVideoMessage(page, {
15171517
url: MENU_RELAY_VIDEO_URL,
15181518
sha: MENU_RELAY_VIDEO_SHA,
15191519
filename: "relay-clip.mp4",
1520-
});
1521-
const relayPlayer = page.getByTestId("video-player").last();
1520+
})) as { id: string };
1521+
const relayPlayer = page
1522+
.locator(`[data-message-id="${relayMessage.id}"]`)
1523+
.getByTestId("video-player");
15221524
await expect(relayPlayer).toBeVisible();
15231525
// Right-click the player surface. `force` skips the actionability guard: the
15241526
// Play-button overlay sits above the video, but the contextmenu event still
@@ -1559,12 +1561,14 @@ test("right-click menus expose distinct selectors for links, relay video, and of
15591561
await expect(page.locator("[data-video-context-menu]")).toHaveCount(0);
15601562

15611563
// ── Off-relay video control: renders and offers Copy link, never Download ─
1562-
await emitVideoMessage(page, {
1564+
const offRelayMessage = (await emitVideoMessage(page, {
15631565
url: MENU_OFF_RELAY_VIDEO_URL,
15641566
sha: MENU_OFF_RELAY_VIDEO_SHA,
15651567
filename: "external-clip.mp4",
1566-
});
1567-
const offRelayPlayer = page.getByTestId("video-player").last();
1568+
})) as { id: string };
1569+
const offRelayPlayer = page
1570+
.locator(`[data-message-id="${offRelayMessage.id}"]`)
1571+
.getByTestId("video-player");
15681572
await expect(offRelayPlayer).toBeVisible();
15691573
await offRelayPlayer.click({ button: "right", force: true });
15701574

0 commit comments

Comments
 (0)