bug3529 Extended Selenium tests for leaderboard

This commit is contained in:
Vladislav Chumak committed 2017-03-30 18:49:18 +02:00
1 parent 41b0c73a47
commit 94f4d38fb5
13 files changed
+441 -75

No files matched your search

@@ -64,9 +64,11 @@ public class EventConfigurationPanelPO extends PageArea {
public void createEventWithDefaultLeaderboardGroupRegattaAndDefaultLeaderboard(String eventName, String eventDesc,
String venue, Date eventStartDate, Date eventEndDate, boolean isPublic, String regattaName, String boatClass,
Date regattaStartDate, Date regattaEndDate) {
Date regattaStartDate, Date regattaEndDate, boolean useOverallLeaderboard) {
createEvent(eventName, eventDesc, venue, eventStartDate, eventEndDate, isPublic).pressYes();
getPO(LeaderboardGroupCreateDialogPO::new, ID_CREATE_DEFAULT_LEADERBOARD_GROUP_DIALOG).pressOk();
LeaderboardGroupCreateDialogPO leaderboardGroupCreateDialogPO = getPO(LeaderboardGroupCreateDialogPO::new, ID_CREATE_DEFAULT_LEADERBOARD_GROUP_DIALOG);
leaderboardGroupCreateDialogPO.setUseOverallLeaderboard(useOverallLeaderboard);
leaderboardGroupCreateDialogPO.pressOk();
getPO(ConfirmDialogPO::new, ID_CREATE_DEFAULT_REGATTA_CONFIRM_DIALOG).pressYes();
createRegatta(regattaName, boatClass, regattaStartDate, regattaEndDate).pressOk();
getPO(ConfirmDialogPO::new, ID_LINK_LEADERBORAD_TO_GROUP_DIALOG).pressOk();
@@ -7,6 +7,7 @@ import com.sap.sailing.selenium.core.BySeleniumId;
import com.sap.sailing.selenium.core.FindBy;
import com.sap.sailing.selenium.pages.common.DataEntryDialogPO;
import com.sap.sailing.selenium.pages.gwt.CheckBoxPO;
public class LeaderboardGroupCreateDialogPO extends DataEntryDialogPO {
@@ -29,4 +30,10 @@ public class LeaderboardGroupCreateDialogPO extends DataEntryDialogPO {
this.descriptionField.clear();
this.descriptionField.sendKeys(description);
}
public void setUseOverallLeaderboard(boolean selected) {
WebElement element = findElementBySeleniumId("UseOverallLeaderboardCheckBox");
CheckBoxPO checkbox = new CheckBoxPO(driver, element);
checkbox.setSelected(selected);
}
}
@@ -0,0 +1,33 @@
package com.sap.sailing.selenium.pages.adminconsole.leaderboard;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import com.sap.sailing.selenium.pages.PageArea;
import com.sap.sailing.selenium.pages.gwt.CheckBoxPO;
public class LeaderboardPageConfigurationPanelPO extends PageArea {
public LeaderboardPageConfigurationPanelPO(WebDriver driver, WebElement element) {
super(driver, element);
}
public void setAllowForRaceDetails(boolean selected) {
WebElement element = findElementBySeleniumId("AllowForRaceDetailsCheckBox");
CheckBoxPO checkbox = new CheckBoxPO(driver, element);
checkbox.setSelected(selected);
}
public void setShowCharts(boolean selected) {
WebElement element = findElementBySeleniumId("ShowChartsCheckBox");
CheckBoxPO checkbox = new CheckBoxPO(driver, element);
checkbox.setSelected(selected);
}
public void setShowOverallLeaderboard(boolean selected) {
WebElement element = findElementBySeleniumId("ShowOverallLeaderboardCheckBox");
CheckBoxPO checkbox = new CheckBoxPO(driver, element);
checkbox.setSelected(selected);
}
}
@@ -13,6 +13,12 @@ public class LeaderboardUrlConfigurationDialogPO extends SettingsDialogPO {
private static final String LEADERBOARD_SETTINGS_TAB_LABEL = "Leaderboard"; //$NON-NLS-1$
private static final String LEADERBOARD_SETTINGS_TAB_IDENTIFIER = "LeaderboardSettingsPanel"; //$NON-NLS-1$
private static final String LEADERBOARD_PAGE_SETTINGS_TAB_LABEL = "LeaderboardPage"; //$NON-NLS-1$
private static final String LEADERBOARD_PAGE_SETTINGS_TAB_IDENTIFIER = "LeaderboardPageSettingsPanel"; //$NON-NLS-1$
private static final String OVERALL_LEADERBOARD_SETTINGS_TAB_LABEL = "Overall leaderboard"; //$NON-NLS-1$
private static final String OVERALL_LEADERBOARD_SETTINGS_TAB_IDENTIFIER = "OverallLeaderboardSettingsPanel"; //$NON-NLS-1$
@FindBy(how = BySeleniumId.class, using = "TabbedSettingsDialogTabPanel")
private WebElement tabbedSettingsDialogTabPanel;
@@ -24,5 +30,16 @@ public class LeaderboardUrlConfigurationDialogPO extends SettingsDialogPO {
goToTab(tabbedSettingsDialogTabPanel, LEADERBOARD_SETTINGS_TAB_LABEL, LEADERBOARD_SETTINGS_TAB_IDENTIFIER, TabPanelType.TAB_PANEL);
return new LeaderboardSettingsDialogPO(this.driver, this.getWebElement());
}
public LeaderboardPageConfigurationPanelPO goToLeaderboardPageSettings() {
goToTab(tabbedSettingsDialogTabPanel, LEADERBOARD_PAGE_SETTINGS_TAB_LABEL, LEADERBOARD_PAGE_SETTINGS_TAB_IDENTIFIER, TabPanelType.TAB_PANEL);
return new LeaderboardPageConfigurationPanelPO(this.driver, this.getWebElement());
}
public LeaderboardSettingsDialogPO goToOverallLeaderboardSettings() {
goToTab(tabbedSettingsDialogTabPanel, OVERALL_LEADERBOARD_SETTINGS_TAB_LABEL, OVERALL_LEADERBOARD_SETTINGS_TAB_IDENTIFIER, TabPanelType.TAB_PANEL);
//FIXME this.getWebElement() gives the wrong html node to the po
return new LeaderboardSettingsDialogPO(this.driver, this.getWebElement());
}
}
@@ -9,6 +9,8 @@ import com.sap.sailing.selenium.core.FindBy;
import com.sap.sailing.selenium.pages.HostPage;
import com.sap.sailing.selenium.pages.gwt.CheckBoxPO;
import junit.framework.Assert;
/**
* <p>The page object representing the leaderboard.</p>
*
@@ -76,10 +78,10 @@ public class LeaderboardPage extends HostPage {
@FindBy(how = BySeleniumId.class, using = "LeaderboardSettingsButton")
private WebElement leaderboardSettingsButton;
@FindBy(how = BySeleniumId.class, using = "CompetitorChartsDisplayCheckBox")
@FindBy(how = BySeleniumId.class, using = "ShowChartsDisplayCheckBox")
private WebElement competitorChartsDisplayCheckBox;
@FindBy(how = BySeleniumId.class, using = "CompetitorChartsSettingsButton")
@FindBy(how = BySeleniumId.class, using = "ShowChartsSettingsButton")
private WebElement competitorChartsSettingsButton;
@FindBy(how = BySeleniumId.class, using = "PlayAndPauseAnchor")
@@ -132,6 +134,26 @@ public class LeaderboardPage extends HostPage {
findElementBySeleniumId(this.driver, "LeaderboardSettingsDialog"));
}
public boolean isOverallLeaderboardVisible() {
boolean selected = false;
try {
WebElement element = findElementBySeleniumId("SeriesLeaderboardDisplayCheckBox");
CheckBoxPO checkbox = new CheckBoxPO(this.driver, element);
selected = checkbox.isSelected();
} catch(Exception e) {}
int leaderboardsCount = findElementsBySeleniumId("LeaderboardCellTable").size();
Assert.assertEquals(selected ? 2 : 1, leaderboardsCount);
return selected;
}
public LeaderboardSettingsDialogPO getOverallLeaderboardSettings() {
WebElement overallLeaderboardSettingsButton = findElementBySeleniumId("SeriesLeaderboardSettingsButton");
overallLeaderboardSettingsButton.click();
return new LeaderboardSettingsDialogPO(this.driver,
findElementBySeleniumId(this.driver, "SeriesLeaderboardSettingsDialog"));
}
public LeaderboardTablePO getLeaderboardTable() {
return new LeaderboardTablePO(this.driver, this.leaderboardCellTable);
}
@@ -155,6 +177,17 @@ public class LeaderboardPage extends HostPage {
// return new LineChart(this.driver, findElementBySeleniumId("CompetitorChart"));
// }
public boolean isCompetitorChartVisible() {
CheckBoxPO checkbox = new CheckBoxPO(this.driver, this.competitorChartsDisplayCheckBox);
boolean selected = checkbox.isSelected();
WebElement element = null;
try {
element = findElementBySeleniumId("CompetitorChart");
} catch(Exception e) {}
Assert.assertEquals(selected, element != null);
return selected;
}
@Override
protected void initElements() {
super.initElements();
@@ -1,8 +1,9 @@
package com.sap.sailing.selenium.pages.leaderboard;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
@@ -35,6 +36,11 @@ public class LeaderboardSettingsDialogPO extends DataEntryDialogPO {
@FindBy(how = BySeleniumId.class, using = "ManeuverSettingsPanel")
private WebElement maneuverSettingsPanel;
@FindBy(how = BySeleniumId.class, using = "TimingSettingsPanel")
private WebElement timingSettingsPanel;
public LeaderboardSettingsDialogPO(WebDriver driver, WebElement element) {
super(driver, element);
@@ -65,47 +71,58 @@ public class LeaderboardSettingsDialogPO extends DataEntryDialogPO {
textField.sendKeys(Integer.toString(numberOfRaces));
}
public void setCheckboxValuesForDetails(boolean selected, DetailCheckboxInfo...detailCheckboxInfos) {
for (DetailCheckboxInfo detailCheckboxInfo : detailCheckboxInfos) {
setCheckboxValue(detailCheckboxInfo.getId(), selected);
public boolean isNumberOfRacesToDisplaySelected() {
RadioButtonPO button = new RadioButtonPO(this.driver, this.mostCurrentRacesSelectionRadioButton);
return button.isSelected();
}
public int getNumberOfRacesToDisplaySelected() {
WebElement textField = findElementBySeleniumId(this.raceSelectionSettingsPanel, "NumberOfMostCurrentRacesIntegerBox");
return Integer.valueOf(textField.getAttribute("value"));
}
public void setRefreshInterval(int seconds) {
WebElement textField = findElementBySeleniumId(this.timingSettingsPanel, "RefreshIntervalLongBox");
textField.clear();
textField.sendKeys(Integer.toString(seconds));
}
public int getRefreshInterval() {
WebElement textField = findElementBySeleniumId(this.timingSettingsPanel, "RefreshIntervalLongBox");
return Integer.valueOf(textField.getAttribute("value"));
}
public void selectDetailsAndUnselectOthers(DetailCheckboxInfo...detailsToSelect) {
Arrays.sort(detailsToSelect);
for (DetailCheckboxInfo detail : DetailCheckboxInfo.values()) {
boolean selected = Arrays.binarySearch(detailsToSelect, detail) >= 0;
setCheckboxValue(detail.getId(), selected);
}
}
public void assertCheckboxValuesForDetails(boolean selected, DetailCheckboxInfo...detailCheckboxInfos) {
for (DetailCheckboxInfo detailCheckboxInfo : detailCheckboxInfos) {
String checkboxId = detailCheckboxInfo.getId();
Assert.assertTrue("Checkbox with id \"" + checkboxId + "\" is set to a wrong value", selected == getCheckboxValue(checkboxId));
public DetailCheckboxInfo[] getSelectedDetails() {
List<DetailCheckboxInfo> selectedDetails = new ArrayList<>();
for (DetailCheckboxInfo detail : DetailCheckboxInfo.values()) {
String checkboxId = detail.getId();
if(getCheckboxValue(checkboxId)) {
selectedDetails.add(detail);
}
}
}
public void setOverallDetails() {
return selectedDetails.toArray(new DetailCheckboxInfo[selectedDetails.size()]);
}
public void showAllOverallDetails() {
setSelectionForAllSettings(this.overallDetailsSettingsPanel, true);
}
public void setRaceDetails() {
}
public void showAllRaceDetails() {
setSelectionForAllSettings(this.raceDetailsSettingsPanel, true);
}
public void setLegDetails() {
}
public void showAllLegDetails() {
setSelectionForAllSettings(this.legDetailsSettingsPanel, true);
}
public void setManeuverDetails() {
}
public void showAllManeuverDetails() {
setSelectionForAllSettings(this.maneuverSettingsPanel, true);
}
@@ -71,7 +71,7 @@ public class TestStateVisualizationRegatta extends AbstractSeleniumTest {
EventConfigurationPanelPO eventConfigPanel = adminConsolePage.goToEvents();
final String eventName = "RegattaStateTestEvent", venue = "Anywhere", boatClass = "J-22";
eventConfigPanel.createEventWithDefaultLeaderboardGroupRegattaAndDefaultLeaderboard(eventName, null, venue,
getPastDate(3), getFutureDate(3), true, regattaName, boatClass, regattaStartDate, regattaEndDate);
getPastDate(3), getFutureDate(3), true, regattaName, boatClass, regattaStartDate, regattaEndDate, false);
this.eventUrl = eventConfigPanel.getEventEntry(eventName).getEventURL();
}
@@ -3,7 +3,8 @@ package com.sap.sailing.selenium.test.raceboard;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.Date;
import java.util.stream.Stream;
import java.util.List;
import java.util.stream.Collectors;
import javax.xml.bind.DatatypeConverter;
@@ -18,6 +19,7 @@ import com.sap.sailing.selenium.pages.adminconsole.leaderboard.LeaderboardConfig
import com.sap.sailing.selenium.pages.adminconsole.leaderboard.LeaderboardConfigurationPanelPO.LeaderboardEntryPO;
import com.sap.sailing.selenium.pages.adminconsole.leaderboard.LeaderboardDetailsPanelPO;
import com.sap.sailing.selenium.pages.adminconsole.leaderboard.LeaderboardDetailsPanelPO.RaceDescriptor;
import com.sap.sailing.selenium.pages.adminconsole.leaderboard.LeaderboardPageConfigurationPanelPO;
import com.sap.sailing.selenium.pages.adminconsole.leaderboard.LeaderboardUrlConfigurationDialogPO;
import com.sap.sailing.selenium.pages.adminconsole.regatta.RegattaListCompositePO.RegattaDescriptor;
import com.sap.sailing.selenium.pages.adminconsole.tracking.TrackedRacesListPO;
@@ -28,6 +30,7 @@ import com.sap.sailing.selenium.pages.adminconsole.tractrac.TracTracEventManagem
import com.sap.sailing.selenium.pages.leaderboard.DetailCheckboxInfo;
import com.sap.sailing.selenium.pages.leaderboard.LeaderboardPage;
import com.sap.sailing.selenium.pages.leaderboard.LeaderboardSettingsDialogPO;
import com.sap.sailing.selenium.pages.leaderboard.LeaderboardTablePO;
import com.sap.sailing.selenium.pages.raceboard.MapSettingsPO;
import com.sap.sailing.selenium.pages.raceboard.RaceBoardPage;
import com.sap.sailing.selenium.test.AbstractSeleniumTest;
@@ -54,9 +57,9 @@ public class SettingsTest extends AbstractSeleniumTest {
@Override
@Before
public void setUp() {
this.trackableRace = new TrackableRaceDescriptor(BMW_CUP_EVENT, String.format(RACE, 1), BMW_CUP_BOAT_CLASS);
this.trackedRace = new TrackedRaceDescriptor(BMW_CUP_REGATTA, BMW_CUP_BOAT_CLASS, String.format(RACE, 1));
clearState(getContextRoot());
// this.trackableRace = new TrackableRaceDescriptor(BMW_CUP_EVENT, String.format(RACE, 1), BMW_CUP_BOAT_CLASS);
// this.trackedRace = new TrackedRaceDescriptor(BMW_CUP_REGATTA, BMW_CUP_BOAT_CLASS, String.format(RACE, 1));
// clearState(getContextRoot());
super.setUp();
}
@@ -64,27 +67,13 @@ public class SettingsTest extends AbstractSeleniumTest {
@Ignore
@Test
public void createRaceAsAdminSetWindSettingToTrue() throws InterruptedException, UnsupportedEncodingException {
RegattaDescriptor bmwCupDescriptor = new RegattaDescriptor(BMW_CUP_EVENT, BMW_CUP_BOAT_CLASS);
AdminConsolePage adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
EventConfigurationPanelPO events = adminConsole.goToEvents();
events.createEventWithDefaultLeaderboardGroupRegattaAndDefaultLeaderboard(BMW_CUP_EVENT, BMW_CUP_EVENTS_DESC,
BMW_VENUE, BMW_START_EVENT_TIME, BMW_STOP_EVENT_TIME, true, BMW_CUP_REGATTA, BMW_CUP_BOAT_CLASS,
BMW_START_EVENT_TIME, BMW_STOP_EVENT_TIME);
BMW_START_EVENT_TIME, BMW_STOP_EVENT_TIME, false);
TracTracEventManagementPanelPO tracTracEvents = adminConsole.goToTracTracEvents();
tracTracEvents.listTrackableRaces(BMW_CUP_JSON_URL);
tracTracEvents.setReggataForTracking(bmwCupDescriptor);
tracTracEvents.setTrackSettings(true, false, false);
tracTracEvents.startTrackingForRace(this.trackableRace);
TrackedRacesListPO trackedRacesList = tracTracEvents.getTrackedRacesList();
trackedRacesList.waitForTrackedRace(this.trackedRace, Status.FINISHED, 600); // with the TracAPI, REPLAY races
// status FINISHED when done loading
LeaderboardConfigurationPanelPO leaderboard = adminConsole.goToLeaderboardConfiguration();
LeaderboardDetailsPanelPO details = leaderboard.getLeaderboardDetails(BMW_CUP_REGATTA);
Assert.assertTrue(details != null);
details.linkRace(new RaceDescriptor(BMW_CUP_RACE_NAME, "Default", false, false, 0), trackedRace);
initTrackingForBmwCupRace(adminConsole);
RaceBoardPage raceboard = RaceBoardPage.goToRaceboardUrl(getWebDriver(), getContextRoot(), BMW_CUP_REGATTA,
BMW_CUP_REGATTA, String.format(RACE, 1));
@@ -99,51 +88,282 @@ public class SettingsTest extends AbstractSeleniumTest {
Assert.assertTrue(stillSelected);
}
private void initTrackingForBmwCupRace(AdminConsolePage adminConsole) {
TracTracEventManagementPanelPO tracTracEvents = adminConsole.goToTracTracEvents();
tracTracEvents.listTrackableRaces(BMW_CUP_JSON_URL);
RegattaDescriptor bmwCupDescriptor = new RegattaDescriptor(BMW_CUP_EVENT, BMW_CUP_BOAT_CLASS);
tracTracEvents.setReggataForTracking(bmwCupDescriptor);
tracTracEvents.setTrackSettings(true, false, false);
tracTracEvents.startTrackingForRace(this.trackableRace);
TrackedRacesListPO trackedRacesList = tracTracEvents.getTrackedRacesList();
trackedRacesList.waitForTrackedRace(this.trackedRace, Status.FINISHED, 600); // with the TracAPI, REPLAY races
// status FINISHED when done loading
LeaderboardConfigurationPanelPO leaderboard = adminConsole.goToLeaderboardConfiguration();
LeaderboardDetailsPanelPO details = leaderboard.getLeaderboardDetails(BMW_CUP_REGATTA);
Assert.assertTrue(details != null);
details.linkRace(new RaceDescriptor(BMW_CUP_RACE_NAME, "Default", false, false, 0), trackedRace);
}
@Test
@Ignore
public void testLeaderboardPageSettingsForwarding() {
// create event
AdminConsolePage adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
EventConfigurationPanelPO events = adminConsole.goToEvents();
events.createEventWithDefaultLeaderboardGroupRegattaAndDefaultLeaderboard(BMW_CUP_EVENT, BMW_CUP_EVENTS_DESC,
BMW_VENUE, BMW_START_EVENT_TIME, BMW_STOP_EVENT_TIME, true, BMW_CUP_REGATTA, BMW_CUP_BOAT_CLASS,
BMW_START_EVENT_TIME, BMW_STOP_EVENT_TIME);
BMW_START_EVENT_TIME, BMW_STOP_EVENT_TIME, false);
// set custom leaderboard settings
LeaderboardConfigurationPanelPO leaderboardConfiguration = adminConsole.goToLeaderboardConfiguration();
LeaderboardEntryPO leaderboardEntry = leaderboardConfiguration.getLeaderboardTable().getEntry(BMW_CUP_REGATTA);
LeaderboardUrlConfigurationDialogPO urlConfigurationDialog = leaderboardEntry.getLeaderboardPageUrlConfigurationDialog();
LeaderboardUrlConfigurationDialogPO urlConfigurationDialog = leaderboardEntry
.getLeaderboardPageUrlConfigurationDialog();
LeaderboardSettingsDialogPO leaderboardSettingsPanel = urlConfigurationDialog.goToLeaderboardSettings();
leaderboardSettingsPanel.setCheckboxValue("R2CheckBox", false);
DetailCheckboxInfo[] detailsSelected = { DetailCheckboxInfo.REGATTA_RANK, DetailCheckboxInfo.TOTAL_DISTANCE, DetailCheckboxInfo.TOTAL_AVERAGE_SPEED_OVER_GROUND, DetailCheckboxInfo.TIME_ON_TIME_FACTOR, DetailCheckboxInfo.TIME_ON_DISTANCE_ALLOWANCE };
leaderboardSettingsPanel.setCheckboxValuesForDetails(true, detailsSelected);
DetailCheckboxInfo[] detailsUnselected = { DetailCheckboxInfo.TOTAL_TIME, DetailCheckboxInfo.MAXIMUM_SPEED_OVER_GROUND };
leaderboardSettingsPanel.setCheckboxValuesForDetails(false, detailsUnselected);
DetailCheckboxInfo[] detailsToSelect = {
// Overall details
DetailCheckboxInfo.REGATTA_RANK, DetailCheckboxInfo.TOTAL_DISTANCE,
DetailCheckboxInfo.TOTAL_AVERAGE_SPEED_OVER_GROUND, DetailCheckboxInfo.TIME_ON_TIME_FACTOR,
DetailCheckboxInfo.TIME_ON_DISTANCE_ALLOWANCE,
// Race details
DetailCheckboxInfo.RACE_AVERAGE_SPEED_OVER_GROUND,
DetailCheckboxInfo.RACE_DISTANCE_INCLUDING_GATE_START, DetailCheckboxInfo.RACE_TIME,
DetailCheckboxInfo.RACE_CALCULATED_TIME,
DetailCheckboxInfo.RACE_CALCULATED_TIME_AT_ESTIMATED_ARRIVAL_AT_COMPETITOR_FARTHEST_AHEAD,
DetailCheckboxInfo.RACE_CURRENT_SPEED_OVER_GROUND, DetailCheckboxInfo.RACE_CURRENT_RIDE_HEIGHT,
DetailCheckboxInfo.RACE_DISTANCE_TO_COMPETITOR_FARTHEST_AHEAD, DetailCheckboxInfo.NUMBER_OF_MANEUVERS,
DetailCheckboxInfo.DISPLAY_LEGS, DetailCheckboxInfo.CURRENT_LEG,
DetailCheckboxInfo.RACE_AVERAGE_ABSOLUTE_CROSS_TRACK_ERROR,
DetailCheckboxInfo.RACE_AVERAGE_SIGNED_CROSS_TRACK_ERROR,
DetailCheckboxInfo.RACE_RATIO_BETWEEN_TIME_SINCE_LAST_POSITION_FIX_AND_AVERAGE_SAMPLING_INTERVAL,
// Race Start Analysis
DetailCheckboxInfo.RACE_DISTANCE_TO_START_FIVE_SECONDS_BEFORE_START,
DetailCheckboxInfo.TIME_BETWEEN_RACE_START_AND_COMPETITOR_START,
DetailCheckboxInfo.SPEED_OVER_GROUND_AT_RACE_START, DetailCheckboxInfo.SPEED_OVER_GROUND_WHEN_STARTING,
DetailCheckboxInfo.DISTANCE_TO_STARBOARD_END_OF_STARTLINE_WHEN_STARTING, DetailCheckboxInfo.START_TACK,
// Leg Details
DetailCheckboxInfo.AVERAGE_SPEED_OVER_GROUND, DetailCheckboxInfo.DISTANCE,
DetailCheckboxInfo.DISTANCE_INCLUDING_START, DetailCheckboxInfo.GAP_TO_LEADER,
DetailCheckboxInfo.GAP_CHANGE_SINCE_LEG_START,
DetailCheckboxInfo.SIDE_TO_WHICH_MARK_AT_LEG_START_WAS_ROUNDED,
DetailCheckboxInfo.CURRENT_SPEED_OVER_GROUND, DetailCheckboxInfo.CURRENT_RIDE_HEIGHT,
DetailCheckboxInfo.WINDWARD_DISTANCE_TO_GO, DetailCheckboxInfo.NUMBER_OF_MANEVEURS,
DetailCheckboxInfo.ESTIMATED_TIME_TO_NEXT_WAYPOINT, DetailCheckboxInfo.VELOCITY_MADE_GOOD,
DetailCheckboxInfo.TIME, DetailCheckboxInfo.CORRECTED_TIME,
DetailCheckboxInfo.AVERAGE_ABSOLUTE_CROSS_TRACK_ERROR,
// Maneuvers
DetailCheckboxInfo.TACK, DetailCheckboxInfo.AVERAGE_TACK_LOSS, DetailCheckboxInfo.JIBE,
DetailCheckboxInfo.AVERAGE_JIBE_LOSS, DetailCheckboxInfo.PENALTY_CIRCLE
};
leaderboardSettingsPanel.selectDetailsAndUnselectOthers(detailsToSelect);
leaderboardSettingsPanel.setRefreshInterval(2);
// open settings dialog of configurated leaderboard and match the set values with forwarded values
LeaderboardPage leaderboardPage = urlConfigurationDialog.openLeaderboard();
leaderboardSettingsPanel = leaderboardPage.getLeaderboardSettings();
leaderboardSettingsPanel.assertCheckboxValuesForDetails(true, detailsSelected);
leaderboardSettingsPanel.assertCheckboxValuesForDetails(false, detailsUnselected);
DetailCheckboxInfo[] selectedDetails = leaderboardSettingsPanel.getSelectedDetails();
Assert.assertArrayEquals(detailsToSelect, selectedDetails);
Assert.assertTrue(leaderboardSettingsPanel.getCheckboxValue("R1CheckBox"));
Assert.assertTrue(!leaderboardSettingsPanel.getCheckboxValue("R2CheckBox"));
Assert.assertTrue(leaderboardSettingsPanel.getCheckboxValue("R3CheckBox"));
Assert.assertEquals(2, leaderboardSettingsPanel.getRefreshInterval());
// set different custom leaderboard settings
adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
leaderboardConfiguration = adminConsole.goToLeaderboardConfiguration();
leaderboardEntry = leaderboardConfiguration.getLeaderboardTable().getEntry(BMW_CUP_REGATTA);
urlConfigurationDialog = leaderboardEntry.getLeaderboardPageUrlConfigurationDialog();
leaderboardSettingsPanel = urlConfigurationDialog.goToLeaderboardSettings();
detailsUnselected = Stream.concat(Arrays.stream(detailsSelected), Arrays.stream(detailsUnselected))
.toArray(DetailCheckboxInfo[]::new);
leaderboardSettingsPanel.setCheckboxValuesForDetails(false, detailsUnselected);
leaderboardSettingsPanel.setNumberOfRacesToDisplay(2);
leaderboardSettingsPanel.selectDetailsAndUnselectOthers();
// open settings dialog of configurated leaderboard and match the set values with forwarded values
leaderboardPage = urlConfigurationDialog.openLeaderboard();
leaderboardSettingsPanel = leaderboardPage.getLeaderboardSettings();
leaderboardSettingsPanel.assertCheckboxValuesForDetails(false, detailsUnselected);
Assert.assertTrue(leaderboardSettingsPanel.getCheckboxValue("R1CheckBox"));
Assert.assertTrue(leaderboardSettingsPanel.getCheckboxValue("R2CheckBox"));
Assert.assertTrue(leaderboardSettingsPanel.getCheckboxValue("R3CheckBox"));
Assert.assertTrue(leaderboardSettingsPanel.isNumberOfRacesToDisplaySelected());
Assert.assertEquals(2, leaderboardSettingsPanel.getNumberOfRacesToDisplaySelected());
Assert.assertEquals(1, leaderboardSettingsPanel.getRefreshInterval());
selectedDetails = leaderboardSettingsPanel.getSelectedDetails();
//TODO fix leaderboard default values
// Assert.assertEquals(0, selectedDetails.length);
}
@Test
@Ignore
public void testLeaderboardPageSettingsForwardingWithTrackedRace() {
// create event
AdminConsolePage adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
EventConfigurationPanelPO events = adminConsole.goToEvents();
events.createEventWithDefaultLeaderboardGroupRegattaAndDefaultLeaderboard(BMW_CUP_EVENT, BMW_CUP_EVENTS_DESC,
BMW_VENUE, BMW_START_EVENT_TIME, BMW_STOP_EVENT_TIME, true, BMW_CUP_REGATTA, BMW_CUP_BOAT_CLASS,
BMW_START_EVENT_TIME, BMW_STOP_EVENT_TIME, false);
initTrackingForBmwCupRace(adminConsole);
// set custom leaderboard settings
LeaderboardConfigurationPanelPO leaderboardConfiguration = adminConsole.goToLeaderboardConfiguration();
LeaderboardEntryPO leaderboardEntry = leaderboardConfiguration.getLeaderboardTable().getEntry(BMW_CUP_REGATTA);
LeaderboardUrlConfigurationDialogPO urlConfigurationDialog = leaderboardEntry
.getLeaderboardPageUrlConfigurationDialog();
LeaderboardPageConfigurationPanelPO leaderboardPageSettings = urlConfigurationDialog
.goToLeaderboardPageSettings();
leaderboardPageSettings.setAllowForRaceDetails(true);
leaderboardPageSettings.setShowCharts(false);
LeaderboardSettingsDialogPO leaderboardSettingsPanel = urlConfigurationDialog.goToLeaderboardSettings();
leaderboardSettingsPanel.setCheckboxValue("R2CheckBox", false);
DetailCheckboxInfo[] detailsToSelect = new DetailCheckboxInfo[] {
// Overall details
DetailCheckboxInfo.TOTAL_TIME, DetailCheckboxInfo.MAXIMUM_SPEED_OVER_GROUND,
// Race details
DetailCheckboxInfo.RACE_GAP_TO_LEADER, DetailCheckboxInfo.RACE_DISTANCE,
// Race Start Analysis
DetailCheckboxInfo.RACE_SPEED_OVER_GROUND_FIVE_SECONDS_BEFORE_START,
DetailCheckboxInfo.DISTANCE_TO_START_AT_RACE_START,
//TODO how to get leaderboard to show leg details and maneuvers? Is it required?
// Leg Details
// DetailCheckboxInfo.AVERAGE_SIGNED_CROSS_TRACK_ERROR, DetailCheckboxInfo.RANK_GAIN,
// Maneuvers
// DetailCheckboxInfo.AVERAGE_MANEUVER_LOSS
};
leaderboardSettingsPanel.setCheckboxValue("R2CheckBox", false);
leaderboardSettingsPanel.setCheckboxValue("R3CheckBox", false);
leaderboardSettingsPanel.selectDetailsAndUnselectOthers(detailsToSelect);
// check the displaying leaderboard table columns of a tracked race
LeaderboardPage leaderboardPage = urlConfigurationDialog.openLeaderboard();
Assert.assertFalse(leaderboardPage.isCompetitorChartVisible());
LeaderboardTablePO leaderboardTable = leaderboardPage.getLeaderboardTable();
leaderboardTable.expandRace("R1");
List<String> columnHeadersToCheck = Arrays.stream(detailsToSelect).map(detail -> detail.getLabel())
.collect(Collectors.toList());
for (String headerToCheck : columnHeadersToCheck) {
Assert.assertTrue("Column header label \"" + headerToCheck + "\" not found",
leaderboardTable.containsColumnHeader(headerToCheck));
}
//test showRaceDetails and showChart configuration options
adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
leaderboardConfiguration = adminConsole.goToLeaderboardConfiguration();
leaderboardEntry = leaderboardConfiguration.getLeaderboardTable().getEntry(BMW_CUP_REGATTA);
urlConfigurationDialog = leaderboardEntry.getLeaderboardPageUrlConfigurationDialog();
leaderboardPageSettings = urlConfigurationDialog.goToLeaderboardPageSettings();
leaderboardPageSettings.setAllowForRaceDetails(false);
leaderboardPageSettings.setShowCharts(true);
// open settings dialog of configurated leaderboard and match the set values with forwarded values
leaderboardPage = urlConfigurationDialog.openLeaderboard();
Assert.assertTrue(leaderboardPage.isCompetitorChartVisible());
}
@Test
@Ignore
public void testLeaderboardPageSettingsForwardingWithOverallLeaderboard() {
// create event
AdminConsolePage adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
EventConfigurationPanelPO events = adminConsole.goToEvents();
events.createEventWithDefaultLeaderboardGroupRegattaAndDefaultLeaderboard(BMW_CUP_EVENT, BMW_CUP_EVENTS_DESC,
BMW_VENUE, BMW_START_EVENT_TIME, BMW_STOP_EVENT_TIME, true, BMW_CUP_REGATTA, BMW_CUP_BOAT_CLASS,
BMW_START_EVENT_TIME, BMW_STOP_EVENT_TIME, true);
// set custom leaderboard settings
LeaderboardConfigurationPanelPO leaderboardConfiguration = adminConsole.goToLeaderboardConfiguration();
LeaderboardEntryPO leaderboardEntry = leaderboardConfiguration.getLeaderboardTable().getEntry(BMW_CUP_REGATTA);
LeaderboardUrlConfigurationDialogPO urlConfigurationDialog = leaderboardEntry
.getLeaderboardPageUrlConfigurationDialog();
LeaderboardSettingsDialogPO leaderboardSettingsPanel = urlConfigurationDialog.goToLeaderboardSettings();
DetailCheckboxInfo[] detailsToSelect = {
// Overall details
DetailCheckboxInfo.TIME_ON_DISTANCE_ALLOWANCE,
// Race details
DetailCheckboxInfo.RACE_RATIO_BETWEEN_TIME_SINCE_LAST_POSITION_FIX_AND_AVERAGE_SAMPLING_INTERVAL,
// Race Start Analysis
DetailCheckboxInfo.TIME_BETWEEN_RACE_START_AND_COMPETITOR_START,
// Leg Details
DetailCheckboxInfo.SIDE_TO_WHICH_MARK_AT_LEG_START_WAS_ROUNDED,
// Maneuvers
DetailCheckboxInfo.AVERAGE_JIBE_LOSS, DetailCheckboxInfo.PENALTY_CIRCLE
};
leaderboardSettingsPanel.selectDetailsAndUnselectOthers(detailsToSelect);
leaderboardSettingsPanel.setRefreshInterval(2);
LeaderboardPageConfigurationPanelPO leaderboardPageSettings = urlConfigurationDialog
.goToLeaderboardPageSettings();
leaderboardPageSettings.setShowOverallLeaderboard(true);
leaderboardSettingsPanel = urlConfigurationDialog.goToOverallLeaderboardSettings();
DetailCheckboxInfo[] overallDetailsToSelect = {
// Overall details
DetailCheckboxInfo.TIME_ON_TIME_FACTOR,
// Race details
DetailCheckboxInfo.RACE_CALCULATED_TIME_AT_ESTIMATED_ARRIVAL_AT_COMPETITOR_FARTHEST_AHEAD,
// Race Start Analysis
DetailCheckboxInfo.DISTANCE_TO_STARBOARD_END_OF_STARTLINE_WHEN_STARTING,
// Leg Details
DetailCheckboxInfo.WINDWARD_DISTANCE_TO_GO,
// Maneuvers
DetailCheckboxInfo.AVERAGE_MANEUVER_LOSS
};
leaderboardSettingsPanel.selectDetailsAndUnselectOthers(overallDetailsToSelect);
leaderboardSettingsPanel.setRefreshInterval(3);
// open settings dialog of configurated leaderboard and match the set values with forwarded values
LeaderboardPage leaderboardPage = urlConfigurationDialog.openLeaderboard();
leaderboardSettingsPanel = leaderboardPage.getLeaderboardSettings();
DetailCheckboxInfo[] selectedDetails = leaderboardSettingsPanel.getSelectedDetails();
Assert.assertArrayEquals(detailsToSelect, selectedDetails);
Assert.assertEquals(2, leaderboardSettingsPanel.getRefreshInterval());
// open settings dialog of configurated OVERALL leaderboard and match the set values with forwarded values
leaderboardSettingsPanel = leaderboardPage.getOverallLeaderboardSettings();
selectedDetails = leaderboardSettingsPanel.getSelectedDetails();
Assert.assertArrayEquals(overallDetailsToSelect, selectedDetails);
Assert.assertEquals(3, leaderboardSettingsPanel.getRefreshInterval());
}
}
@@ -38,7 +38,7 @@ public class SimulatorOverlayTest extends AbstractSeleniumTest {
private static final String RACE_N_49ER = "R%d (49er)"; //$NON-NLS-1$
private static final String MEDAL_RACE_49ER = "R12-M Medal (49er)"; //$NON-NLS-1$
private static final String EVENT_DESC = "Kieler Woche 2015"; //$NON-NLS-1$
private static final String VENUE = "Kieler Förde"; //$NON-NLS-1$
private static final String VENUE = "Kieler F�rde"; //$NON-NLS-1$
private static final Date EVENT_START_TIME = DatatypeConverter.parseDateTime("2015-06-20T08:00:00-00:00")
.getTime();
private static final Date EVENT_END_TIME = DatatypeConverter.parseDateTime("2015-06-28T20:00:00-00:00")
@@ -64,7 +64,7 @@ public class SimulatorOverlayTest extends AbstractSeleniumTest {
final EventConfigurationPanelPO events = adminConsole.goToEvents();
events.createEventWithDefaultLeaderboardGroupRegattaAndDefaultLeaderboard(EVENT, EVENT_DESC,
VENUE, EVENT_START_TIME, EVENT_END_TIME, true, REGATTA_49ER_WITH_SUFFIX, BOAT_CLASS_49ER,
EVENT_START_TIME, EVENT_END_TIME);
EVENT_START_TIME, EVENT_END_TIME, false);
final RegattaStructureManagementPanelPO regattaStructurePanel = adminConsole.goToRegattaStructure();
final RegattaDetailsCompositePO regattaDetails = regattaStructurePanel.getRegattaDetails(regattaDescriptor);