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:
claude[bot]
2026-01-28 02:10:03 +00:00
parent 1b0271e912
commit 479412eb64
2 changed files with 11 additions and 7 deletions

View File

@@ -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) => {

View File

@@ -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:",