-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlogin.page.ts
More file actions
41 lines (35 loc) · 905 Bytes
/
login.page.ts
File metadata and controls
41 lines (35 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { $ } from '@wdio/globals'
import Page from './page.js'
/**
* sub page containing specific selectors and methods for a specific page
*/
class LoginPage extends Page {
/**
* define selectors using getter methods
*/
public get inputUsername() {
return $('#username')
}
public get inputPassword() {
return $('#password')
}
public get btnSubmit() {
return $('button[type="submit"]')
}
/**
* a method to encapsule automation code to interact with the page
* e.g. to login using username and password
*/
public async login(username: string, password: string) {
await this.inputUsername.setValue(username)
await this.inputPassword.setValue(password)
await this.btnSubmit.click()
}
/**
* overwrite specific options to adapt it to page object
*/
public open() {
return super.open('login')
}
}
export default new LoginPage()