Skip to content

Commit dbc2053

Browse files
committed
Harden flaky e2e waits under CI shard load
1 parent 38df60e commit dbc2053

4 files changed

Lines changed: 17 additions & 6 deletions

File tree

e2e/scenarios/auth-methods-ui.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@ scenario(
3838
waitUntil: "networkidle",
3939
});
4040
// The URL auto-probes (debounced); the method list appears once
41-
// the probe lands.
42-
await page.getByText("How does this server authenticate?").waitFor();
41+
// the probe lands. Generous timeout: the probe request can queue
42+
// behind a busy dev server under CI load, and there is no clean
43+
// client-side re-trigger to poke mid-flight (the debounced probe
44+
// only re-fires on a URL change, and "Try again" only appears
45+
// after the probe has already failed).
46+
await page.getByText("How does this server authenticate?").waitFor({ timeout: 90_000 });
4347
});
4448

4549
await step("The probe seeded the detected method", async () => {

e2e/scenarios/health-checks-ui.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ scenario(
483483
await page.getByPlaceholder("https://api.example.com/openapi.json").fill(spec);
484484
await page
485485
.getByRole("heading", { name: "Health check (optional)" })
486-
.waitFor({ timeout: 20_000 });
486+
.waitFor({ timeout: 30_000 });
487487
});
488488

489489
await step("Type to reach an operation past the preview's top slice", async () => {

e2e/selfhost/auth-methods-ui.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ scenario(
4949
await page.goto(`/integrations/add/mcp?url=${encodeURIComponent(server.endpoint)}`, {
5050
waitUntil: "networkidle",
5151
});
52-
await page.getByText("How does this server authenticate?").waitFor();
52+
// Generous timeout: the debounced probe request can queue behind a
53+
// busy dev server under CI load, and there is no clean client-side
54+
// re-trigger to poke it mid-flight.
55+
await page.getByText("How does this server authenticate?").waitFor({ timeout: 90_000 });
5356
});
5457

5558
await step("The probe detected OAuth", async () => {

e2e/targets/cloud.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ const cookiePair = (response: Response, name: string): string | undefined => {
3232
const signIn = async (email: string): Promise<string> => {
3333
const login = await fetch(new URL("/api/auth/login", CLOUD_BASE_URL), { redirect: "manual" });
3434
const stateCookie = cookiePair(login, "wos-login-state");
35-
const authorizeUrl = new URL(login.headers.get("location") ?? "");
36-
if (!stateCookie || !authorizeUrl.searchParams.get("state")) {
35+
const location = login.headers.get("location");
36+
if (!stateCookie || !location) {
37+
throw new Error(`cloud signIn: login did not redirect to AuthKit (${login.status})`);
38+
}
39+
const authorizeUrl = new URL(location);
40+
if (!authorizeUrl.searchParams.get("state")) {
3741
throw new Error(`cloud signIn: login did not redirect to AuthKit (${login.status})`);
3842
}
3943
// The emulator's hosted login signs in headlessly via login_hint (creating

0 commit comments

Comments
 (0)