-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoginPage.java
38 lines (32 loc) · 1.03 KB
/
LoginPage.java
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
package org.login_tests;
import org.openqa.selenium.By;
import static com.codeborne.selenide.Selenide.$;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
class LoginPage {
// setters
public LoginPage setEmail(String email){
$(By.xpath("//*[@id='field_email']")).setValue(email);
return this;
}
public LoginPage setPwd(String pwd){
$(By.xpath("//*[@id=\"field_password\"]")).setValue(pwd);
return this;
}
// action on page
public LoginPage click(){
$(By.xpath("//div[@class=\"login-form-actions\"]/input")).click();
return this;
}
// takers
private String takeUserName(){
return $(By.xpath("//div[@class=\"tico ellip\"]")).text();
}
// checkers
public void checkUsername(String expectedUsername){
assertEquals(expectedUsername, this.takeUserName());
}
public void checkNotLogged(boolean expectedResult){
assertFalse(expectedResult);
}
}