From f1c9710b497d9d43d3d3ca55c19337caa45c3583 Mon Sep 17 00:00:00 2001 From: Georg Herdt Date: Fri, 6 Mar 2020 16:14:50 +0100 Subject: [PATCH] switch using annotation #5153 --- .../sailing/selenium/pages/home/HomePage.java | 70 ++++++++++++++++--- .../pages/raceboard/RaceBoardPage.java | 23 +++++- 2 files changed, 79 insertions(+), 14 deletions(-) diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/home/HomePage.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/home/HomePage.java index a11da18e8fc..d76fd95ab62 100644 --- a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/home/HomePage.java +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/home/HomePage.java @@ -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(); + } } diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/raceboard/RaceBoardPage.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/raceboard/RaceBoardPage.java index 9c7e044813c..78cbad43370 100644 --- a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/raceboard/RaceBoardPage.java +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/raceboard/RaceBoardPage.java @@ -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)®attaName=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); }