Skip to content

Commit 15cdc04

Browse files
committed
Fix button selector in BasePage POM when multiple submit buttons are on page
1 parent 3a0b373 commit 15cdc04

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎test/e2e/helpers/pageObjectModels/BasePage.ts‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ export class BasePage extends BuiltInsPage {
691691

692692
this._page.on('response', response => {
693693
const status = response.status()
694-
if (status >= 400 && status < 500) {
694+
if (status === 404) {
695695
const method = response.request().method()
696696
const responseUrl = response.url()
697697
this.errors404.push(`${status} ${method} ${responseUrl}`)
@@ -916,11 +916,16 @@ export class BasePage extends BuiltInsPage {
916916
* Verify submit button is present and contains text
917917
*/
918918
async expectSubmitButton(text?: string): Promise<void> {
919-
const submitButton = this._page.locator('button[type="submit"]')
920-
await expect(submitButton).toBeVisible()
919+
const submitButtons = this._page.locator('button[type="submit"]')
920+
921921
if (text) {
922+
const submitButton = submitButtons.filter({ hasText: text }).first()
923+
await expect(submitButton).toBeVisible()
922924
await expect(submitButton).toContainText(text)
925+
return
923926
}
927+
928+
await expect(submitButtons.first()).toBeVisible()
924929
}
925930

926931
/**

0 commit comments

Comments
 (0)