switch using annotation

#5153
This commit is contained in:
Georg Herdt committed 2020-03-06 16:14:50 +01:00
1 parent f711b83571
commit f1c9710b49
2 files changed
+79 -14

No files matched your search

@@ -4,6 +4,7 @@ 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.HostPage;
import com.sap.sailing.selenium.pages.HostPageWithAuthentication;
import com.sap.sailing.selenium.pages.PageObject;
@@ -13,6 +14,42 @@ import com.sap.sailing.selenium.pages.PageObject;
*/
public class HomePage extends HostPageWithAuthentication {
@FindBy(how = BySeleniumId.class, using = "shortcutIcon")
private WebElement favIcon;
@FindBy(how = BySeleniumId.class, using = "logoImage")
private WebElement sapSailingHeaderImage;
@FindBy(how=BySeleniumId.class, using ="logoAnchor")
private WebElement logoAnchor;
@FindBy(how=BySeleniumId.class, using ="solutionsPageLink")
private WebElement solutionsPageLink;
@FindBy(how=BySeleniumId.class, using ="socialFooter")
private WebElement socialMediaFooter;
@FindBy(how=BySeleniumId.class, using ="copyrightDiv")
private WebElement copyrightDiv;
@FindBy(how=BySeleniumId.class, using = "imprintAnchorLink")
private WebElement imprintAnchorLink;
@FindBy(how=BySeleniumId.class, using = "privacyAnchorLink")
private WebElement privacyAnchorLink;
@FindBy(how=BySeleniumId.class, using = "sapJobsAnchor")
private WebElement sapJobsAnchor;
@FindBy(how = BySeleniumId.class, using = "feedbackAnchor")
private WebElement feedbackAnchor;
@FindBy(how= BySeleniumId.class, using = "whatsNewAnchor")
private WebElement whatsNewAnchor;
@FindBy(how=BySeleniumId.class, using ="languageSelector")
private WebElement languageSelector;
/**
* Navigates to the home page and provides the corresponding {@link PageObject}.
*
@@ -44,7 +81,7 @@ public class HomePage extends HostPageWithAuthentication {
}
public WebElement getFavicon() {
return driver.findElement(new BySeleniumId("shortcutIcon"));
return favIcon;
}
public String getPageTitle() {
@@ -52,39 +89,50 @@ public class HomePage extends HostPageWithAuthentication {
}
public WebElement getSapSailingHeaderImage() {
return driver.findElement(new BySeleniumId("logoImage"));
return sapSailingHeaderImage;
}
public WebElement getLogoAnchor() {
return driver.findElement(new BySeleniumId("logoAnchor"));
return logoAnchor;
}
public WebElement getSolutionsPageLink() {
return driver.findElement(new BySeleniumId("solutionsPageLink"));
return solutionsPageLink;
}
public WebElement getSocialmediaFooter() {
throw new RuntimeException("");
return socialMediaFooter;
}
public WebElement getCopyrightLink() {
throw new RuntimeException("");
public WebElement getCopyrightDiv() {
return copyrightDiv;
}
public WebElement getImprintLink() {
return imprintAnchorLink;
}
public WebElement getPrivacyLink() {
return privacyAnchorLink;
}
public WebElement getJobsLink() {
throw new RuntimeException("");
return sapJobsAnchor;
}
public WebElement getFeedbackLink() {
throw new RuntimeException("");
return feedbackAnchor;
}
public WebElement getNewsLink() {
throw new RuntimeException("");
return whatsNewAnchor;
}
public WebElement getLanguageSelectionLabel() {
throw new RuntimeException("");
return languageSelector;
}
public void clickOnEventsMenuItem() {
driver.findElement(new BySeleniumId("eventsPage")).click();
}
}
@@ -22,6 +22,10 @@ public class RaceBoardPage extends HostPageWithAuthentication {
@FindBy(how = BySeleniumId.class, using = "raceMapSettingsButton")
private WebElement raceMapSettingsButton;
@FindBy(how=BySeleniumId.class, using = "dataByContainer")
private WebElement dataByContainer;
private boolean doneInit;
/**
@@ -137,13 +141,23 @@ public class RaceBoardPage extends HostPageWithAuthentication {
return new LeaderboardSettingsDialogPO(driver, findElementBySeleniumId("LeaderboardSettingsDialog"));
}
public boolean isRaceBoardLogoExisting() {
return !driver.findElements(new BySeleniumId("raceBoardSapLogo")).isEmpty();
}
public WebElement getDataByContainer() {
return dataByContainer;
}
public static RaceBoardPage goToRaceboardUrl(WebDriver webDriver,String context, String leaderboardName, String regattaName,
String raceName) throws UnsupportedEncodingException {
return goToRaceboardUrl(webDriver, context, leaderboardName, regattaName, raceName, null);
String raceName, boolean whitelabel) throws UnsupportedEncodingException {
return goToRaceboardUrl(webDriver, context, leaderboardName, regattaName, raceName, null, whitelabel);
}
public static RaceBoardPage goToRaceboardUrl(WebDriver webDriver,String context, String leaderboardName, String regattaName,
String raceName, String raceMode) throws UnsupportedEncodingException {
String raceName, String raceMode, boolean whitelabel) throws UnsupportedEncodingException {
// private static final String EVENT_LINK = "gwt/RaceBoard.html?leaderboardName=BMW+Cup+(J80)&regattaName=BMW+Cup+(J80)&raceName=BMW+Cup+Race+1&canReplayDuringLiveRaces=true";
String escapedLeaderBoardName = URLEncoder.encode(leaderboardName,"UTF-8");
String escapedRegattaName = URLEncoder.encode(regattaName, "UTF-8");
@@ -153,6 +167,9 @@ public class RaceBoardPage extends HostPageWithAuthentication {
if(raceMode != null) {
url += "&mode=" + URLEncoder.encode(raceMode, "UTF-8");
}
if (whitelabel) {
url += "&whitelabel";
}
return goToRaceboardUrl(webDriver, url);
}