Skip to content

Commit 1186def

Browse files
markbrockhoffe-maad
authored andcommitted
test(WPB-19939): wait for login to finish before continuing (#19833)
1 parent d40d40d commit 1186def

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/e2e_tests/pageManager/webapp/pages/login.page.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import type {Page, Locator} from '@playwright/test';
2121

2222
import type {User} from 'test/e2e_tests/data/user';
2323

24+
import {webAppPath} from '../..';
25+
2426
export class LoginPage {
2527
readonly page: Page;
2628

@@ -44,5 +46,11 @@ export class LoginPage {
4446
await this.emailInput.fill(user.email);
4547
await this.passwordInput.fill(user.password);
4648
await this.signInButton.click();
49+
50+
/**
51+
* Since the login may take up to 40s we manually wait for it to finish here instead of increasing the timeout on all actions / assertions after this util
52+
* This is an exception to the general best practice of using playwrights web assertions. (See: https://playwright.dev/docs/best-practices#use-web-first-assertions)
53+
*/
54+
await this.page.waitForURL(new RegExp(`^${webAppPath}$`), {timeout: 40_000, waitUntil: 'networkidle'});
4755
}
4856
}

0 commit comments

Comments
 (0)