mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-22 12:03:58 +00:00
Added pages objects for authentication menu and view and sign in form
This commit is contained in:
1 parent
c9a4b586bb
commit
7b80e041e1
3 files changed
+105
No files matched your search
+32
@@ -0,0 +1,32 @@
|
||||
package com.sap.sailing.selenium.pages.authentication;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
import com.sap.sailing.selenium.pages.common.CSSHelper;
|
||||
|
||||
public class AuthenticationMenuPO extends PageArea {
|
||||
|
||||
private static final String CSS_CLASS_PREFIX = "com-sap-sse-security-ui-authentication-generic-sapheader-SAPHeaderWithAuthenticationResources-HeaderWithAuthenticationCss-";
|
||||
private static final String CSS_CLASS_OPEN = CSS_CLASS_PREFIX + "usermanagement_open";
|
||||
private static final String CSS_CLASS_LOGGED_IN = CSS_CLASS_PREFIX + "usermanagement_loggedin";
|
||||
|
||||
public AuthenticationMenuPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public boolean isOpen() {
|
||||
return CSSHelper.hasCSSClass(getWebElement(), CSS_CLASS_OPEN);
|
||||
}
|
||||
|
||||
public boolean isLoggedIn() {
|
||||
return CSSHelper.hasCSSClass(getWebElement(), CSS_CLASS_LOGGED_IN);
|
||||
}
|
||||
|
||||
public AuthenticationViewPO showAuthenticationView() {
|
||||
getWebElement().click();
|
||||
return new AuthenticationViewPO(driver, findElementBySeleniumId(driver, "authenticationView"));
|
||||
}
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.sap.sailing.selenium.pages.authentication;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
|
||||
public class AuthenticationViewPO extends PageArea {
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "signInForm")
|
||||
private WebElement signInFormPanel;
|
||||
|
||||
public AuthenticationViewPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public boolean isSignInFormDisplayed() {
|
||||
return signInFormPanel != null && signInFormPanel.isDisplayed();
|
||||
}
|
||||
|
||||
public SignInViewPO getSignInView() {
|
||||
if (!isSignInFormDisplayed()) throw new RuntimeException("Sign in form not displayed!");
|
||||
return new SignInViewPO(driver, signInFormPanel);
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package com.sap.sailing.selenium.pages.authentication;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
|
||||
public class SignInViewPO extends PageArea {
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "loginTextField")
|
||||
private WebElement loginTextField;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "passwordTextField")
|
||||
private WebElement passwordTextField;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "signInAnchor")
|
||||
private WebElement signInAnchor;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "signUpAnchor")
|
||||
private WebElement signUpAnchor;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "forgotPasswordAnchor")
|
||||
private WebElement forgotPasswordAnchor;
|
||||
|
||||
public SignInViewPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void doLogin(String username, String password) {
|
||||
loginTextField.clear();
|
||||
loginTextField.sendKeys(username);
|
||||
passwordTextField.clear();
|
||||
passwordTextField.sendKeys(password);
|
||||
signInAnchor.click();
|
||||
}
|
||||
|
||||
public void goToSignUpView() {
|
||||
signUpAnchor.click();
|
||||
}
|
||||
|
||||
public void goToForgotPasswordView() {
|
||||
forgotPasswordAnchor.click();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user