Skip to content

Commit

Permalink
Development: Fix the login page e2e tests (#9289)
Browse files Browse the repository at this point in the history
  • Loading branch information
pzdr7 authored Sep 6, 2024
1 parent a67ce95 commit 6e92767
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/test/playwright/support/pageobjects/LoginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,33 @@ export class LoginPage {
}

/**
* Enters the specified username into the username input field.
* Enters the specified value into the input field with the specified selector, then blurs the input field.
* This is necessary because the username and password fields are only validated on blur, e.g. when the user clicks
* elsewhere on the page or presses the Tab key.
* @param selector The selector of the input field.
* @param value The value to be entered.
* @private
*/
private async fillThenBlurInput(selector: string, value: string) {
const locator = this.page.locator(selector);
await locator.fill(value);
await locator.blur();
}

/**
* Enters the specified username into the username input field, then blurs the input field.
* @param name - The username to be entered.
*/
async enterUsername(name: string) {
await this.page.fill('#username', name);
await this.fillThenBlurInput('#username', name);
}

/**
* Enters the specified password into the password input field.
* Enters the specified password into the password input field, then blurs the input field.
* @param password - The password to be entered.
*/
async enterPassword(password: string) {
await this.page.fill('#password', password);
await this.fillThenBlurInput('#password', password);
}

/**
Expand Down

0 comments on commit 6e92767

Please sign in to comment.