test(desktop): survive early menu dismissals in the agent-voice spec

Shortly after a cold load, background huddle-state settling re-renders
the participant tiles and dismisses a just-opened Radix popover. In a
fresh worker a single click then fails deterministically — and every CI
retry runs in a fresh worker, so a first-attempt failure of this spec
could never recover. Retry the open-and-read unit (open, title, toggle)
until the menu holds through it.

The underlying dismissal is a product bug worth its own look: an open
agent-voice menu can be closed by background state settling the user
never initiated.

Signed-off-by: Max Lampert <maxwell@squareup.com>
This commit is contained in:
Max Lampert
2026-08-21 16:40:27 -07:00
parent d97780b477
commit ceb658fec6

View File

@@ -811,17 +811,27 @@ test("assigns distinct agent voices and exposes compact per-agent controls", asy
});
expect(new Set(assignedVoices).size).toBe(2);
await page.getByRole("button", { name: "Voice settings for alice" }).click();
await waitForAnimations(page);
const voiceMenu = page.locator(
'[data-testid="huddle-agent-voice-menu-content"][data-state="open"]',
);
await expect(voiceMenu).toBeVisible();
await expect(
voiceMenu.getByText("Agent text-to-speech", { exact: true }),
).toBeVisible();
// Shortly after a cold load, background huddle-state settling re-renders
// the tiles and dismisses a just-opened Radix menu; in a fresh worker
// (which is also every CI retry) a single click fails deterministically.
// Retry the whole open-and-read unit until the menu holds through it.
const ttsToggle = voiceMenu.getByTestId("huddle-agent-tts-toggle");
await expect(ttsToggle).toBeChecked();
await expect(async () => {
if (!(await voiceMenu.isVisible())) {
await page
.getByRole("button", { name: "Voice settings for alice" })
.click();
}
await expect(voiceMenu).toBeVisible({ timeout: 1_500 });
await expect(
voiceMenu.getByText("Agent text-to-speech", { exact: true }),
).toBeVisible({ timeout: 1_500 });
await expect(ttsToggle).toBeChecked({ timeout: 1_500 });
}).toPass({ timeout: 20_000 });
await waitForAnimations(page);
await expect(
voiceMenu.getByTestId("huddle-agent-voice-selector"),
).toContainText("Vera");