Skip to content

Commit a52d44d

Browse files
Fix: Cognito page (#277)
* Fix: Cognito page - replace deprecated waitForNavigation with waitForURL - use selectors that work across browsers/devices * change from type to name as type is not a valid option of getByRole * change IDP URL to RegExp matching anything since we only want to wait for navigation anywhere
1 parent 72f676b commit a52d44d

File tree

1 file changed

+6
-6
lines changed
  • packages/internal-playwright-helpers/src/pages

1 file changed

+6
-6
lines changed

packages/internal-playwright-helpers/src/pages/cognito.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ export class CognitoPage {
3333
}
3434

3535
async login(username: string, password: string) {
36-
await this.page.fill(".visible-lg [type=text]", username);
37-
await this.page.fill(".visible-lg [type=password]", password);
36+
await this.page.getByRole('textbox', { name: 'Username' }).fill(username);
37+
await this.page.getByRole('textbox', { name: 'Password' }).fill(password);
3838
await Promise.all([
39-
// It is important to call waitForNavigation before click to set up waiting.
40-
this.page.waitForNavigation(),
41-
// Clicking the link will indirectly cause a navigation.
42-
this.page.click(".visible-lg [aria-label=submit]"),
39+
// It is important to call waitForURL before click to set up waiting.
40+
this.page.waitForURL(/.*/),
41+
// Clicking the link will indirectly cause a navigation.
42+
this.page.getByRole('button', { name: 'submit' }).click(),
4343
]);
4444
}
4545
}

0 commit comments

Comments
 (0)