Skip to content

Instantly share code, notes, and snippets.

@batmi02
Created April 16, 2020 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save batmi02/b13e088bf217cf6e9bab732ecb0c3245 to your computer and use it in GitHub Desktop.
Save batmi02/b13e088bf217cf6e9bab732ecb0c3245 to your computer and use it in GitHub Desktop.
public class LoginPage extends WebPage {
@UI(".auth-header") Label header;
@UI(".logo-w img") Image circleImage;
@UI(".alert-warning") public Text alert;
@ByText("Username") Label userLabel;
@ByText("Password") Label passwordLabel;
@UI(".os-icon-user-male-circle") Icon userIcon;
@UI(".os-icon-fingerprint") Icon fingerprintIcon;
@UI(".form-check-label") Checkbox rememberMe;
@UI("[src*=twitter]") Icon twitter;
@UI("[src*=facebook]") Icon facebook;
@UI("[src*=linkedin]") Icon linkedin;
TextField username, password;
Button logIn;
public LoginPage validatateForm() {
try {
header.is().displayed();
header.has().text("Login Form");
circleImage.is().displayed().fileName("logo-big.png");
userIcon.is().displayed();
fingerprintIcon.is().displayed();
userLabel.is().text("Username");
passwordLabel.is().text("Password");
username.is().core().attr("placeholder", "Enter your username");
password.is().core().attr("placeholder", "Enter your password");
logIn.is().text("Log In");
rememberMe.is().core().text("Remember Me");
twitter.is().displayed().fileName("twitter.png");
facebook.is().displayed().fileName("facebook.png");
linkedin.is().displayed().fileName("linkedin.png");
return this;
} catch (Exception ex) {
SoftAssert.assertResults();
throw new RuntimeException(ex);
}
}
public LoginPage validatateAlert(String message) {
alert.has().text(message)
.core().css("background-color", "rgba(252, 237, 190, 1)");
return this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment