Added initial selenium support for WindPanel

This commit is contained in:
Steffen Schaefer committed 2017-04-04 08:11:10 +02:00
1 parent 94f4d38fb5
commit c5f468ccc2
3 files changed
+74

No files matched your search

@@ -20,6 +20,7 @@ import com.sap.sailing.selenium.pages.adminconsole.regatta.RegattaStructureManag
import com.sap.sailing.selenium.pages.adminconsole.tracking.TrackedRacesCompetitorsPanelPO;
import com.sap.sailing.selenium.pages.adminconsole.tracking.TrackedRacesManagementPanelPO;
import com.sap.sailing.selenium.pages.adminconsole.tractrac.TracTracEventManagementPanelPO;
import com.sap.sailing.selenium.pages.adminconsole.wind.WindPanelPO;
/**
* <p>The page object representing the administration console. The console consists of multiple tabs with its content
@@ -53,6 +54,9 @@ public class AdminConsolePage extends HostPageWithAuthentication {
private static final String TRACKED_RACES_TAB_LABEL = "Tracked races"; //$NON-NLS-1$
private static final String TRACKED_RACES_TAB_IDENTIFIER = "TrackedRacesManagement"; //$NON-NLS-1$
private static final String WIND_TAB_LABEL = "Wind"; //$NON-NLS-1$
private static final String WIND_TAB_IDENTIFIER = "WindPanel"; //$NON-NLS-1$
private static final String LEADERBOARD_CONFIGURATION_TAB_PARENT_LABEL = "Leaderboards"; //$NON-NLS-1$
private static final String LEADERBOARD_CONFIGURATION_TAB_PARENT_IDENTIFIER = "LeaderboardPanel"; //$NON-NLS-1$
@@ -126,6 +130,12 @@ public class AdminConsolePage extends HostPageWithAuthentication {
return new TrackedRacesManagementPanelPO(this.driver, goToTab(TRACKED_RACES_TAB_LABEL,
TRACKED_RACES_TAB_IDENTIFIER, false));
}
public WindPanelPO goToWind() {
goToTab(TRACKED_RACES_TAB_PARENT_LABEL, TRACKED_RACES_TAB_PARENT_IDENTIFIER, true);
return new WindPanelPO(this.driver, goToTab(WIND_TAB_LABEL,
WIND_TAB_IDENTIFIER, false));
}
public LeaderboardConfigurationPanelPO goToLeaderboardConfiguration() {
goToTab(LEADERBOARD_CONFIGURATION_TAB_PARENT_LABEL, LEADERBOARD_CONFIGURATION_TAB_PARENT_IDENTIFIER, true);
@@ -0,0 +1,59 @@
package com.sap.sailing.selenium.pages.adminconsole.wind;
import org.openqa.selenium.Alert;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.FluentWait;
import com.google.common.base.Function;
import com.sap.sailing.selenium.core.BySeleniumId;
import com.sap.sailing.selenium.core.FindBy;
import com.sap.sailing.selenium.pages.PageArea;
public class WindPanelPO extends PageArea {
@FindBy(how = BySeleniumId.class, using = "ImportWindFromIgtimi")
private WebElement importWindFromIgtimi;
@FindBy(how = BySeleniumId.class, using = "IgtimiImportResultReport")
private WebElement igtimiImportResultReport;
public WindPanelPO(WebDriver driver, WebElement element) {
super(driver, element);
}
public void importWindFromIgtimi() throws InterruptedException {
importWindFromIgtimi.click();
int i = 0;
while (i < DEFAULT_WAIT_TIMEOUT_SECONDS) {
i++;
try {
Alert alert = driver.switchTo().alert();
alert.accept();
break;
} catch (NoAlertPresentException e) {
Thread.sleep(1000);
continue;
}
}
if (i >= DEFAULT_WAIT_TIMEOUT_SECONDS) {
throw new NoAlertPresentException();
}
FluentWait<String> wait = createFluentWait("The following number of fixes were imported for the listed races:", /* waiting 10 minutes at most */ 10 * 60, DEFAULT_POLLING_INTERVAL);
wait.until(new Function<String, Object>() {
@Override
public Object apply(String message) {
try {
String statusText = igtimiImportResultReport.getText();
return statusText.contains(message);
} catch (TimeoutException exception) {
return Boolean.FALSE;
}
}
});
}
}