From 479412eb64fdaae89666df94ed395110749aa16f Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Wed, 28 Jan 2026 02:10:03 +0000 Subject: [PATCH] fix(frontend): fix e2e test signup/login redirect URL handling - Replace Promise.race() with single waitForURL callback in signup.ts to avoid race conditions with multiple independent timeouts - Add /library and /copilot to login.page.ts URL pattern to handle new post-login redirect destinations Co-authored-by: Nicholas Tindle --- .../frontend/src/tests/pages/login.page.ts | 6 +++++- autogpt_platform/frontend/src/tests/utils/signup.ts | 12 ++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/autogpt_platform/frontend/src/tests/pages/login.page.ts b/autogpt_platform/frontend/src/tests/pages/login.page.ts index 9082cc6219..e05807ce92 100644 --- a/autogpt_platform/frontend/src/tests/pages/login.page.ts +++ b/autogpt_platform/frontend/src/tests/pages/login.page.ts @@ -37,9 +37,13 @@ export class LoginPage { this.page.on("load", (page) => console.log(`ℹ️ Now at URL: ${page.url()}`)); // Start waiting for navigation before clicking + // Wait for redirect to marketplace, onboarding, library, or copilot (new landing pages) const leaveLoginPage = this.page .waitForURL( - (url) => /^\/(marketplace|onboarding(\/.*)?)?$/.test(url.pathname), + (url) => + /^\/(marketplace|onboarding(\/.*)?|library|copilot)?$/.test( + url.pathname, + ), { timeout: 10_000 }, ) .catch((reason) => { diff --git a/autogpt_platform/frontend/src/tests/utils/signup.ts b/autogpt_platform/frontend/src/tests/utils/signup.ts index a4120b9f07..6508fe339a 100644 --- a/autogpt_platform/frontend/src/tests/utils/signup.ts +++ b/autogpt_platform/frontend/src/tests/utils/signup.ts @@ -40,12 +40,12 @@ export async function signupTestUser( try { // Wait for redirect to onboarding, marketplace, copilot, or library - await Promise.race([ - page.waitForURL(/\/onboarding/, { timeout: 15000 }), - page.waitForURL(/\/marketplace/, { timeout: 15000 }), - page.waitForURL(/\/copilot/, { timeout: 15000 }), - page.waitForURL(/\/library/, { timeout: 15000 }), - ]); + // Use a single waitForURL with a callback to avoid Promise.race race conditions + await page.waitForURL( + (url) => + /\/(onboarding|marketplace|copilot|library)/.test(url.pathname), + { timeout: 15000 }, + ); } catch (error) { console.error( "❌ Timeout waiting for redirect, current URL:",