Skip to content

Instantly share code, notes, and snippets.

@hoangsetup
Created June 19, 2021 08:37
Show Gist options
  • Save hoangsetup/2d4461bc0724eb79b2bf946692ed10f4 to your computer and use it in GitHub Desktop.
Save hoangsetup/2d4461bc0724eb79b2bf946692ed10f4 to your computer and use it in GitHub Desktop.
import BasePO from './base.po';
class LoginPO extends BasePO {
private readonly $usernameInput = '#user-name';
private readonly $passwordInput = '#password';
private readonly $loginButton = '#login-button';
private readonly $errorMessageContainer = '.error-message-container';
async go() {
await this.navigate('/');
}
async login(username: string, password: string) {
await page.type(this.$usernameInput, username);
await page.type(this.$passwordInput, password);
await page.click(this.$loginButton);
}
async getErrorMessage(): Promise<string> {
return this.getElementTextBySelector(this.$errorMessageContainer);
}
}
export default new LoginPO();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment