Skip to content

Commit 1aa60ec

Browse files
committed
improve logging in login.page.ts for debug purposes
1 parent 8a4db8a commit 1aa60ec

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

autogpt_platform/frontend/src/tests/pages/login.page.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ export class LoginPage {
44
constructor(private page: Page) {}
55

66
async login(email: string, password: string) {
7-
console.log("Attempting login with:", { email, password }); // Debug log
7+
console.log(`Attempting login on ${this.page.url()} with`, {
8+
email,
9+
password,
10+
}); // Debug log
811

912
// Fill email
1013
const emailInput = this.page.getByPlaceholder("[email protected]");
@@ -35,15 +38,20 @@ export class LoginPage {
3538

3639
// Start waiting for navigation before clicking
3740
const navigationPromise = Promise.race([
38-
this.page.waitForURL("/", { timeout: 10_000 }), // Wait for home page
39-
this.page.waitForURL("/marketplace", { timeout: 10_000 }), // Wait for home page
40-
this.page.waitForURL("/onboarding/**", { timeout: 10_000 }), // Wait for onboarding page
41+
this.page
42+
.waitForURL(/^\/(marketplace|onboarding(\/.*)?)?$/, { timeout: 10_000 })
43+
.catch((reason) => {
44+
console.warn(
45+
`Navigation away from /login timed out: ${reason}. Current URL: ${this.page.url()}`,
46+
);
47+
throw reason;
48+
}), // Wait for home page
4149
]);
4250

43-
console.log("About to click login button"); // Debug log
51+
console.log(`About to click login button on ${this.page.url()}`); // Debug log
4452
await loginButton.click();
4553

46-
console.log("Waiting for navigation"); // Debug log
54+
console.log("Waiting for navigation away from /login"); // Debug log
4755
await navigationPromise;
4856

4957
await this.page.goto("/marketplace");

0 commit comments

Comments
 (0)