mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-25 21:43:49 +00:00
New page objects and corresponding debug-ids added as well as some
refactoring of old ones for better maintainability.
This commit is contained in:
1 parent
218a7b28d7
commit
818de01c3f
53 files changed
+2201
-397
No files matched your search
@@ -49,4 +49,10 @@ public class BySeleniumId extends By {
|
||||
public List<WebElement> findElements(SearchContext context) {
|
||||
return context.findElements(By.xpath(BY_SELENIUM_ID.format(new Object[] {this.id})));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BySeleniumId: " + this.id;
|
||||
}
|
||||
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole;
|
||||
|
||||
import org.openqa.selenium.Alert;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.NoAlertPresentException;
|
||||
import org.openqa.selenium.SearchContext;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebDriver.TargetLocator;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.ui.FluentWait;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.sap.sailing.selenium.pages.PageObject;
|
||||
|
||||
public class Actions {
|
||||
private static final String ACTION_XPATH = ".//descendant::div[@name='%s']/img";
|
||||
|
||||
public static final String EDIT_ACTION = "ACTION_EDIT";
|
||||
|
||||
public static final String REMOVE_ACTION = "ACTION_REMOVE";
|
||||
|
||||
public static final String EDIT_SCORES_ACTION = "ACTION_EDIT_SCORES";
|
||||
|
||||
public static final String CONFIGURE_URL_ACTION = "ACTION_CONFIGURE_URL";
|
||||
|
||||
public static final String UNLINK_RACE_ACTION = "ACTION_UNLINK";
|
||||
|
||||
public static final String REFRESH_RACE_ACTION = "ACTION_REFRESH_RACE";
|
||||
|
||||
public static WebElement findEditAction(SearchContext context) {
|
||||
return context.findElement(By.xpath(String.format(ACTION_XPATH, EDIT_ACTION)));
|
||||
}
|
||||
|
||||
public static WebElement findRemoveAction(SearchContext context) {
|
||||
return context.findElement(By.xpath(String.format(ACTION_XPATH, REMOVE_ACTION)));
|
||||
}
|
||||
|
||||
public static WebElement findEditScoresAction(SearchContext context) {
|
||||
return context.findElement(By.xpath(String.format(ACTION_XPATH, EDIT_SCORES_ACTION)));
|
||||
}
|
||||
|
||||
public static WebElement findConfigureUrlAction(SearchContext context) {
|
||||
return context.findElement(By.xpath(String.format(ACTION_XPATH, CONFIGURE_URL_ACTION)));
|
||||
}
|
||||
|
||||
public static WebElement findUnlinkRaceAction(SearchContext context) {
|
||||
return context.findElement(By.xpath(String.format(ACTION_XPATH, UNLINK_RACE_ACTION)));
|
||||
}
|
||||
|
||||
public static WebElement findRefreshAction(SearchContext context) {
|
||||
return context.findElement(By.xpath(String.format(ACTION_XPATH, REFRESH_RACE_ACTION)));
|
||||
}
|
||||
|
||||
public static void acceptAlert(WebDriver driver) {
|
||||
Alert alert = getAlert(driver);
|
||||
alert.accept();
|
||||
}
|
||||
|
||||
public static void dismissAlert(WebDriver driver) {
|
||||
Alert alert = getAlert(driver);
|
||||
alert.dismiss();
|
||||
}
|
||||
|
||||
public static Alert getAlert(WebDriver driver) {
|
||||
FluentWait<WebDriver> wait = PageObject.createFluentWait(driver, NoAlertPresentException.class);
|
||||
|
||||
Alert alert = wait.until(new Function<WebDriver, Alert>() {
|
||||
@Override
|
||||
public Alert apply(WebDriver driver) {
|
||||
TargetLocator locator = driver.switchTo();
|
||||
|
||||
return locator.alert();
|
||||
}
|
||||
});
|
||||
|
||||
return alert;
|
||||
}
|
||||
}
|
||||
+1
@@ -184,6 +184,7 @@ public class AdminConsolePage extends HostPage {
|
||||
}
|
||||
|
||||
// We have to determine the location where we have to click at the tab for the case its not completely visible.
|
||||
// NOTE: We assume that the browser window is big enough to display at least 2 tabs!
|
||||
org.openqa.selenium.interactions.Actions actions = new Actions(this.driver);
|
||||
actions.moveToElement(tab, determineOffsetForClick(tab), 5);
|
||||
actions.click();
|
||||
|
||||
+13
-29
@@ -5,43 +5,27 @@ 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 FlexibleLeaderboardCreateDialog extends PageArea {
|
||||
@FindBy(how = BySeleniumId.class, using = "OkButton")
|
||||
private WebElement okButton;
|
||||
@FindBy(how = BySeleniumId.class, using = "CancelButton")
|
||||
private WebElement cancelButton;
|
||||
@FindBy(how = BySeleniumId.class, using = "LeaderboardNameField")
|
||||
private WebElement nameField;
|
||||
@FindBy(how = BySeleniumId.class, using = "StatusLabel")
|
||||
private WebElement statusLabel;
|
||||
import com.sap.sailing.selenium.pages.common.DataEntryDialog;
|
||||
|
||||
public class FlexibleLeaderboardCreateDialog extends DataEntryDialog {
|
||||
@FindBy(how = BySeleniumId.class, using = "NameTextBox")
|
||||
private WebElement nameTextBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "DisplayNameTextBox")
|
||||
private WebElement displayNameTextBox;
|
||||
|
||||
public FlexibleLeaderboardCreateDialog(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.nameField.clear();
|
||||
this.nameField.sendKeys(name);
|
||||
this.nameTextBox.clear();
|
||||
this.nameTextBox.sendKeys(name);
|
||||
}
|
||||
|
||||
public boolean isOkEnabled() {
|
||||
return this.okButton.isEnabled();
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return this.statusLabel.getText();
|
||||
}
|
||||
|
||||
public void pressOk() {
|
||||
this.okButton.click();
|
||||
|
||||
// Wait, since we create the flexible leader board
|
||||
waitForAjaxRequests();
|
||||
}
|
||||
|
||||
public void pressCancel() {
|
||||
this.cancelButton.click();
|
||||
public void setDisplayName(String name) {
|
||||
this.displayNameTextBox.clear();
|
||||
this.displayNameTextBox.sendKeys(name);
|
||||
}
|
||||
}
|
||||
+112
-43
@@ -9,8 +9,16 @@ 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;
|
||||
import com.sap.sailing.selenium.test.gwt.widgets.CellTable;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.Actions;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.regatta.RegattaListComposite.RegattaDescriptor;
|
||||
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTable;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntry;
|
||||
import com.sap.sailing.selenium.pages.gwt.GenericCellTable;
|
||||
|
||||
public class LeaderboardConfigurationPanel extends PageArea {
|
||||
@FindBy(how = BySeleniumId.class, using = "CreateFlexibleLeaderboardButton")
|
||||
@@ -19,62 +27,123 @@ public class LeaderboardConfigurationPanel extends PageArea {
|
||||
@FindBy(how = BySeleniumId.class, using = "CreateRegattaLeaderboardButton")
|
||||
private WebElement createRegattaLeaderboardButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "AvailableLeaderboardsTable")
|
||||
private WebElement availableLeaderboardsTable;
|
||||
@FindBy(how = BySeleniumId.class, using = "RemoveLeaderboardsButton")
|
||||
private WebElement removeLeaderboardsButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "LeaderboardsFilterTextBox")
|
||||
private WebElement leaderboardsFilterTextBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "LeaderboardsCellTable")
|
||||
private WebElement leaderboardsCellTable;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "LeaderboardDetailsPanel")
|
||||
private WebElement leaderboardDetailsPanel;
|
||||
|
||||
public LeaderboardConfigurationPanel(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
|
||||
public List<String> getAvailableLeaderboards() {
|
||||
List<String> leaderboards = new ArrayList<>();
|
||||
|
||||
CellTable table = getLeaderboardTable();
|
||||
List<WebElement> rows = table.getRows();
|
||||
|
||||
for(WebElement row : rows) {
|
||||
WebElement name = row.findElement(By.xpath(".//td/div/a"));
|
||||
|
||||
leaderboards.add(name.getText());
|
||||
}
|
||||
|
||||
return leaderboards;
|
||||
}
|
||||
|
||||
public void deleteLeaderboard(String leaderboard) {
|
||||
CellTable table = getLeaderboardTable();
|
||||
List<WebElement> rows = table.getRows();
|
||||
|
||||
for(WebElement row : rows) {
|
||||
WebElement name = row.findElement(By.xpath(".//td/div/a"));
|
||||
|
||||
if(!leaderboard.equals(name.getText()))
|
||||
continue;
|
||||
|
||||
WebElement removeAction = row.findElement(By.xpath(".//td/div/div[@title='Remove']/img"));
|
||||
|
||||
removeAction.click();
|
||||
|
||||
this.driver.switchTo().alert().accept();
|
||||
}
|
||||
}
|
||||
|
||||
public FlexibleLeaderboardCreateDialog startCreatingFlexibleLeaderboard() {
|
||||
this.createFlexibleLeaderboardButton.click();
|
||||
// Wait, since we trigger an AJAX-request to get the available events
|
||||
waitForAjaxRequests();
|
||||
WebElement dialog = findElementBySeleniumId(this.driver, "CreateFlexibleLeaderboardDialog");
|
||||
|
||||
WebElement dialog = findElementBySeleniumId(this.driver, "FlexibleLeaderboardCreateDialog");
|
||||
|
||||
return new FlexibleLeaderboardCreateDialog(this.driver, dialog);
|
||||
}
|
||||
|
||||
private CellTable getLeaderboardTable() {
|
||||
return new CellTable(this.driver, this.availableLeaderboardsTable);
|
||||
// TODO: Extend with display name, scoring system, event, course area and discars
|
||||
public void createFlexibleLeaderboard(String name) {
|
||||
FlexibleLeaderboardCreateDialog dialog = startCreatingFlexibleLeaderboard();
|
||||
dialog.setName(name);
|
||||
dialog.pressOk();
|
||||
}
|
||||
|
||||
protected void initElements() {
|
||||
super.initElements();
|
||||
public RegattaLeaderboardCreateDialog startCreatingRegattaLeaderboard() {
|
||||
this.createRegattaLeaderboardButton.click();
|
||||
|
||||
//this.availableLeaderboardsTable = new CellTable(this.driver, findElementBySeleniumId("AvailableLeaderboardsTable"));
|
||||
WebElement dialog = findElementBySeleniumId(this.driver, "RegattaLeaderboardCreateDialog");
|
||||
|
||||
return new RegattaLeaderboardCreateDialog(this.driver, dialog);
|
||||
}
|
||||
|
||||
public void createRegattaLeaderboard(RegattaDescriptor regatta) {
|
||||
RegattaLeaderboardCreateDialog dialog = startCreatingRegattaLeaderboard();
|
||||
dialog.selectRegatta(regatta);
|
||||
dialog.pressOk();
|
||||
}
|
||||
|
||||
public void deleteLeaderboard(String leaderboard) {
|
||||
DataEntry entry = findLeaderboard(leaderboard);
|
||||
|
||||
if(entry != null) {
|
||||
WebElement removeAction = Actions.findRemoveAction(entry.getWebElement());
|
||||
removeAction.click();
|
||||
|
||||
Actions.acceptAlert(this.driver);
|
||||
|
||||
waitForAjaxRequests();
|
||||
}
|
||||
}
|
||||
|
||||
public String getLeaderboardURL(String leaderboard) {
|
||||
DataEntry entry = findLeaderboard(leaderboard);
|
||||
|
||||
if(entry != null) {
|
||||
WebElement link = entry.getWebElement().findElement(By.xpath(".//td/div/a"));
|
||||
|
||||
return link.getAttribute("href");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<String> getAvailableLeaderboards() {
|
||||
List<String> leaderboards = new ArrayList<>();
|
||||
|
||||
CellTable<DataEntry> table = getLeaderboardTable();
|
||||
List<DataEntry> entries = table.getEntries();
|
||||
|
||||
for(DataEntry entry : entries) {
|
||||
leaderboards.add(entry.getColumnContent(0));
|
||||
}
|
||||
|
||||
return leaderboards;
|
||||
}
|
||||
|
||||
public LeaderboardDetailsPanel getLeaderboardDetails(String leaderboard) {
|
||||
CellTable<DataEntry> table = getLeaderboardTable();
|
||||
List<DataEntry> entries = table.getEntries();
|
||||
|
||||
for(DataEntry entry : entries) {
|
||||
String name = entry.getColumnContent(0);
|
||||
|
||||
if(leaderboard.equals(name)) {
|
||||
entry.select();
|
||||
|
||||
return new LeaderboardDetailsPanel(this.driver, this.leaderboardDetailsPanel);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private CellTable<DataEntry> getLeaderboardTable() {
|
||||
return new GenericCellTable<>(this.driver, this.leaderboardsCellTable, DataEntry.class);
|
||||
}
|
||||
|
||||
private DataEntry findLeaderboard(String leaderboard) {
|
||||
CellTable<DataEntry> table = getLeaderboardTable();
|
||||
|
||||
for(DataEntry entry : table.getEntries()) {
|
||||
String name = entry.getColumnContent(0);
|
||||
|
||||
if(leaderboard.equals(name)) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+203
@@ -0,0 +1,203 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.leaderboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
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;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.Actions;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.tracking.TrackedRacesList.TrackedRaceDescriptor;
|
||||
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTable;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntry;
|
||||
import com.sap.sailing.selenium.pages.gwt.GenericCellTable;
|
||||
|
||||
public class LeaderboardDetailsPanel extends PageArea {
|
||||
public static class RaceDescriptor {
|
||||
private final String name;
|
||||
private final String fleet;
|
||||
private final boolean medalRace;
|
||||
private final boolean linked;
|
||||
private final double factor;
|
||||
|
||||
public RaceDescriptor(String name, String fleet, boolean medalRace, boolean linked, double factor) {
|
||||
this.name = name;
|
||||
this.fleet = fleet;
|
||||
this.medalRace = medalRace;
|
||||
this.linked = linked;
|
||||
this.factor = factor;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getFleet() {
|
||||
return this.fleet;
|
||||
}
|
||||
|
||||
public boolean isMedalRace() {
|
||||
return this.medalRace;
|
||||
}
|
||||
|
||||
public boolean isLinked() {
|
||||
return this.linked;
|
||||
}
|
||||
|
||||
public double getFactor() {
|
||||
return this.factor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.name, this.fleet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (this == object)
|
||||
return true;
|
||||
|
||||
if (object == null)
|
||||
return false;
|
||||
|
||||
if (getClass() != object.getClass())
|
||||
return false;
|
||||
|
||||
RaceDescriptor other = (RaceDescriptor) object;
|
||||
|
||||
if(!Objects.equals(this.name, other.name))
|
||||
return false;
|
||||
|
||||
if(!Objects.equals(this.fleet, other.fleet))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RacesCellTable")
|
||||
private WebElement racesCellTable;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "TrackedRacesListComposite")
|
||||
private WebElement trackedRacesListComposite;
|
||||
|
||||
public LeaderboardDetailsPanel(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public List<RaceDescriptor> getRaces() {
|
||||
List<RaceDescriptor> result = new ArrayList<>();
|
||||
|
||||
CellTable<DataEntry> racesTable = getRacesTable();
|
||||
|
||||
for(DataEntry entry : racesTable.getEntries()) {
|
||||
String name = entry.getColumnContent(0);
|
||||
String fleet = entry.getColumnContent(1);
|
||||
//String medalRace = entry.getColumnContent(2);
|
||||
//String linked = entry.getColumnContent(3);
|
||||
//String factor = entry.getColumnContent(4);
|
||||
|
||||
result.add(new RaceDescriptor(name, fleet, false, false, 0.0));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public RaceEditDialog editRace(RaceDescriptor race) {
|
||||
//
|
||||
// WebElement action = Actions.findEditAction(findRace(race));
|
||||
//
|
||||
// action.click();
|
||||
// }
|
||||
|
||||
public void unlinkRace(RaceDescriptor race) {
|
||||
DataEntry entry = findRace(race);
|
||||
|
||||
if(entry != null) {
|
||||
WebElement action = Actions.findUnlinkRaceAction(entry.getWebElement());
|
||||
|
||||
action.click();
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshRaceLog(RaceDescriptor race) {
|
||||
DataEntry entry = findRace(race);
|
||||
|
||||
if(entry != null) {
|
||||
WebElement action = Actions.findRefreshAction(entry.getWebElement());
|
||||
|
||||
action.click();
|
||||
|
||||
// QUESTION [D049941]: What else can happen?
|
||||
Actions.acceptAlert(this.driver);
|
||||
}
|
||||
}
|
||||
|
||||
public void linkRace(RaceDescriptor race, TrackedRaceDescriptor tracking) {
|
||||
DataEntry raceRow = findRace(race);
|
||||
DataEntry trackingRow = findTracking(tracking);
|
||||
|
||||
if(raceRow == null || trackingRow == null) {
|
||||
}
|
||||
|
||||
raceRow.select();
|
||||
trackingRow.select();
|
||||
}
|
||||
|
||||
private DataEntry findRace(RaceDescriptor race) {
|
||||
CellTable<DataEntry> racesTable = getRacesTable();
|
||||
|
||||
for(DataEntry entry : racesTable.getEntries()) {
|
||||
String name = entry.getColumnContent(0);
|
||||
String fleet = entry.getColumnContent(1);
|
||||
//String medalRace = entry.getColumnContent(2);
|
||||
//String linked = entry.getColumnContent(3);
|
||||
//String factor = entry.getColumnContent(4);
|
||||
|
||||
RaceDescriptor descriptor = new RaceDescriptor(name, fleet, false, false, 0.0);
|
||||
|
||||
if(descriptor.equals(race))
|
||||
return entry;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private DataEntry findTracking(TrackedRaceDescriptor tracking) {
|
||||
CellTable<DataEntry> trackingTable = getTrackedRacesTable();
|
||||
|
||||
for(DataEntry entry : trackingTable.getEntries()) {
|
||||
String regatta = entry.getColumnContent(0);
|
||||
String boatClass = entry.getColumnContent(1);
|
||||
String raceName = entry.getColumnContent(2);
|
||||
|
||||
TrackedRaceDescriptor descriptor = new TrackedRaceDescriptor(regatta, boatClass, raceName);
|
||||
|
||||
if(descriptor.equals(tracking))
|
||||
return entry;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private CellTable<DataEntry> getRacesTable() {
|
||||
return new GenericCellTable<>(this.driver, this.racesCellTable, DataEntry.class);
|
||||
}
|
||||
|
||||
private CellTable<DataEntry> getTrackedRacesTable() {
|
||||
WebElement table = findElementBySeleniumId(this.trackedRacesListComposite, "TrackedRacesCellTable");
|
||||
|
||||
return new GenericCellTable<>(this.driver, table, DataEntry.class);
|
||||
}
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.leaderboard;
|
||||
|
||||
import static com.sap.sailing.selenium.pages.gwt.query.Alias.$;
|
||||
|
||||
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;
|
||||
import com.sap.sailing.selenium.pages.adminconsole.Actions;
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTable;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntry;
|
||||
import com.sap.sailing.selenium.pages.gwt.GenericCellTable;
|
||||
import com.sap.sailing.selenium.pages.gwt.query.Alias;
|
||||
import com.sap.sailing.selenium.pages.gwt.query.TableQuery;
|
||||
|
||||
public class LeaderboardGroupConfigurationPanel extends PageArea {
|
||||
@FindBy(how = BySeleniumId.class, using = "CreateLeaderboardGroupButton")
|
||||
private WebElement createLeaderboardGroupButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RemoveLeaderboardsButton")
|
||||
private WebElement removeButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "LeaderboardGroupsCellTable")
|
||||
private WebElement leaderboardGroupsTable;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "LeaderboardGroupDetailsPanel")
|
||||
private WebElement leaderboardGroupDetailsPanel;
|
||||
|
||||
public LeaderboardGroupConfigurationPanel(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public LeaderboardGroupCreateDialog startCreatingLeaderboardGroup() {
|
||||
this.createLeaderboardGroupButton.click();
|
||||
|
||||
WebElement dialog = findElementBySeleniumId(this.driver, "LeaderboardGroupCreateDialog");
|
||||
|
||||
return new LeaderboardGroupCreateDialog(this.driver, dialog);
|
||||
}
|
||||
|
||||
public void createLeaderboardGroup(String name, String description) {
|
||||
LeaderboardGroupCreateDialog dialog = startCreatingLeaderboardGroup();
|
||||
dialog.setName(name);
|
||||
dialog.setDescription(description);
|
||||
dialog.pressOk();
|
||||
}
|
||||
|
||||
public CellTable<DataEntry> getLeaderboardGroupsTable() {
|
||||
return new GenericCellTable<DataEntry>(this.driver, this.leaderboardGroupsTable, DataEntry.class);
|
||||
}
|
||||
|
||||
public void deleteLeaderboardGroup(String name) {
|
||||
DataEntry result = findLeaderboardGroup(name);
|
||||
|
||||
if (result != null) {
|
||||
Actions.findRemoveAction(result.getWebElement()).click();
|
||||
Actions.acceptAlert(this.driver);
|
||||
|
||||
waitForAjaxRequests();
|
||||
}
|
||||
}
|
||||
|
||||
public LeaderboardGroupDetailsPanel getLeaderboardGroupDetails(String name) {
|
||||
DataEntry result = findLeaderboardGroup(name);
|
||||
|
||||
if (result != null) {
|
||||
result.select();
|
||||
}
|
||||
|
||||
return getLeaderboardGroupDetails();
|
||||
}
|
||||
|
||||
public LeaderboardGroupDetailsPanel getLeaderboardGroupDetails() {
|
||||
if(!this.leaderboardGroupDetailsPanel.isDisplayed()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new LeaderboardGroupDetailsPanel(this.driver, this.leaderboardGroupDetailsPanel);
|
||||
}
|
||||
|
||||
private DataEntry findLeaderboardGroup(String name) {
|
||||
CellTable<DataEntry> table = getLeaderboardGroupsTable();
|
||||
final DataEntry alias = Alias.alias(DataEntry.class);
|
||||
TableQuery<DataEntry> query = new TableQuery<>();
|
||||
query.from(table)
|
||||
.where(
|
||||
$(alias.getColumnContent("Name")).eq(name)
|
||||
);
|
||||
|
||||
return query.firstResult();
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.leaderboard;
|
||||
|
||||
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.common.DataEntryDialog;
|
||||
|
||||
public class LeaderboardGroupCreateDialog extends DataEntryDialog {
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "NameTextBox")
|
||||
private WebElement nameField;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "DescriptionTextArea")
|
||||
private WebElement descriptionField;
|
||||
|
||||
public LeaderboardGroupCreateDialog(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.nameField.clear();
|
||||
this.nameField.sendKeys(name);
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.descriptionField.clear();
|
||||
this.descriptionField.sendKeys(description);
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.leaderboard;
|
||||
|
||||
import static com.sap.sailing.selenium.pages.gwt.query.Alias.$;
|
||||
|
||||
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;
|
||||
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTable;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntry;
|
||||
import com.sap.sailing.selenium.pages.gwt.GenericCellTable;
|
||||
|
||||
import com.sap.sailing.selenium.pages.gwt.query.Alias;
|
||||
import com.sap.sailing.selenium.pages.gwt.query.TableQuery;
|
||||
|
||||
public class LeaderboardGroupDetailsPanel extends PageArea {
|
||||
@FindBy(how = BySeleniumId.class, using = "LeaderboardsFilterTextBox")
|
||||
private WebElement leaderboardsFilterTextBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "LeaderboardsCellTable")
|
||||
private WebElement leaderboardsCellTable;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RefreshLeaderboardsButton")
|
||||
private WebElement refreshLeaderboardsButton;
|
||||
|
||||
public LeaderboardGroupDetailsPanel(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void refreshLeaderboards() {
|
||||
this.refreshLeaderboardsButton.click();
|
||||
}
|
||||
|
||||
public CellTable<DataEntry> getLeaderboardsTable() {
|
||||
return new GenericCellTable<DataEntry>(this.driver, this.leaderboardsCellTable, DataEntry.class);
|
||||
}
|
||||
|
||||
public DataEntry findLeaderboardEntry(String name) {
|
||||
CellTable<DataEntry> table = getLeaderboardsTable();
|
||||
DataEntry alias = Alias.alias(DataEntry.class);
|
||||
|
||||
TableQuery<DataEntry> query = new TableQuery<>();
|
||||
query.from(table).
|
||||
where($(alias.getColumnContent("Leaderboard Name")).eq(name));
|
||||
|
||||
return query.firstResult();
|
||||
}
|
||||
|
||||
public void filterLeaderboards(String filterText) {
|
||||
this.leaderboardsFilterTextBox.clear();
|
||||
this.leaderboardsFilterTextBox.sendKeys(filterText);
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.leaderboard;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.ui.Select;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.regatta.RegattaListComposite.RegattaDescriptor;
|
||||
import com.sap.sailing.selenium.pages.common.DataEntryDialog;
|
||||
|
||||
public class RegattaLeaderboardCreateDialog extends DataEntryDialog {
|
||||
@FindBy(how = BySeleniumId.class, using = "NameTextBox")
|
||||
private WebElement nameTextField;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RegattaListBox")
|
||||
private WebElement regattaDropDown;
|
||||
|
||||
public RegattaLeaderboardCreateDialog(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void selectRegatta(RegattaDescriptor regatta) {
|
||||
Select dropDown = new Select(this.regattaDropDown);
|
||||
dropDown.selectByValue(regatta.toString());
|
||||
}
|
||||
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.regatta;
|
||||
|
||||
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.common.DataEntryDialog;
|
||||
|
||||
public class RegattaCreateDialog extends DataEntryDialog {
|
||||
@FindBy(how = BySeleniumId.class, using = "RegattaNameTextField")
|
||||
private WebElement regattaNameTextField;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "BoatClassTextField")
|
||||
private WebElement boatClassTextField;
|
||||
|
||||
// @FindBy(how = BySeleniumId.class, using = "ScoringSchemeListBox")
|
||||
// private WebElement scoringSystemDropDown;
|
||||
// @FindBy(how = BySeleniumId.class, using = "EventListBox")
|
||||
// private WebElement eventDropDown;
|
||||
// @FindBy(how = BySeleniumId.class, using = "CourseAreaListBox")
|
||||
// private WebElement courseAreaDropDown;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "AddSeriesButton")
|
||||
private WebElement addSeriesButton;
|
||||
|
||||
public RegattaCreateDialog(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void setRegattaName(String name) {
|
||||
this.regattaNameTextField.clear();
|
||||
this.regattaNameTextField.sendKeys(name);
|
||||
}
|
||||
|
||||
public void setBoatClass(String boatClass) {
|
||||
this.boatClassTextField.clear();
|
||||
this.boatClassTextField.sendKeys(boatClass);
|
||||
}
|
||||
|
||||
// TODO: Scoring System, Event and Course Area
|
||||
|
||||
public SeriesCreateDialog addSeries() {
|
||||
this.addSeriesButton.click();
|
||||
|
||||
WebElement dialog = findElementBySeleniumId(this.driver, "SeriesCreateDialog");
|
||||
|
||||
return new SeriesCreateDialog(this.driver, dialog);
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.regatta;
|
||||
|
||||
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;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.Actions;
|
||||
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTable;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntry;
|
||||
import com.sap.sailing.selenium.pages.gwt.GenericCellTable;
|
||||
|
||||
// TODO: Implement if needed
|
||||
public class RegattaDetailsComposite extends PageArea {
|
||||
@FindBy(how = BySeleniumId.class, using = "NameLabel")
|
||||
private WebElement regattaNameLabel;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "BoatClassLabel")
|
||||
private WebElement boatClassLabel;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "CourseAreaLabel")
|
||||
private WebElement courseAreaLabel;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "ScoringSystemLabel")
|
||||
private WebElement scoringSystemLabel;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "SeriesCellTable")
|
||||
private WebElement seriesTable;
|
||||
|
||||
public RegattaDetailsComposite(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public String getRegattaName() {
|
||||
return this.regattaNameLabel.getText();
|
||||
}
|
||||
|
||||
public String getBoatClass() {
|
||||
return this.boatClassLabel.getText();
|
||||
}
|
||||
|
||||
public String getCouresArea() {
|
||||
return this.courseAreaLabel.getText();
|
||||
}
|
||||
|
||||
public String getScoringSystem() {
|
||||
return this.scoringSystemLabel.getText();
|
||||
}
|
||||
|
||||
// public void getSeries() {
|
||||
//
|
||||
// }
|
||||
|
||||
public SeriesEditDialog editSeries(String series) {
|
||||
DataEntry entry = findSeries(series);
|
||||
|
||||
if(entry != null) {
|
||||
WebElement action = Actions.findEditAction(entry.getWebElement());
|
||||
action.click();
|
||||
|
||||
WebElement dialog = findElementBySeleniumId(this.driver, "SeriesEditDialog");
|
||||
|
||||
return new SeriesEditDialog(this.driver, dialog);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void deleteSeries(String series) {
|
||||
DataEntry entry = findSeries(series);
|
||||
|
||||
if(entry != null) {
|
||||
WebElement removeAction = Actions.findRemoveAction(entry.getWebElement());
|
||||
removeAction.click();
|
||||
|
||||
Actions.acceptAlert(this.driver);
|
||||
|
||||
//waitForAjaxRequests();
|
||||
}
|
||||
}
|
||||
|
||||
private DataEntry findSeries(String series) {
|
||||
CellTable<DataEntry> table = getSeriesTable();
|
||||
|
||||
for(DataEntry entry : table.getEntries()) {
|
||||
String name = entry.getColumnContent(0);
|
||||
|
||||
if(series.equals(name))
|
||||
return entry;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private CellTable<DataEntry> getSeriesTable() {
|
||||
return new GenericCellTable<>(this.driver, this.seriesTable, DataEntry.class);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.regatta;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
|
||||
public class RegattaEditDialog extends PageArea {
|
||||
|
||||
public RegattaEditDialog(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
}
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.regatta;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
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;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.Actions;
|
||||
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTable;
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTable.SortingOrder;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntry;
|
||||
import com.sap.sailing.selenium.pages.gwt.GenericCellTable;
|
||||
|
||||
public class RegattaListComposite extends PageArea {
|
||||
public static class RegattaDescriptor {
|
||||
private final String name;
|
||||
private final String boatClass;
|
||||
|
||||
// TODO [D049941]: Mark as a bug and remove this method as soon as possible
|
||||
public static RegattaDescriptor fromString(String name) {
|
||||
if(name == null || name.isEmpty())
|
||||
return null;
|
||||
|
||||
int openingBrace = name.lastIndexOf('(');
|
||||
int closingBrace = name.lastIndexOf(')');
|
||||
|
||||
return new RegattaDescriptor(name.substring(0, openingBrace - 1),
|
||||
name.substring(openingBrace + 1, closingBrace));
|
||||
}
|
||||
|
||||
public RegattaDescriptor(String name, String boatClass) {
|
||||
this.name = name;
|
||||
this.boatClass = boatClass;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getBoatClass() {
|
||||
return this.boatClass;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.name + " (" + this.boatClass + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.name, this.boatClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (this == object)
|
||||
return true;
|
||||
|
||||
if (object == null)
|
||||
return false;
|
||||
|
||||
if (getClass() != object.getClass())
|
||||
return false;
|
||||
|
||||
RegattaDescriptor other = (RegattaDescriptor) object;
|
||||
|
||||
if (!Objects.equals(this.boatClass, other.boatClass))
|
||||
return false;
|
||||
|
||||
if (!Objects.equals(this.name, other.name))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "FilterRegattasTextField")
|
||||
private WebElement RegattasFilterTextField;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "NoRegattasLabel")
|
||||
private WebElement noRegattasLabel;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RegattasCellTable")
|
||||
private WebElement regattasTable;
|
||||
|
||||
public RegattaListComposite(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void sortByRegattaName(SortingOrder order) {
|
||||
sortRegattaList(0, order);
|
||||
}
|
||||
|
||||
public void sortByBoatClass(SortingOrder order) {
|
||||
sortRegattaList(1, order);
|
||||
}
|
||||
|
||||
public List<RegattaDescriptor> getRegattas() {
|
||||
List<RegattaDescriptor> descriptors = new LinkedList<>();
|
||||
CellTable<DataEntry> table = getRegattasTable();
|
||||
|
||||
for(DataEntry entry : table.getEntries()) {
|
||||
String name = entry.getColumnContent(0);
|
||||
String boatClass = entry.getColumnContent(1);
|
||||
|
||||
descriptors.add(new RegattaDescriptor(name, boatClass));
|
||||
}
|
||||
|
||||
return descriptors;
|
||||
}
|
||||
|
||||
public void selectRegatta(RegattaDescriptor regatta) {
|
||||
DataEntry entry = findRegatta(regatta);
|
||||
|
||||
if(entry != null) {
|
||||
entry.select();
|
||||
}
|
||||
}
|
||||
|
||||
// public EditRegattaDialog editRegatta(RegattaDescriptor regatta) {
|
||||
//
|
||||
// }
|
||||
|
||||
public void removeRegatta(RegattaDescriptor regatta) {
|
||||
DataEntry entry = findRegatta(regatta);
|
||||
|
||||
if(entry != null) {
|
||||
WebElement action = Actions.findRemoveAction(entry.getWebElement());
|
||||
action.click();
|
||||
|
||||
waitForAjaxRequests();
|
||||
|
||||
Actions.acceptAlert(this.driver);
|
||||
}
|
||||
}
|
||||
|
||||
private DataEntry findRegatta(RegattaDescriptor regatta) {
|
||||
CellTable<DataEntry> table = getRegattasTable();
|
||||
|
||||
for(DataEntry entry : table.getEntries()) {
|
||||
String name = entry.getColumnContent(0);
|
||||
// String boatClass = columns.getColumnContent(1);
|
||||
//
|
||||
// if(regatta.equals(new RegattaDescriptor(name, boatClass)))
|
||||
// return row;
|
||||
if(regatta.equals(RegattaDescriptor.fromString(name)))
|
||||
return entry;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void sortRegattaList(int column, SortingOrder order) {
|
||||
CellTable<DataEntry> table = getRegattasTable();
|
||||
table.sortByColumn(column, order);
|
||||
}
|
||||
|
||||
private CellTable<DataEntry> getRegattasTable() {
|
||||
return new GenericCellTable<>(this.driver, this.regattasTable, DataEntry.class);
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.regatta;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.regatta.RegattaListComposite.RegattaDescriptor;
|
||||
|
||||
public class RegattaStructureManagementPanel extends PageArea {
|
||||
public static final String DEFAULT_SERIES_NAME = "Default"; //$NON-NLS-1$
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "AddRegattaButton")
|
||||
WebElement addRegattaButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RemoveRegattaButton")
|
||||
WebElement removeRegattaButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RegattaListComposite")
|
||||
WebElement regattaList;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RegattaDetailsComposite")
|
||||
WebElement regattaDetails;
|
||||
|
||||
public RegattaStructureManagementPanel(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public RegattaCreateDialog startRegattaCreation() {
|
||||
this.addRegattaButton.click();
|
||||
|
||||
WebElement dialog = findElementBySeleniumId(this.driver, "RegattaCreateDialog"); //$NON-NLS-1$
|
||||
|
||||
return new RegattaCreateDialog(this.driver, dialog);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Creates a regatta with 1 series (named "Default").</p>
|
||||
*
|
||||
* @param regatta
|
||||
*/
|
||||
public void createRegatta(RegattaDescriptor regatta) {
|
||||
RegattaCreateDialog createRegattaDialog = startRegattaCreation();
|
||||
createRegattaDialog.setRegattaName(regatta.getName());
|
||||
createRegattaDialog.setBoatClass(regatta.getBoatClass());
|
||||
|
||||
SeriesCreateDialog addSeriesDialog = createRegattaDialog.addSeries();
|
||||
addSeriesDialog.setSeriesName(DEFAULT_SERIES_NAME);
|
||||
|
||||
addSeriesDialog.pressOk();
|
||||
|
||||
// QUESTION: How do we handle an error (here or in the dialog)?
|
||||
createRegattaDialog.pressOk();
|
||||
}
|
||||
|
||||
public void removeRegatta(RegattaDescriptor regatta) {
|
||||
// Select the regatta and click the remove button
|
||||
}
|
||||
|
||||
public void removeRegattas(List<RegattaDescriptor> regattas) {
|
||||
// Select all regattas and click the remove button
|
||||
}
|
||||
|
||||
public RegattaListComposite getRegattaList() {
|
||||
return new RegattaListComposite(this.driver, this.regattaList);
|
||||
}
|
||||
|
||||
public void selectRegatta(RegattaDescriptor regatta) {
|
||||
|
||||
}
|
||||
|
||||
public RegattaDetailsComposite getRegattaDetails(RegattaDescriptor regatta) {
|
||||
RegattaListComposite regattaList = getRegattaList();
|
||||
regattaList.selectRegatta(regatta);
|
||||
|
||||
return getRegattaDetails();
|
||||
}
|
||||
|
||||
public RegattaDetailsComposite getRegattaDetails() {
|
||||
if(this.regattaDetails.isDisplayed())
|
||||
return new RegattaDetailsComposite(this.driver, this.regattaDetails);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.regatta;
|
||||
|
||||
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.common.DataEntryDialog;
|
||||
|
||||
public class SeriesCreateDialog extends DataEntryDialog {
|
||||
@FindBy(how = BySeleniumId.class, using = "NameTextField")
|
||||
private WebElement seriesNameTextField;
|
||||
|
||||
// @FindBy(how = BySeleniumId.class, using = "MedalSeriesCheckbox")
|
||||
// private WebElement medalSeriesCheckbox;
|
||||
|
||||
// @FindBy(how = BySeleniumId.class, using = "StartsWithZeroScoreCheckbox")
|
||||
// private WebElement startsWithZeroScoreCheckbox;
|
||||
|
||||
// @FindBy(how = BySeleniumId.class, using = "StartsWithNonDiscardableCarryForwardCheckbox")
|
||||
// private WebElement startsWithNonDiscardableCarryForwardCheckbox;
|
||||
|
||||
// @FindBy(how = BySeleniumId.class, using = "DefinesResultDiscardingRulesCheckbox")
|
||||
// private WebElement definesResultDiscardingRulesCheckbox;
|
||||
|
||||
// @FindBy(how = BySeleniumId.class, using = "FleetListEditorComposite")
|
||||
// private WebElement fleetsPanel;
|
||||
|
||||
public SeriesCreateDialog(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void setSeriesName(String name) {
|
||||
this.seriesNameTextField.clear();
|
||||
this.seriesNameTextField.sendKeys(name);
|
||||
}
|
||||
|
||||
// TODO: Checkboxes and Fleets
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.regatta;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.ui.Select;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
|
||||
import com.sap.sailing.selenium.pages.common.DataEntryDialog;
|
||||
|
||||
public class SeriesEditDialog extends DataEntryDialog {
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "MedalSeriesCheckbox")
|
||||
private WebElement medalSeriesCheckbox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "StartsWithZeroScoreCheckbox")
|
||||
private WebElement startsWithZeroScoreCheckbox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "StartsWithNonDiscardableCarryForwardCheckbox")
|
||||
private WebElement startsWithNonDiscardableCarryForwardCheckbox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "DefinesResultDiscardingRulesCheckbox")
|
||||
private WebElement definesResultDiscardingRulesCheckbox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "NumberOfRacesListBox")
|
||||
private WebElement numberOfRacesDropDown;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RaceNamePrefixTextBox")
|
||||
private WebElement raceNamePrefixTextField;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "AddRacesButton")
|
||||
private WebElement addRacesButton;
|
||||
|
||||
public SeriesEditDialog(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public int getSetNumberOfRacesToAdd() {
|
||||
Select select = new Select(this.numberOfRacesDropDown);
|
||||
WebElement option = select.getFirstSelectedOption();
|
||||
|
||||
return Integer.parseInt(option.getAttribute("value"));
|
||||
}
|
||||
|
||||
public void setSetNumberOfRacesToAdd(int races) {
|
||||
Select select = new Select(this.numberOfRacesDropDown);
|
||||
select.selectByValue(Integer.toString(races));
|
||||
}
|
||||
|
||||
public String getRaceNamePrefix() {
|
||||
return this.raceNamePrefixTextField.getText();
|
||||
}
|
||||
|
||||
public void setRaceNamePrefix(String prefix) {
|
||||
this.raceNamePrefixTextField.clear();
|
||||
this.raceNamePrefixTextField.sendKeys(prefix);
|
||||
}
|
||||
|
||||
public void pressAddRaces() {
|
||||
this.addRacesButton.click();
|
||||
}
|
||||
|
||||
public void addRaces(int races) {
|
||||
setSetNumberOfRacesToAdd(races);
|
||||
pressAddRaces();
|
||||
}
|
||||
|
||||
public void addRaces(int races, String prefix) {
|
||||
setSetNumberOfRacesToAdd(races);
|
||||
setRaceNamePrefix(prefix);
|
||||
pressAddRaces();
|
||||
}
|
||||
}
|
||||
+201
@@ -0,0 +1,201 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.tracking;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
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;
|
||||
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTable;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntry;
|
||||
import com.sap.sailing.selenium.pages.gwt.GenericCellTable;
|
||||
|
||||
public class TrackedRacesList extends PageArea {
|
||||
public enum Status {
|
||||
LOADING,
|
||||
TRACKING,
|
||||
FINISHED,
|
||||
UNKOWN;
|
||||
|
||||
public static Status fromString(String string) {
|
||||
if (string != null && !string.isEmpty()) {
|
||||
for (Status status : Status.values()) {
|
||||
if (string.startsWith(status.name())) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return UNKOWN;
|
||||
}
|
||||
}
|
||||
|
||||
public static class TrackedRaceDescriptor {
|
||||
public String regatta;
|
||||
public String boatClass;
|
||||
public String race;
|
||||
|
||||
public TrackedRaceDescriptor(String regatta, String boatClass, String race) {
|
||||
this.regatta = regatta;
|
||||
this.boatClass = boatClass;
|
||||
this.race = race;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.regatta, this.boatClass, this.race);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (this == object)
|
||||
return true;
|
||||
|
||||
if (object == null)
|
||||
return false;
|
||||
|
||||
if (getClass() != object.getClass())
|
||||
return false;
|
||||
|
||||
TrackedRaceDescriptor other = (TrackedRaceDescriptor) object;
|
||||
|
||||
if(!Objects.equals(this.regatta, other.regatta))
|
||||
return false;
|
||||
|
||||
if(!Objects.equals(this.boatClass, other.boatClass))
|
||||
return false;
|
||||
|
||||
if(!Objects.equals(this.race, other.race))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "TrackedRacesFilterTextBox")
|
||||
private WebElement trackedRacesFilterTextBox;
|
||||
|
||||
//@FindBy(how = BySeleniumId.class, using = "NoTrackedRacesLabel")
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "TrackedRacesCellTable")
|
||||
private WebElement trackedRacesTable;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RefreshButton")
|
||||
private WebElement refreshButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RemoveRaceButton")
|
||||
private WebElement removeButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "StopTrackingButton")
|
||||
private WebElement stopTrackingButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "SetDelayToLiveButton")
|
||||
private WebElement setDelayToLiveButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "ExportButton")
|
||||
private WebElement exportButton;
|
||||
|
||||
//@FindBy(how = BySeleniumId.class, using = "ExportPopup")
|
||||
|
||||
protected TrackedRacesList(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void setFilterForTrackedRaces(String filter) {
|
||||
this.trackedRacesFilterTextBox.clear();
|
||||
this.trackedRacesFilterTextBox.sendKeys(filter);
|
||||
}
|
||||
|
||||
public List<TrackedRaceDescriptor> getTrackedRaces() {
|
||||
List<TrackedRaceDescriptor> descriptors = new LinkedList<>();
|
||||
CellTable<DataEntry> table = getTrackedRacesTable();
|
||||
|
||||
for(DataEntry entry : table.getEntries()) {
|
||||
String regatta = entry.getColumnContent(0);
|
||||
String boatClass = entry.getColumnContent(1);
|
||||
String race = entry.getColumnContent(2);
|
||||
|
||||
descriptors.add(new TrackedRaceDescriptor(regatta, boatClass, race));
|
||||
}
|
||||
|
||||
return descriptors;
|
||||
}
|
||||
|
||||
public Object getStatus(TrackedRaceDescriptor race) {
|
||||
List<Status> status = getStatus(Arrays.asList(race));
|
||||
|
||||
return status.get(0);
|
||||
}
|
||||
|
||||
public List<Status> getStatus(List<TrackedRaceDescriptor> races) {
|
||||
List<Status> result = new ArrayList<>(Collections.<Status>nCopies(races.size(), null));
|
||||
|
||||
CellTable<DataEntry> table = getTrackedRacesTable();
|
||||
|
||||
for(DataEntry entry : table.getEntries()) {
|
||||
String regatta = entry.getColumnContent(0);
|
||||
String boatClass = entry.getColumnContent(1);
|
||||
String race = entry.getColumnContent(2);
|
||||
String status = entry.getColumnContent(6);
|
||||
|
||||
TrackedRaceDescriptor descriptor = new TrackedRaceDescriptor(regatta, boatClass, race);
|
||||
|
||||
if(races.contains(descriptor)) {
|
||||
result.set(races.indexOf(descriptor), Status.fromString(status));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void stopTracking(List<TrackedRaceDescriptor> races) {
|
||||
|
||||
}
|
||||
|
||||
public void remove(List<TrackedRaceDescriptor> races) {
|
||||
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
this.refreshButton.click();
|
||||
|
||||
waitForAjaxRequests();
|
||||
}
|
||||
|
||||
private CellTable<DataEntry> getTrackedRacesTable() {
|
||||
return new GenericCellTable<>(this.driver, this.trackedRacesTable, DataEntry.class);
|
||||
}
|
||||
|
||||
// private List<WebElement> getTrackedRaces(List<TrackedRaceDescriptor> races) {
|
||||
// List<WebElement> result = new ArrayList<>(Collections.<WebElement>nCopies(races.size(), null));
|
||||
//
|
||||
// CellTable table = new CellTable(this.driver, this.trackedRacesTable);
|
||||
// List<WebElement> rows = table.getRows();
|
||||
// Iterator<WebElement> iterator = rows.iterator();
|
||||
//
|
||||
// while(iterator.hasNext()) {
|
||||
// WebElement row = iterator.next();
|
||||
//
|
||||
// List<WebElement> columns = row.findElements(By.tagName("td"));
|
||||
// String regatta = columns.get(0).getText();
|
||||
// String boatClass = columns.get(1).getText();
|
||||
// String race = columns.get(2).getText();
|
||||
//
|
||||
// TrackedRaceDescriptor descriptor = new TrackedRaceDescriptor(regatta, boatClass, race);
|
||||
//
|
||||
// if(races.contains(descriptor)) {
|
||||
// result.add(row);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
// }
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.tracking;
|
||||
|
||||
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 TrackedRacesManagementPanel extends PageArea {
|
||||
@FindBy(how = BySeleniumId.class, using = "TrackedRacesListComposite")
|
||||
private WebElement trackedRacesListCoposite;
|
||||
|
||||
public TrackedRacesManagementPanel(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public TrackedRacesList getTrackedRacesList() {
|
||||
return new TrackedRacesList(this.driver, this.trackedRacesListCoposite);
|
||||
}
|
||||
}
|
||||
+185
-64
@@ -1,20 +1,28 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.tractrac;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
//import org.openqa.selenium.support.FindBy;
|
||||
//import org.openqa.selenium.support.How;
|
||||
|
||||
import org.openqa.selenium.support.ui.Select;
|
||||
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.regatta.RegattaListComposite.RegattaDescriptor;
|
||||
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntry;
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTable;
|
||||
import com.sap.sailing.selenium.pages.gwt.GenericCellTable;
|
||||
|
||||
/**
|
||||
* <p>The page object representing the TracTrac Events tab.</p>
|
||||
*
|
||||
@@ -22,24 +30,83 @@ import com.sap.sailing.selenium.pages.PageArea;
|
||||
* D049941
|
||||
*/
|
||||
public class TracTracEventManagementPanel extends PageArea {
|
||||
@FindBy(how = BySeleniumId.class, using = "JSONURL")
|
||||
private WebElement jsonURLField;
|
||||
public static class TrackableRaceDescriptor {
|
||||
public final String eventName;
|
||||
public final String raceName;
|
||||
public final String boatClass;
|
||||
//public Object startTime;
|
||||
//public Object raceStatus;
|
||||
|
||||
public TrackableRaceDescriptor(String eventName, String raceName, String boatClass) {
|
||||
this.eventName = eventName;
|
||||
this.raceName = raceName;
|
||||
this.boatClass = boatClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.boatClass, this.eventName, this.raceName);
|
||||
}
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "LiveURI")
|
||||
private WebElement liveURIField;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "StoredURI")
|
||||
private WebElement storedURIField;
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (this == object)
|
||||
return true;
|
||||
|
||||
if (object == null)
|
||||
return false;
|
||||
|
||||
if (getClass() != object.getClass())
|
||||
return false;
|
||||
|
||||
TrackableRaceDescriptor other = (TrackableRaceDescriptor) object;
|
||||
|
||||
if(!Objects.equals(this.boatClass, other.boatClass))
|
||||
return false;
|
||||
|
||||
if(!Objects.equals(this.eventName, other.eventName))
|
||||
return false;
|
||||
|
||||
if(!Objects.equals(this.raceName, other.raceName))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "ListRaces")
|
||||
// TODO [D049941]: Prefix the Ids with the component (e.g. "Button")
|
||||
@FindBy(how = BySeleniumId.class, using = "LiveURITextBox")
|
||||
private WebElement liveURITextBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "StoredURITextBox")
|
||||
private WebElement storedURITextBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "JsonURLTextBox")
|
||||
private WebElement jsonURLTextBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "ListRacesButton")
|
||||
private WebElement listRacesButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "FilterRaces")
|
||||
private WebElement filterTrackableRacesField;
|
||||
@FindBy(how = BySeleniumId.class, using = "AvailableRegattasListBox")
|
||||
private WebElement availableRegattasListBox;
|
||||
|
||||
// private WebElement trackWindCheckBox;
|
||||
// private WebElement correctWindCheckbox;
|
||||
// private WebElement simulateWithNowCheckbox;
|
||||
@FindBy(how = BySeleniumId.class, using = "TrackWindCheckBox")
|
||||
private WebElement trackWindCheckBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "CorrectWindCheckBox")
|
||||
private WebElement correctWindCheckBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "SimulateWithStartTimeNowCheckBox")
|
||||
private WebElement simulateWithStartTimeNowCheckBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "TrackableRacesFilterTextBox")
|
||||
private WebElement trackableRacesFilterTextBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "TrackableRacesCellTable")
|
||||
private WebElement trackableRacesCellTable;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "StartTracking")
|
||||
private WebElement startTrackingButton;
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
@@ -53,6 +120,7 @@ public class TracTracEventManagementPanel extends PageArea {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>Lists all available trackable races for the given URL. The list of the races can be obtained via
|
||||
* {@link #getTrackableRaces()}.</p>
|
||||
@@ -60,12 +128,28 @@ public class TracTracEventManagementPanel extends PageArea {
|
||||
* @param url
|
||||
* The URL for which the races are to list.
|
||||
*/
|
||||
public void listRaces(String url) {
|
||||
liveURIField.clear();
|
||||
storedURIField.clear();
|
||||
jsonURLField.clear();
|
||||
jsonURLField.sendKeys(url);
|
||||
listRacesButton.click();
|
||||
public void listTrackableRaces(String url) {
|
||||
listTrackableRaces("", "", url); //$NON-NLS-1$//$NON-NLS-2$
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Lists all available trackable races for the given URL. The list of the races can be obtained via
|
||||
* {@link #getTrackableRaces()}.</p>
|
||||
*
|
||||
* @param url
|
||||
* The URL for which the races are to list.
|
||||
*/
|
||||
public void listTrackableRaces(String liveURI, String storedURI, String jsonURL) {
|
||||
this.liveURITextBox.clear();
|
||||
this.liveURITextBox.sendKeys(liveURI);
|
||||
|
||||
this.storedURITextBox.clear();
|
||||
this.storedURITextBox.sendKeys(storedURI);
|
||||
|
||||
this.jsonURLTextBox.clear();
|
||||
this.jsonURLTextBox.sendKeys(jsonURL);
|
||||
|
||||
this.listRacesButton.click();
|
||||
|
||||
waitForAjaxRequests();
|
||||
}
|
||||
@@ -77,33 +161,48 @@ public class TracTracEventManagementPanel extends PageArea {
|
||||
* @return
|
||||
* The list of all available trackable races.
|
||||
*/
|
||||
// QUESTION: Should we return something different instead of WebElements since it is not recommended to do so?
|
||||
public List<WebElement> getTrackableRaces() {
|
||||
WebElement availableRacesTabel = findElementBySeleniumId(this.context, "RacesTable"); //$NON-NLS-1$
|
||||
List<WebElement> elements = availableRacesTabel.findElements(By.xpath("./tbody/tr")); //$NON-NLS-1$
|
||||
Iterator<WebElement> iterator = elements.iterator();
|
||||
public List<TrackableRaceDescriptor> getTrackableRaces() {
|
||||
List<TrackableRaceDescriptor> descriptors = new LinkedList<>();
|
||||
CellTable<DataEntry> table = getTrackableRacesTable();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
WebElement element = iterator.next();
|
||||
for(DataEntry entry : table.getEntries()) {
|
||||
String event = entry.getColumnContent(0);
|
||||
String race = entry.getColumnContent(1);
|
||||
String boatClass = entry.getColumnContent(2);
|
||||
|
||||
if(!element.isDisplayed())
|
||||
iterator.remove();
|
||||
descriptors.add(new TrackableRaceDescriptor(event, race, boatClass));
|
||||
}
|
||||
|
||||
return elements;
|
||||
return descriptors;
|
||||
}
|
||||
|
||||
// public List<String> getAvailableReggatasForTracking() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public String getReggataForTracking() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public void setReggataForTracking(String regatta) {
|
||||
//
|
||||
// }
|
||||
public List<RegattaDescriptor> getAvailableReggatasForTracking() {
|
||||
List<RegattaDescriptor> result = new ArrayList<>();
|
||||
|
||||
Select select = new Select(this.availableRegattasListBox);
|
||||
|
||||
for(WebElement option : select.getOptions()) {
|
||||
RegattaDescriptor regatta = RegattaDescriptor.fromString(option.getAttribute("value"));
|
||||
|
||||
result.add(regatta);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public RegattaDescriptor getReggataForTracking() {
|
||||
Select select = new Select(this.availableRegattasListBox);
|
||||
WebElement option = select.getFirstSelectedOption();
|
||||
RegattaDescriptor regatta = RegattaDescriptor.fromString(option.getAttribute("value"));
|
||||
|
||||
return regatta;
|
||||
}
|
||||
|
||||
public void setReggataForTracking(RegattaDescriptor regatta) {
|
||||
Select select = new Select(this.availableRegattasListBox);
|
||||
|
||||
select.selectByValue(regatta.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Sets the filter for the trackable races. After the filter is set you can obtain the new resulting list via
|
||||
@@ -113,27 +212,49 @@ public class TracTracEventManagementPanel extends PageArea {
|
||||
* The filter to apply to the trackable races.
|
||||
*/
|
||||
public void setFilterForTrackableRaces(String filter) {
|
||||
this.filterTrackableRacesField.clear();
|
||||
this.filterTrackableRacesField.sendKeys(filter);
|
||||
this.trackableRacesFilterTextBox.clear();
|
||||
this.trackableRacesFilterTextBox.sendKeys(filter);
|
||||
}
|
||||
|
||||
// public void setTrackSettings(boolean trackWind, boolean correctWind, boolean simulateWithNow) {
|
||||
// setSelection(this.trackWindCheckBox, trackWind);
|
||||
// setSelection(this.correctWindCheckbox, correctWind);
|
||||
// setSelection(this.simulateWithNowCheckbox, simulateWithNow);
|
||||
// }
|
||||
//
|
||||
// public void startTrackingForRace() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public void startTrackingForRaces() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// private void setSelection(WebElement checkbox, boolean selected) {
|
||||
// WebElement input = checkbox.findElement(By.tagName("input"));
|
||||
// if(input.isSelected() != selected)
|
||||
// input.click();
|
||||
// }
|
||||
public void setTrackSettings(boolean trackWind, boolean correctWind, boolean simulateWithNow) {
|
||||
setSelection(this.trackWindCheckBox, trackWind);
|
||||
setSelection(this.correctWindCheckBox, correctWind);
|
||||
setSelection(this.simulateWithStartTimeNowCheckBox, simulateWithNow);
|
||||
}
|
||||
|
||||
public void startTrackingForRaces(List<TrackableRaceDescriptor> races) {
|
||||
CellTable<DataEntry> table = getTrackableRacesTable();
|
||||
List<DataEntry> entries = table.getEntries();
|
||||
Iterator<DataEntry> iterator = entries.iterator();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
DataEntry entry = iterator.next();
|
||||
|
||||
String event = entry.getColumnContent(0);
|
||||
String race = entry.getColumnContent(1);
|
||||
String boatClass = entry.getColumnContent(2);
|
||||
|
||||
TrackableRaceDescriptor descriptor = new TrackableRaceDescriptor(event, race, boatClass);
|
||||
|
||||
if(!races.contains(descriptor))
|
||||
iterator.remove();
|
||||
}
|
||||
|
||||
table.selectEntries(entries);
|
||||
|
||||
this.startTrackingButton.click();
|
||||
|
||||
waitForAjaxRequests();
|
||||
}
|
||||
|
||||
private CellTable<DataEntry> getTrackableRacesTable() {
|
||||
return new GenericCellTable<>(this.driver, this.trackableRacesCellTable, DataEntry.class);
|
||||
}
|
||||
|
||||
private void setSelection(WebElement checkbox, boolean selected) {
|
||||
WebElement input = checkbox.findElement(By.tagName("input"));
|
||||
|
||||
if(input.isSelected() != selected)
|
||||
input.click();
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.sap.sailing.selenium.pages.common;
|
||||
|
||||
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 abstract class DataEntryDialog extends PageArea {
|
||||
@FindBy(how = BySeleniumId.class, using = "StatusLabel")
|
||||
private WebElement statusLabel;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "OkButton")
|
||||
private WebElement okButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "CancelButton")
|
||||
private WebElement cancelButton;
|
||||
|
||||
|
||||
public DataEntryDialog(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void verify() {
|
||||
WebElement element = (WebElement) this.context;
|
||||
String cssClasses = element.getAttribute("class");
|
||||
|
||||
if(!cssClasses.contains("gwt-DialogBox"))
|
||||
throw new IllegalStateException("This is not a dialog");
|
||||
}
|
||||
|
||||
public String getStatusMessage() {
|
||||
if(this.statusLabel.isDisplayed())
|
||||
return this.statusLabel.getText();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isOkButtonEnabled() {
|
||||
return this.okButton.isEnabled();
|
||||
}
|
||||
|
||||
public boolean isCancelButtonEnabled() {
|
||||
return this.cancelButton.isEnabled();
|
||||
}
|
||||
|
||||
// QUESTION: What should we do, if the button is not enabled?
|
||||
public void pressOk() {
|
||||
this.okButton.click();
|
||||
|
||||
// Wait, since we do a callback usually
|
||||
waitForAjaxRequests();
|
||||
}
|
||||
|
||||
public void pressCancel() {
|
||||
this.cancelButton.click();
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -50,9 +50,9 @@ public abstract class CellTable<T extends DataEntry> extends PageArea {
|
||||
|
||||
private static final String SORTING_INDICATOR_XPATH = ".//div/div/img";
|
||||
|
||||
private static final String CELL_TABLE_CSS_CLASS = "GCKY0V4BDK"; //$NON-NLS-1$
|
||||
private static final String CELL_TABLE_CSS_CLASS = "GJTB2DRDFQ"; //$NON-NLS-1$
|
||||
|
||||
protected static final String SELECTED_ROW_CSS_CLASS = "GCKY0V4BNJ"; //$NON-NLS-1$
|
||||
protected static final String SELECTED_ROW_CSS_CLASS = "GJTB2DRDPP"; //$NON-NLS-1$
|
||||
|
||||
private static final String LOADING_ANIMATION_XPATH = ".//td/div/div/div/img";
|
||||
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.sap.sailing.selenium.pages.gwt;
|
||||
|
||||
import org.openqa.selenium.By.ByTagName;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
import com.sap.sailing.selenium.pages.common.CSSHelper;
|
||||
|
||||
public class CheckBox extends PageArea {
|
||||
protected static final String CHECKBOX_TAG_NAME = "span"; //$NON-NLS-1$
|
||||
|
||||
private static final String CHECKBOX_CSS_CLASS = "gwt-CheckBox";
|
||||
|
||||
@FindBy(how = ByTagName.class, using = "input")
|
||||
private WebElement checkbox;
|
||||
|
||||
@FindBy(how = ByTagName.class, using = "label")
|
||||
private WebElement label;
|
||||
|
||||
public CheckBox(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void verify() {
|
||||
WebElement element = (WebElement) this.context;
|
||||
String tagName = element.getTagName();
|
||||
|
||||
if(!CHECKBOX_TAG_NAME.equalsIgnoreCase(tagName) || !CSSHelper.hasCSSClass(element, CHECKBOX_CSS_CLASS))
|
||||
throw new IllegalArgumentException("WebElement does not represent a CheckBox");
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return this.checkbox.isEnabled();
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return this.label.getText();
|
||||
}
|
||||
|
||||
public boolean isSelected() {
|
||||
return this.checkbox.isSelected();
|
||||
}
|
||||
|
||||
public void setSelected(boolean selected) {
|
||||
if(selected != isSelected())
|
||||
this.checkbox.click();
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
package com.sap.sailing.selenium.pages.leaderboard;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
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.common.CSSConstants;
|
||||
import com.sap.sailing.selenium.pages.common.HTMLConstants;
|
||||
|
||||
/**
|
||||
* <p>The page object representing the leaderboard.</p>
|
||||
*
|
||||
* @author
|
||||
* D049941
|
||||
*/
|
||||
public class LeaderboardPage extends HostPage {
|
||||
private static final String PAGE_TITLE = "SAP Sailing Analytics Leaderboard"; //$NON-NLS-1$
|
||||
|
||||
private static final String LEADERBOAR_PARAMTER_NAME = "name"; //$NON-NLS-1$
|
||||
|
||||
private static final String AUTO_REFRESH_ENABLED_IMAGE = "url(\"data:image/png;base64," + //$NON-NLS-1$
|
||||
"iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAAR0lEQVR42mOoqan5T2vMMGoJxZZUV1fPB9IOWDC" + //$NON-NLS-1$
|
||||
"ymgJ0eagY0T5pYMAC0NQ4YJF3GLVk1JJRS0YtGbVkSFhCr/pktI4fOEsA89uCDGg41QoAAAAASUVORK5CYII=\")"; //$NON-NLS-1$
|
||||
|
||||
private static final String AUTO_REFRESH_DISABLED_IMAGE = "url(\"data:image/png;base64," + //$NON-NLS-1$
|
||||
"iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAAhElEQVR42mOoqan5T2vMMGoJVSyprq6eD6TX09o" + //$NON-NLS-1$
|
||||
"nDQxAAKQDgBbep6klIFBfXy9QW1vbT1NLYKCqqsoAKH6eppbAADD4CoDy72lqCTQIFYhNGGRbAgPEJAyKLSEmYV" + //$NON-NLS-1$
|
||||
"DFEhgAWpQwdH1C0ziheeqiaT6haY6nedlF01KYXvXJaB0/MJYAANIIBwANoTb3AAAAAElFTkSuQmCC\")"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* <p>Goes to the specified leaderboard and returns the representing page object.</p>
|
||||
*
|
||||
* @param driver
|
||||
* The web driver to use.
|
||||
* @param root
|
||||
* The context root of the application.
|
||||
* @param leaderboard
|
||||
* The name of the leaderboard.
|
||||
* @return
|
||||
* The page object for the administration console.
|
||||
*/
|
||||
public static LeaderboardPage goToPage(WebDriver driver, String root, String leaderboard) {
|
||||
driver.get(root + "gwt/Leaderboard.html?" + getLeaderboard(leaderboard) + //$NON-NLS-1$
|
||||
"&" + getGWTCodeServer()); //$NON-NLS-1$
|
||||
|
||||
return new LeaderboardPage(driver);
|
||||
}
|
||||
|
||||
private static String getLeaderboard(String leaderboard) {
|
||||
return LEADERBOAR_PARAMTER_NAME + "=" + leaderboard; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "AutoRefreshToggleButton")
|
||||
private WebElement autoRefreshToggleButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "LeaderboardTable")
|
||||
private WebElement leaderboardTable;
|
||||
|
||||
private LeaderboardPage(WebDriver driver) {
|
||||
super(driver);
|
||||
}
|
||||
|
||||
public boolean isAutoRefreshEnabled() {
|
||||
WebElement image = this.autoRefreshToggleButton.findElement(By.tagName(HTMLConstants.IMAGE_TAG_NAME));
|
||||
String background = image.getCssValue(CSSConstants.CSS_BACKGROUND_IMAGE);
|
||||
|
||||
if(AUTO_REFRESH_ENABLED_IMAGE.equals(background))
|
||||
return true;
|
||||
|
||||
if(AUTO_REFRESH_DISABLED_IMAGE.equals(background))
|
||||
return false;
|
||||
|
||||
throw new RuntimeException("Can not determine auto refresh state"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public void setAutoRefreshEnabled(boolean enabled) {
|
||||
if(isAutoRefreshEnabled() != enabled)
|
||||
this.autoRefreshToggleButton.click();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Verifies that the current page is the leaderboard by checking the title of the page.</p>
|
||||
*/
|
||||
@Override
|
||||
protected void verify() {
|
||||
if(!PAGE_TITLE.equals(this.driver.getTitle())) {
|
||||
throw new IllegalStateException("This is not the leaderboard"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package com.sap.sailing.selenium.pages.leaderboard;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTable;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntry;
|
||||
|
||||
import com.sap.sailing.selenium.pages.leaderboard.LeaderboardTable.LeaderboardEntry;
|
||||
|
||||
public class LeaderboardTable extends CellTable<LeaderboardEntry> {
|
||||
public class LeaderboardEntry extends DataEntry {
|
||||
private static final String TOTAL_RANK = "Total rank";
|
||||
private static final String COMPETITOR = "Competitor";
|
||||
private static final String NAME = "Name";
|
||||
|
||||
protected LeaderboardEntry(WebElement element) {
|
||||
super(LeaderboardTable.this, element);
|
||||
}
|
||||
|
||||
|
||||
public String getDescriptor() {
|
||||
return getCompetitor();
|
||||
}
|
||||
|
||||
public int getTotalRank() {
|
||||
return Integer.parseInt(getColumnContent(TOTAL_RANK));
|
||||
}
|
||||
|
||||
public String getCompetitor() {
|
||||
return getColumnContent(COMPETITOR);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return getColumnContent(NAME);
|
||||
}
|
||||
|
||||
// public int getTotalSailedDistance() {
|
||||
// }
|
||||
// public void getAverageSpeedOverGround() {
|
||||
// }
|
||||
// public void getMaximumSpeedOverGround() {
|
||||
// }
|
||||
// public int getTotalDownwindTime() {
|
||||
// }
|
||||
// public int getTotalUpwindTime() {
|
||||
// }
|
||||
// public int getTotalReachingLegsTime() {
|
||||
// }
|
||||
// public int getTotalSailingTime() {
|
||||
// }
|
||||
// public int getTotalPoints() {
|
||||
// }
|
||||
}
|
||||
|
||||
public LeaderboardTable(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LeaderboardEntry createDataEntry(WebElement element) {
|
||||
return new LeaderboardEntry(element);
|
||||
}
|
||||
}
|
||||
+18
-18
@@ -3,6 +3,7 @@ package com.sap.sailing.selenium.test.adminconsole;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.AdminConsolePage;
|
||||
@@ -17,28 +18,27 @@ import com.sap.sailing.selenium.test.AbstractSeleniumTest;
|
||||
* D049941
|
||||
*/
|
||||
public class TestLeaderboardCreation extends AbstractSeleniumTest {
|
||||
// @Before
|
||||
// public void clearDatabase() {
|
||||
// DatabaseHelper.dropDatabase();
|
||||
// }
|
||||
@Before
|
||||
public void clearDatabase() {
|
||||
clearState(getContextRoot());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateFlexibleLeaderboardWithDuplicateName() {
|
||||
FlexibleLeaderboardCreateDialog dialog;
|
||||
|
||||
AdminConsolePage adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
|
||||
LeaderboardConfigurationPanel leaderboardConfiguration = adminConsole.goToLeaderboardConfiguration();
|
||||
leaderboardConfiguration.deleteLeaderboard("Humba Humba");
|
||||
{
|
||||
FlexibleLeaderboardCreateDialog dialog = leaderboardConfiguration.startCreatingFlexibleLeaderboard();
|
||||
dialog.setName("Humba Humba");
|
||||
assertTrue(dialog.isOkEnabled());
|
||||
dialog.pressOk();
|
||||
}
|
||||
{
|
||||
FlexibleLeaderboardCreateDialog dialog = leaderboardConfiguration.startCreatingFlexibleLeaderboard();
|
||||
dialog.setName("Humba Humba");
|
||||
assertFalse(dialog.isOkEnabled());
|
||||
String errorMessage = dialog.getErrorMessage();
|
||||
assertTrue(errorMessage.length() > 0);
|
||||
}
|
||||
|
||||
dialog = leaderboardConfiguration.startCreatingFlexibleLeaderboard();
|
||||
dialog.setName("Humba Humba");
|
||||
assertTrue(dialog.isOkButtonEnabled());
|
||||
dialog.pressOk();
|
||||
|
||||
dialog = leaderboardConfiguration.startCreatingFlexibleLeaderboard();
|
||||
dialog.setName("Humba Humba");
|
||||
assertFalse(dialog.isOkButtonEnabled());
|
||||
String errorMessage = dialog.getStatusMessage();
|
||||
assertTrue(errorMessage.length() > 0);
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.sap.sailing.selenium.test.adminconsole;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.AdminConsolePage;
|
||||
import com.sap.sailing.selenium.pages.adminconsole.leaderboard.LeaderboardConfigurationPanel;
|
||||
import com.sap.sailing.selenium.pages.adminconsole.leaderboard.LeaderboardGroupConfigurationPanel;
|
||||
import com.sap.sailing.selenium.pages.adminconsole.leaderboard.LeaderboardGroupDetailsPanel;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntry;
|
||||
import com.sap.sailing.selenium.test.AbstractSeleniumTest;
|
||||
|
||||
public class TestLeaderboardFilterInLeaderboardGroupConfig extends AbstractSeleniumTest {
|
||||
@Before
|
||||
public void clearDatabase() {
|
||||
clearState(getContextRoot());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLeaderboardFilterInLeaderboardGroupConfig() {
|
||||
AdminConsolePage adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
|
||||
|
||||
LeaderboardGroupConfigurationPanel leaderboardGroupConfiguration = adminConsole.goToLeaderboardGroupConfiguration();
|
||||
leaderboardGroupConfiguration.createLeaderboardGroup("Test", "Test");
|
||||
List<DataEntry> selectedEntries = leaderboardGroupConfiguration.getLeaderboardGroupsTable().getSelectedEntries();
|
||||
assertEquals(1, selectedEntries.size());
|
||||
assertEquals("Test", selectedEntries.get(0).getColumnContent("Name"));
|
||||
|
||||
LeaderboardConfigurationPanel leaderboardConfiguration = adminConsole.goToLeaderboardConfiguration();
|
||||
leaderboardConfiguration.createFlexibleLeaderboard("Test");
|
||||
|
||||
leaderboardGroupConfiguration = adminConsole.goToLeaderboardGroupConfiguration();
|
||||
LeaderboardGroupDetailsPanel leaderboardGroupDetails = leaderboardGroupConfiguration.getLeaderboardGroupDetails();
|
||||
leaderboardGroupDetails.refreshLeaderboards();
|
||||
DataEntry leaderboardEntry = leaderboardGroupDetails.findLeaderboardEntry("Test");
|
||||
assertNotNull(leaderboardEntry);
|
||||
|
||||
leaderboardGroupDetails.filterLeaderboards("Test");
|
||||
assertNotNull(leaderboardGroupDetails.findLeaderboardEntry("Test"));
|
||||
}
|
||||
}
|
||||
+14
-16
@@ -28,7 +28,7 @@ public class TestRaceFilterForTracTracEvents extends AbstractSeleniumTest {
|
||||
AdminConsolePage adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
|
||||
|
||||
TracTracEventManagementPanel tracTracEvents = adminConsole.goToTracTracEvents();
|
||||
tracTracEvents.listRaces(BMW_CUP_JSON_URL);
|
||||
tracTracEvents.listTrackableRaces(BMW_CUP_JSON_URL);
|
||||
|
||||
assertThat(tracTracEvents.getTrackableRaces().size(), is(12));
|
||||
|
||||
@@ -43,7 +43,7 @@ public class TestRaceFilterForTracTracEvents extends AbstractSeleniumTest {
|
||||
AdminConsolePage adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
|
||||
|
||||
TracTracEventManagementPanel tracTracEvents = adminConsole.goToTracTracEvents();
|
||||
tracTracEvents.listRaces(BMW_CUP_JSON_URL);
|
||||
tracTracEvents.listTrackableRaces(BMW_CUP_JSON_URL);
|
||||
tracTracEvents.setFilterForTrackableRaces("BMW Cup Race 1"); //$NON-NLS-1$
|
||||
|
||||
assertThat(tracTracEvents.getTrackableRaces().size(), is(5));
|
||||
@@ -58,7 +58,7 @@ public class TestRaceFilterForTracTracEvents extends AbstractSeleniumTest {
|
||||
AdminConsolePage adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
|
||||
|
||||
TracTracEventManagementPanel tracTracEvents = adminConsole.goToTracTracEvents();
|
||||
tracTracEvents.listRaces(BMW_CUP_JSON_URL);
|
||||
tracTracEvents.listTrackableRaces(BMW_CUP_JSON_URL);
|
||||
tracTracEvents.setFilterForTrackableRaces("BMW Cup Race 12"); //$NON-NLS-1$
|
||||
|
||||
assertThat(tracTracEvents.getTrackableRaces().size(), is(1));
|
||||
@@ -67,17 +67,15 @@ public class TestRaceFilterForTracTracEvents extends AbstractSeleniumTest {
|
||||
/**
|
||||
* <p>Test with filter which does not match anything.</p>
|
||||
*/
|
||||
// TODO: This test fails at the moment, because of an incorrect result returned by the page object! If the table is
|
||||
// empty GWT uses a table body with one row as spacer, which is not filtered out correctly by the page object.
|
||||
// @Test
|
||||
// @SuppressWarnings("boxing")
|
||||
// public void testNoneExisingFilter() {
|
||||
// AdminConsolePage adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
|
||||
//
|
||||
// TracTracEventManagementPanel tracTracEvents = adminConsole.goToTracTracEvents();
|
||||
// tracTracEvents.listRaces(BMW_CUP_JSON_URL);
|
||||
// tracTracEvents.setFilterForTrackableRaces("BMW Cup Race 18"); //$NON-NLS-1$
|
||||
//
|
||||
// assertThat(tracTracEvents.getTrackableRaces().size(), is(0));
|
||||
// }
|
||||
@Test
|
||||
@SuppressWarnings("boxing")
|
||||
public void testNoneMatchingFilter() {
|
||||
AdminConsolePage adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
|
||||
|
||||
TracTracEventManagementPanel tracTracEvents = adminConsole.goToTracTracEvents();
|
||||
tracTracEvents.listTrackableRaces(BMW_CUP_JSON_URL);
|
||||
tracTracEvents.setFilterForTrackableRaces("BMW Cup Race 18"); //$NON-NLS-1$
|
||||
|
||||
assertThat(tracTracEvents.getTrackableRaces().size(), is(0));
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -29,7 +29,7 @@ public class TestStartAndStopTrackingForTracTracEvents extends AbstractSeleniumT
|
||||
AdminConsolePage adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
|
||||
|
||||
TracTracEventManagementPanel tracTracEvents = adminConsole.goToTracTracEvents();
|
||||
tracTracEvents.listRaces(BMW_CUP_JSON_URL);
|
||||
tracTracEvents.listTrackableRaces(BMW_CUP_JSON_URL);
|
||||
|
||||
// TODO: Complete the test case!
|
||||
//tracTracEvents.startTracking(BMW_CUP_RACE_8, BMW_CUP_REGATTA, false, false, false);
|
||||
|
||||
-98
@@ -1,98 +0,0 @@
|
||||
package com.sap.sailing.selenium.test.gwt.widgets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.pages.PageObject;
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @author
|
||||
* D049941
|
||||
*/
|
||||
public class CellTable extends PageObject {
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @param driver
|
||||
*
|
||||
* @param element
|
||||
*
|
||||
*/
|
||||
public CellTable(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public List<String> getHeaders() {
|
||||
List<String> headers = new ArrayList<>();
|
||||
|
||||
for(WebElement header : findHeaders()) {
|
||||
headers.add(header.getText());
|
||||
}
|
||||
|
||||
return headers;
|
||||
}
|
||||
|
||||
public void clickHeader(String name) {
|
||||
for(WebElement header : findHeaders()) {
|
||||
if(name.equals(header.getText()))
|
||||
header.click();
|
||||
}
|
||||
}
|
||||
|
||||
public List<WebElement> getRows() {
|
||||
List<WebElement> bodies = this.context.findElements(By.tagName("tbody"));
|
||||
|
||||
for(WebElement body : bodies) {
|
||||
if(!body.isDisplayed())
|
||||
continue;
|
||||
|
||||
List<WebElement> rows = body.findElements(By.tagName("tr"));
|
||||
|
||||
Iterator<WebElement> iterator = rows.iterator();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
WebElement row = iterator.next();
|
||||
|
||||
if(isRowForLoadingAnimation(row))
|
||||
iterator.remove();
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void verify() {
|
||||
// TODO: Verify that the context represents a GWT CellTable
|
||||
String tagName = ((WebElement) this.context).getTagName();
|
||||
|
||||
if(!tagName.equalsIgnoreCase("table"))
|
||||
throw new IllegalArgumentException("WebElement does not represent a table");
|
||||
}
|
||||
|
||||
private List<WebElement> findHeaders() {
|
||||
return this.context.findElements(By.tagName("th"));
|
||||
}
|
||||
|
||||
private boolean isRowForLoadingAnimation(WebElement row) {
|
||||
List<WebElement> images = row.findElements(By.xpath(".//td/div/div/div/img"));
|
||||
|
||||
if(images.isEmpty() || images.size() > 1)
|
||||
return false;
|
||||
|
||||
WebElement image = images.get(0);
|
||||
System.out.println(image.getCssValue("background-image"));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user