mirror of
https://github.com/block/buzz.git
synced 2026-10-27 04:30:52 +00:00
test(desktop): scope video menu e2e probes to emitted messages (#7953)
## Summary
Fixes the `Desktop Smoke E2E (4)` failure on `main`. The test at
`desktop/tests/e2e/video-attachment.spec.ts` ("right-click menus expose
distinct selectors for links, relay video, and off-relay video") fails
3/3 attempts on main and on every PR branch since ~Sept 25. Because
"Desktop" is a required check, that blocks merges.
**Cause:** the relay-video and off-relay-video probes picked their
player with `getByTestId("video-player").last()`. When mock messages
share a second, timeline ordering can put a different video last. The
locator then resolves to the wrong player, and the "Download video" menu
detaches before the click, so the test times out.
**Fix:** scope each probe to the `data-message-id` of the message
`emitVideoMessage` just returned. Test-only change, 16 lines.
## Attribution
This is a cherry-pick of `dfd5db4e0` by @tornquist, originally part of
#7827 (the deletion-drain cron, which is stacked on another feature
branch). It's pulled out on its own so main can go green without waiting
on that stack. Authorship is preserved.
## Testing
- `pnpm build:e2e && playwright test tests/e2e/video-attachment.spec.ts
--project=smoke`: 13/13 passed locally, including the target test.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Signed-off-by: tornquist <tornquist@squareup.com>
Signed-off-by: murderbot <3754f8729004d95654c46dbab3129e4ab9ef05cc2534e2a3fbfc155983bd637b@buzz.block.builderlab.xyz>
Co-authored-by: tornquist <tornquist@squareup.com>
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -1513,12 +1513,14 @@ test("right-click menus expose distinct selectors for links, relay video, and of
|
||||
|
||||
// ── Relay video menu: Download video + Copy link, appearing only once the
|
||||
// relay origin resolves (the reactivity fix) ─────────────────────────────
|
||||
await emitVideoMessage(page, {
|
||||
const relayMessage = (await emitVideoMessage(page, {
|
||||
url: MENU_RELAY_VIDEO_URL,
|
||||
sha: MENU_RELAY_VIDEO_SHA,
|
||||
filename: "relay-clip.mp4",
|
||||
});
|
||||
const relayPlayer = page.getByTestId("video-player").last();
|
||||
})) as { id: string };
|
||||
const relayPlayer = page
|
||||
.locator(`[data-message-id="${relayMessage.id}"]`)
|
||||
.getByTestId("video-player");
|
||||
await expect(relayPlayer).toBeVisible();
|
||||
// Right-click the player surface. `force` skips the actionability guard: the
|
||||
// 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
|
||||
await expect(page.locator("[data-video-context-menu]")).toHaveCount(0);
|
||||
|
||||
// ── Off-relay video control: renders and offers Copy link, never Download ─
|
||||
await emitVideoMessage(page, {
|
||||
const offRelayMessage = (await emitVideoMessage(page, {
|
||||
url: MENU_OFF_RELAY_VIDEO_URL,
|
||||
sha: MENU_OFF_RELAY_VIDEO_SHA,
|
||||
filename: "external-clip.mp4",
|
||||
});
|
||||
const offRelayPlayer = page.getByTestId("video-player").last();
|
||||
})) as { id: string };
|
||||
const offRelayPlayer = page
|
||||
.locator(`[data-message-id="${offRelayMessage.id}"]`)
|
||||
.getByTestId("video-player");
|
||||
await expect(offRelayPlayer).toBeVisible();
|
||||
await offRelayPlayer.click({ button: "right", force: true });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user