Created
June 19, 2021 08:37
-
-
Save hoangsetup/2d4461bc0724eb79b2bf946692ed10f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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