mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-28 00:18:25 -05:00
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 <ntindle@users.noreply.github.com>
This commit is contained in:
@@ -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) => {
|
||||
|
||||
@@ -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:",
|
||||
|
||||
Reference in New Issue
Block a user