Skip to content

Commit 34cb363

Browse files
test(web): split the cloud voice cancel flow from the failed-then-saved setup
The browser case "enables the chosen provider only after a successful setup" timed out at 15s on a contended CI shard. It opened the destination Select and mounted the setup dialog twice (once to cancel, once to set up), then failed a save and retried it. Those Select and dialog mounts are the expensive steps, so this case was the slowest in the file and ran out of its deadline when the shard ran tests several times slower than usual. Cancelling is now its own case. The setup case starts from the dialog it opens once. Assertions are unchanged; each case now takes less time than the OpenRouter case in the same file. AI-assisted; verified with the tests and tools listed above.
1 parent b63d3c5 commit 34cb363

1 file changed

Lines changed: 27 additions & 6 deletions

File tree

‎apps/web/src/components/settings/CloudVoiceConfiguration.browser.test.tsx‎

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,33 @@ async function withVoicePanel(
8484
);
8585
}
8686

87+
it("cancelling a provider's setup keeps the current destination and writes nothing", async () => {
88+
chooseAudioDestination({ kind: "environment", environmentId: id });
89+
const writes: unknown[] = [];
90+
await withVoicePanel(
91+
(url, request, init) => {
92+
if (url.pathname === "/api/voice/cloud/keys")
93+
return Promise.resolve(Response.json({ openai: false, xai: true }));
94+
if (url.pathname !== "/api/voice/cloud/openai/key") return null;
95+
return new Request(request, init).json().then((body) => {
96+
writes.push(body);
97+
return new Response(null, { status: 204 });
98+
});
99+
},
100+
async (screen) => {
101+
const destination = screen.getByRole("combobox", { name: "Transcribe with" });
102+
await expect.element(destination).toHaveTextContent("Laptop");
103+
await destination.click();
104+
await page.getByRole("option", { name: "OpenAI via Laptop" }).click();
105+
const dialog = page.getByRole("dialog");
106+
await dialog.getByRole("button", { name: "Cancel" }).click();
107+
await expect.element(dialog).not.toBeInTheDocument();
108+
await expect.element(destination).toHaveTextContent("Laptop");
109+
expect(writes).toEqual([]);
110+
},
111+
);
112+
});
113+
87114
it("enables the chosen provider only after a successful setup", async () => {
88115
chooseAudioDestination({ kind: "environment", environmentId: id });
89116
const writes: unknown[] = [];
@@ -104,15 +131,9 @@ it("enables the chosen provider only after a successful setup", async () => {
104131
},
105132
async (screen) => {
106133
const destination = screen.getByRole("combobox", { name: "Transcribe with" });
107-
await expect.element(destination).toHaveTextContent("Laptop");
108134
await destination.click();
109135
await page.getByRole("option", { name: "OpenAI via Laptop" }).click();
110136
const dialog = page.getByRole("dialog");
111-
await dialog.getByRole("button", { name: "Cancel" }).click();
112-
await expect.element(destination).toHaveTextContent("Laptop");
113-
expect(writes).toEqual([]);
114-
await destination.click();
115-
await page.getByRole("option", { name: "OpenAI via Laptop" }).click();
116137
await dialog.getByRole("combobox", { name: "OpenAI API key source" }).click();
117138
await page.getByRole("option", { name: "Work vault" }).click();
118139
await dialog.getByLabelText("OpenAI API key reference").fill("op://Work/Voice/key");

0 commit comments

Comments
 (0)