diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/AbstractEventManagementPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/AbstractEventManagementPanel.java index 82052dd56fd..82222b38d8d 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/AbstractEventManagementPanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/AbstractEventManagementPanel.java @@ -23,11 +23,14 @@ public abstract class AbstractEventManagementPanel extends AbstractRegattaPanel ErrorReporter errorReporter, RaceSelectionProvider raceSelectionProvider, StringMessages stringMessages) { super(sailingService, regattaRefresher, errorReporter, stringMessages); this.availableRegattas = new ArrayList(); + this.availableRegattasListBox = new ListBox(); - this.availableRegattasListBox.ensureDebugId("AvailableRegattas"); + this.availableRegattasListBox.ensureDebugId("AvailableRegattasListBox"); + // TrackedEventsComposite should exist in every *ManagementPanel. trackedRacesListComposite = new TrackedRacesListComposite(sailingService, errorReporter, regattaRefresher, raceSelectionProvider, stringMessages, /* multiselection */ true); + trackedRacesListComposite.ensureDebugId("TrackedRacesListComposite"); } @Override diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/AbstractTrackedRacesListComposite.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/AbstractTrackedRacesListComposite.java index f7c16b358b6..ea077f59464 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/AbstractTrackedRacesListComposite.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/AbstractTrackedRacesListComposite.java @@ -126,7 +126,7 @@ public abstract class AbstractTrackedRacesListComposite extends SimplePanel impl AdminConsoleTableResources tableRes = GWT.create(AdminConsoleTableResources.class); raceTable = new CellTable(/* pageSize */10000, tableRes); - raceTable.ensureDebugId("TrackedRaces"); + raceTable.ensureDebugId("TrackedRacesCellTable"); ListHandler columnSortHandler = setupTableColumns(stringMessages); raceTable.setWidth("300px"); raceTable.setSelectionModel(selectionModel); @@ -163,13 +163,14 @@ public abstract class AbstractTrackedRacesListComposite extends SimplePanel impl return strings; } }; + filterablePanelRaces.getTextBox().ensureDebugId("TrackedRacesFilterTextBox"); filterPanel.add(filterablePanelRaces); HorizontalPanel trackedRacesButtonPanel = new HorizontalPanel(); trackedRacesButtonPanel.setSpacing(10); panel.add(trackedRacesButtonPanel); btnRefresh = new Button(stringMessages.refresh()); - btnRefresh.ensureDebugId("Refresh"); + btnRefresh.ensureDebugId("RefreshButton"); btnRefresh.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/AdminConsoleEntryPoint.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/AdminConsoleEntryPoint.java index b902e43e1e1..59285c96f49 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/AdminConsoleEntryPoint.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/AdminConsoleEntryPoint.java @@ -62,7 +62,7 @@ public class AdminConsoleEntryPoint extends AbstractEntryPoint implements Regatt RegattaStructureManagementPanel eventStructureManagementPanel = new RegattaStructureManagementPanel( sailingService, this, stringMessages, this); - // eventStructureManagementPanel.ensureDebugId("RegattaStructureManagement"); + eventStructureManagementPanel.ensureDebugId("RegattaStructureManagement"); eventStructureManagementPanel.setSize("90%", "90%"); addScrollableTab(tabPanel, eventStructureManagementPanel, stringMessages.regattas()); regattaDisplayers.add(eventStructureManagementPanel); @@ -100,7 +100,7 @@ public class AdminConsoleEntryPoint extends AbstractEntryPoint implements Regatt TrackedRacesManagementPanel trackedRacesManagementPanel = new TrackedRacesManagementPanel(sailingService, this, this, stringMessages); - // trackedRacesManagementPanel.ensureDebugId("TrackedRacesManagement"); + trackedRacesManagementPanel.ensureDebugId("TrackedRacesManagement"); trackedRacesManagementPanel.setSize("90%", "90%"); addScrollableTab(tabPanel, trackedRacesManagementPanel, stringMessages.trackedRaces()); regattaDisplayers.add(trackedRacesManagementPanel); @@ -127,7 +127,7 @@ public class AdminConsoleEntryPoint extends AbstractEntryPoint implements Regatt final LeaderboardGroupConfigPanel leaderboardGroupConfigPanel = new LeaderboardGroupConfigPanel(sailingService, this, this, stringMessages); - // leaderboardGroupConfigPanel.ensureDebugId("LeaderboardGroupConfiguration"); + leaderboardGroupConfigPanel.ensureDebugId("LeaderboardGroupConfiguration"); leaderboardGroupConfigPanel.setSize("90%", "90%"); addScrollableTab(tabPanel, leaderboardGroupConfigPanel, stringMessages.leaderboardGroupConfiguration()); regattaDisplayers.add(leaderboardGroupConfigPanel); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/FleetListEditorComposite.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/FleetListEditorComposite.java index 61b3e36aecd..f89e56eb2e3 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/FleetListEditorComposite.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/FleetListEditorComposite.java @@ -46,9 +46,16 @@ public class FleetListEditorComposite extends ListEditorComposite { panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); final TextBox nameBox = createNameBox(); + nameBox.ensureDebugId("NameTextBox"); + final IntegerBox orderNoBox = createOrderNoBox(); + orderNoBox.ensureDebugId("OrderNoIntegerBox"); + final ListBox colorListBox = createColorListBox(nameBox, orderNoBox); + colorListBox.ensureDebugId("ColorListBox"); + final Button addButton = new Button(stringMessages.add()); + addButton.ensureDebugId("AddButton"); addButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/FlexibleLeaderboardCreateDialog.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/FlexibleLeaderboardCreateDialog.java index dbf454bfae2..d4458d1c004 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/FlexibleLeaderboardCreateDialog.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/FlexibleLeaderboardCreateDialog.java @@ -14,9 +14,11 @@ public class FlexibleLeaderboardCreateDialog extends FlexibleLeaderboardDialog { super(stringMessages.createFlexibleLeaderboard(), new LeaderboardDescriptor(), stringMessages, existingEvents, errorReporter, new FlexibleLeaderboardDialog.LeaderboardParameterValidator(stringMessages, existingLeaderboards), callback); nameTextBox = createTextBox(null); - nameTextBox.ensureDebugId("LeaderboardNameField"); - displayNameTextBox = createTextBox(null); + nameTextBox.ensureDebugId("NameTextBox"); nameTextBox.setVisibleLength(50); + + displayNameTextBox = createTextBox(null); + displayNameTextBox.ensureDebugId("DisplayNameTextBox"); displayNameTextBox.setVisibleLength(50); scoringSchemeListBox = createScoringSchemeListBox(this, stringMessages); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardConfigPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardConfigPanel.java index f0bae5838d7..232a594728f 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardConfigPanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardConfigPanel.java @@ -197,6 +197,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb AdminConsoleTableResources tableRes = GWT.create(AdminConsoleTableResources.class); leaderboardTable = new CellTable(/* pageSize */10000, tableRes); + leaderboardTable.ensureDebugId("LeaderboardsCellTable"); filterLeaderboardPanel = new AbstractFilterablePanel(lblFilterEvents, availableLeaderboardList, leaderboardTable, leaderboardList) { @Override public List getSearchableStrings(StrippedLeaderboardDTO t) { @@ -206,7 +207,10 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb return strings; } }; + filterLeaderboardPanel.getTextBox().ensureDebugId("LeaderboardsFilterTextBox"); + leaderboardRemoveButton = new Button(stringMessages.remove()); + leaderboardRemoveButton.ensureDebugId("LeaderboardsRemoveButton"); leaderboardRemoveButton.setEnabled(false); leaderboardRemoveButton.addClickHandler(new ClickHandler() { @Override @@ -219,7 +223,6 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb leaderboardConfigControlsPanel.add(filterLeaderboardPanel); leaderboardConfigControlsPanel.add(leaderboardRemoveButton); leaderboardsPanel.add(leaderboardConfigControlsPanel); - leaderboardTable.ensureDebugId("AvailableLeaderboardsTable"); ListHandler leaderboardColumnListHandler = new ListHandler( leaderboardList.getList()); @@ -384,6 +387,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb }); leaderboardList.addDataDisplay(leaderboardTable); leaderboardsPanel.add(leaderboardTable); + HorizontalPanel leaderboardButtonPanel = new HorizontalPanel(); leaderboardButtonPanel.setSpacing(5); leaderboardsPanel.add(leaderboardButtonPanel); @@ -411,6 +415,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb // caption panels for the selected leaderboard and tracked races HorizontalPanel splitPanel = new HorizontalPanel(); + splitPanel.ensureDebugId("LeaderboardDetailsPanel"); mainPanel.add(splitPanel); selectedLeaderBoardPanel = new CaptionPanel(stringMessages.leaderboard()); @@ -433,11 +438,13 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb raceSelectionProvider = new RaceSelectionModel(); trackedRacesListComposite = new TrackedRacesListComposite(sailingService, errorReporter, adminConsole, raceSelectionProvider, stringMessages, /* multiselection */false); + trackedRacesListComposite.ensureDebugId("TrackedRacesListComposite"); trackedRacesPanel.add(trackedRacesListComposite); trackedRacesListComposite.addTrackedRaceChangeListener(this); raceSelectionProvider.addRaceSelectionChangeListener(this); Button reloadAllRaceLogs = new Button(stringMessages.reloadAllRaceLogs()); + reloadAllRaceLogs.ensureDebugId("ReloadAllRaceLogsButton"); reloadAllRaceLogs.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -537,6 +544,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb Label lblRaceNamesIn = new Label(stringMessages.races()); vPanel.add(lblRaceNamesIn); raceColumnTable = new CellTable(/* pageSize */200, tableRes); + raceColumnTable.ensureDebugId("RacesCellTable"); raceColumnTable.addColumn(raceLinkColumn, stringMessages.name()); raceColumnTable.addColumn(fleetNameColumn, stringMessages.fleet()); raceColumnTable.addColumn(isMedalRaceCheckboxColumn, stringMessages.medalRace()); @@ -559,7 +567,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb vPanel.add(selectedLeaderboardRaceButtonPanel); addRaceColumnsButton = new Button(stringMessages.actionAddRaces() + "..."); - selectedLeaderboardRaceButtonPanel.add(addRaceColumnsButton); + addRaceColumnsButton.ensureDebugId("AddRacesButton"); addRaceColumnsButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -570,23 +578,27 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb } } }); + selectedLeaderboardRaceButtonPanel.add(addRaceColumnsButton); columnMoveUpButton = new Button(stringMessages.columnMoveUp()); - selectedLeaderboardRaceButtonPanel.add(columnMoveUpButton); + columnMoveUpButton.ensureDebugId("MoveRaceUpButton"); columnMoveUpButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { moveSelectedRaceColumnUp(); } }); + selectedLeaderboardRaceButtonPanel.add(columnMoveUpButton); + columnMoveDownButton = new Button(stringMessages.columnMoveDown()); - selectedLeaderboardRaceButtonPanel.add(columnMoveDownButton); + columnMoveDownButton.ensureDebugId("MoveRaceDownButton"); columnMoveDownButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { moveSelectedRaceColumnDown(); } }); + selectedLeaderboardRaceButtonPanel.add(columnMoveDownButton); loadLeaderboards(); } @@ -637,9 +649,9 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb } public void loadLeaderboards() { - sailingService.getLeaderboards(new AsyncCallback>() { + sailingService.getLeaderboards(new MarkedAsyncCallback>() { @Override - public void onSuccess(List leaderboards) { + public void handleSuccess(List leaderboards) { leaderboardList.getList().clear(); availableLeaderboardList.clear(); leaderboardList.getList().addAll(leaderboards); @@ -650,7 +662,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb } @Override - public void onFailure(Throwable t) { + public void handleFailure(Throwable t) { LeaderboardConfigPanel.this.errorReporter.reportError("Error trying to obtain list of leaderboards: " + t.getMessage()); } @@ -663,9 +675,9 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb * after the refresh has successfully completed. See {@link #selectRaceColumn(String)}. */ public void loadAndRefreshLeaderboard(final String leaderboardName, final String nameOfRaceColumnToSelect) { - sailingService.getLeaderboard(leaderboardName, new AsyncCallback() { + sailingService.getLeaderboard(leaderboardName, new MarkedAsyncCallback() { @Override - public void onSuccess(StrippedLeaderboardDTO leaderboard) { + public void handleSuccess(StrippedLeaderboardDTO leaderboard) { for (StrippedLeaderboardDTO leaderboardDTO : leaderboardSelectionModel.getSelectedSet()) { if (leaderboardDTO.name.equals(leaderboardName)) { leaderboardSelectionModel.setSelected(leaderboardDTO, false); @@ -683,7 +695,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb } @Override - public void onFailure(Throwable t) { + public void handleFailure(Throwable t) { LeaderboardConfigPanel.this.errorReporter.reportError("Error trying to update leaderboard with name " + leaderboardName + " : " + t.getMessage()); } @@ -706,15 +718,15 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb private void unlinkRaceColumnFromTrackedRace(final String raceColumnName, final FleetDTO fleet) { final String selectedLeaderboardName = getSelectedLeaderboardName(); sailingService.disconnectLeaderboardColumnFromTrackedRace(selectedLeaderboardName, raceColumnName, fleet.getName(), - new AsyncCallback() { + new MarkedAsyncCallback() { @Override - public void onFailure(Throwable t) { + public void handleFailure(Throwable t) { errorReporter.reportError("Error trying to unlink tracked race from column " + raceColumnName + " from leaderboard " + selectedLeaderboardName + ": " + t.getMessage()); } @Override - public void onSuccess(Void arg0) { + public void handleSuccess(Void arg0) { trackedRacesListComposite.clearSelection(); getSelectedRaceColumnWithFleet().getA().setRaceIdentifier(fleet, null); raceColumnAndFleetList.refresh(); @@ -749,15 +761,15 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb private void refreshRaceLog(final RaceColumnDTO raceColumnDTO, final FleetDTO fleet, final boolean showAlerts) { final String selectedLeaderboardName = getSelectedLeaderboardName(); - sailingService.reloadRaceLog(selectedLeaderboardName, raceColumnDTO, fleet, new AsyncCallback() { + sailingService.reloadRaceLog(selectedLeaderboardName, raceColumnDTO, fleet, new MarkedAsyncCallback() { @Override - public void onFailure(Throwable caught) { + public void handleFailure(Throwable caught) { if (showAlerts) { errorReporter.reportError(caught.getMessage()); } } @Override - public void onSuccess(Void result) { + public void handleSuccess(Void result) { if (showAlerts) { Window.alert(stringMessages.raceLogReloaded()); } @@ -769,15 +781,15 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb final String selectedLeaderboardName = getSelectedLeaderboardName(); final String raceColumnString = raceColumnDTO.getRaceColumnName(); sailingService.removeLeaderboardColumn(getSelectedLeaderboardName(), raceColumnString, - new AsyncCallback() { + new MarkedAsyncCallback() { @Override - public void onFailure(Throwable t) { + public void handleFailure(Throwable t) { errorReporter.reportError("Error trying to remove leaderboard race column " + raceColumnDTO + " in leaderboard " + getSelectedLeaderboardName() + ": " + t.getMessage()); } @Override - public void onSuccess(Void arg0) { + public void handleSuccess(Void arg0) { loadAndRefreshLeaderboard(selectedLeaderboardName, /* raceColumnNameToSelect */ null); } }); @@ -791,16 +803,16 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb final String selectedLeaderboardName = getSelectedLeaderboardName(); final String selectedRaceColumnName = raceColumnTableSelectionModel.getSelectedObject().getA().getRaceColumnName(); sailingService.moveLeaderboardColumnDown(getSelectedLeaderboardName(), selectedRaceColumnName, - new AsyncCallback() { + new MarkedAsyncCallback() { @Override - public void onFailure(Throwable caught) { + public void handleFailure(Throwable caught) { errorReporter.reportError("Error trying to move leaderboard race column " + selectedRaceColumnName + " in leaderboard " + getSelectedLeaderboardName() + " down: " + caught.getMessage()); } @Override - public void onSuccess(Void result) { + public void handleSuccess(Void result) { loadAndRefreshLeaderboard(selectedLeaderboardName, selectedRaceColumnName); } }); @@ -814,16 +826,16 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb final String selectedLeaderboardName = getSelectedLeaderboardName(); final String selectedRaceColumnName = raceColumnTableSelectionModel.getSelectedObject().getA().getRaceColumnName(); sailingService.moveLeaderboardColumnUp(getSelectedLeaderboardName(), selectedRaceColumnName, - new AsyncCallback() { + new MarkedAsyncCallback() { @Override - public void onFailure(Throwable caught) { + public void handleFailure(Throwable caught) { errorReporter.reportError("Error trying to move leaderboard race column " + selectedRaceColumnName + " in leaderboard " + getSelectedLeaderboardName() + " up: " + caught.getMessage()); } @Override - public void onSuccess(Void result) { + public void handleSuccess(Void result) { loadAndRefreshLeaderboard(selectedLeaderboardName, selectedRaceColumnName); } }); @@ -859,16 +871,16 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb final String selectedRaceColumnName = selectedRaceColumnAndFleetNameInLeaderboard.getA().getRaceColumnName(); final String selectedFleetName = selectedRaceColumnAndFleetNameInLeaderboard.getB().getName(); sailingService.getRegattaAndRaceNameOfTrackedRaceConnectedToLeaderboardColumn(selectedLeaderboardName, - selectedRaceColumnName, new AsyncCallback>() { + selectedRaceColumnName, new MarkedAsyncCallback>() { @Override - public void onFailure(Throwable t) { + public void handleFailure(Throwable t) { errorReporter.reportError("Error trying to determine tracked race linked to race column " + selectedRaceColumnName + " in leaderboard " + selectedLeaderboardName + ": " + t.getMessage()); } @Override - public void onSuccess(Map regattaAndRaceNamesPerFleet) { + public void handleSuccess(Map regattaAndRaceNamesPerFleet) { if (regattaAndRaceNamesPerFleet != null && !regattaAndRaceNamesPerFleet.isEmpty()) { RegattaAndRaceIdentifier raceIdentifier = regattaAndRaceNamesPerFleet .get(selectedFleetName); @@ -962,14 +974,14 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb private void setIsMedalRace(String leaderboardName, final RaceColumnDTO raceInLeaderboard, final boolean isMedalRace) { sailingService.updateIsMedalRace(leaderboardName, raceInLeaderboard.getRaceColumnName(), isMedalRace, - new AsyncCallback() { + new MarkedAsyncCallback() { @Override - public void onFailure(Throwable caught) { + public void handleFailure(Throwable caught) { errorReporter.reportError(stringMessages.errorUpdatingIsMedalRace(caught.getMessage())); } @Override - public void onSuccess(Void result) { + public void handleSuccess(Void result) { getSelectedLeaderboard().setIsMedalRace(raceInLeaderboard.getRaceColumnName(), isMedalRace); } }); @@ -1004,15 +1016,15 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb } } - sailingService.addColumnsToLeaderboard(leaderboardName, raceColumnsToAdd, new AsyncCallback() { + sailingService.addColumnsToLeaderboard(leaderboardName, raceColumnsToAdd, new MarkedAsyncCallback() { @Override - public void onFailure(Throwable caught) { + public void handleFailure(Throwable caught) { errorReporter.reportError("Error trying to add race columns to leaderboard " + leaderboardName + ": " + caught.getMessage()); } @Override - public void onSuccess(Void v) { + public void handleSuccess(Void v) { loadAndRefreshLeaderboard(leaderboardName, /* nameOfRaceColumnToSelect */ null); } }); @@ -1120,7 +1132,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb }); } }); - dialog.ensureDebugId("CreateFlexibleLeaderboardDialog"); + dialog.ensureDebugId("FlexibleLeaderboardCreateDialog"); dialog.show(); } @@ -1149,6 +1161,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb }); } }); + dialog.ensureDebugId("RegattaLeaderboardCreateDialog"); dialog.show(); } @@ -1161,15 +1174,15 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb private void updateLeaderboard(final String oldLeaderboardName, final LeaderboardDescriptor leaderboardToUpdate) { sailingService.updateLeaderboard(oldLeaderboardName, leaderboardToUpdate.getName(), leaderboardToUpdate.getDisplayName(), - leaderboardToUpdate.getDiscardThresholds(), leaderboardToUpdate.getCourseAreaIdAsString(), new AsyncCallback() { + leaderboardToUpdate.getDiscardThresholds(), leaderboardToUpdate.getCourseAreaIdAsString(), new MarkedAsyncCallback() { @Override - public void onFailure(Throwable t) { + public void handleFailure(Throwable t) { errorReporter.reportError("Error trying to update leaderboard " + oldLeaderboardName + ": " + t.getMessage()); } @Override - public void onSuccess(StrippedLeaderboardDTO updatedLeaderboard) { + public void handleSuccess(StrippedLeaderboardDTO updatedLeaderboard) { int indexOfLeaderboard = 0; for (int i = 0; i < leaderboardList.getList().size(); i++) { StrippedLeaderboardDTO dao = leaderboardList.getList().get(i); @@ -1190,17 +1203,17 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb for (StrippedLeaderboardDTO leaderboard : leaderboards) { leaderboardNames.add(leaderboard.name); } - sailingService.removeLeaderboards(leaderboardNames, new AsyncCallback() { + sailingService.removeLeaderboards(leaderboardNames, new MarkedAsyncCallback() { @Override - public void onFailure(Throwable caught) { + public void handleFailure(Throwable caught) { errorReporter.reportError("Error trying to remove the leaderboards:" + caught.getMessage()); } @Override - public void onSuccess(Void result) { + public void handleSuccess(Void result) { for (StrippedLeaderboardDTO leaderboard : leaderboards) { removeLeaderboardFromTable(leaderboard); } @@ -1210,15 +1223,15 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb } private void removeLeaderboard(final StrippedLeaderboardDTO leaderBoard) { - sailingService.removeLeaderboard(leaderBoard.name, new AsyncCallback() { + sailingService.removeLeaderboard(leaderBoard.name, new MarkedAsyncCallback() { @Override - public void onFailure(Throwable caught) { + public void handleFailure(Throwable caught) { errorReporter.reportError("Error trying to remove leaderboard " + leaderBoard.name + ": " + caught.getMessage()); } @Override - public void onSuccess(Void result) { + public void handleSuccess(Void result) { removeLeaderboardFromTable(leaderBoard); } }); @@ -1250,9 +1263,9 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb final FleetDTO fleet, final RegattaAndRaceIdentifier selectedRace) { sailingService.connectTrackedRaceToLeaderboardColumn(getSelectedLeaderboardName(), selectedRaceInLeaderboard .getRaceColumnName(), fleet.getName(), selectedRace, - new AsyncCallback() { + new MarkedAsyncCallback() { @Override - public void onFailure(Throwable t) { + public void handleFailure(Throwable t) { errorReporter.reportError("Error trying to link tracked race " + selectedRace + " to race column named " + selectedRaceInLeaderboard.getRaceColumnName() + " of leaderboard " + getSelectedLeaderboardName() + ": " + t.getMessage()); @@ -1260,7 +1273,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb } @Override - public void onSuccess(Boolean success) { + public void handleSuccess(Boolean success) { if (success) { // TODO consider enabling the Unlink button selectedRaceInLeaderboard.setRaceIdentifier(fleet, selectedRace); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardGroupConfigPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardGroupConfigPanel.java index 0636120a861..04355f44bfa 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardGroupConfigPanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardGroupConfigPanel.java @@ -20,7 +20,6 @@ import com.google.gwt.user.cellview.client.Column; import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler; import com.google.gwt.user.cellview.client.TextColumn; import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.CaptionPanel; import com.google.gwt.user.client.ui.HorizontalPanel; @@ -40,6 +39,7 @@ import com.sap.sailing.gwt.ui.client.AbstractRegattaPanel; import com.sap.sailing.gwt.ui.client.DataEntryDialog.DialogCallback; import com.sap.sailing.gwt.ui.client.ErrorReporter; import com.sap.sailing.gwt.ui.client.LeaderboardGroupRefresher; +import com.sap.sailing.gwt.ui.client.MarkedAsyncCallback; import com.sap.sailing.gwt.ui.client.RegattaRefresher; import com.sap.sailing.gwt.ui.client.SailingServiceAsync; import com.sap.sailing.gwt.ui.client.StringMessages; @@ -111,6 +111,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements mainPanel.add(createLeaderboardGroupsGUI(tableRes)); splitPanel = new HorizontalPanel(); + splitPanel.ensureDebugId("LeaderboardGroupDetailsPanel"); splitPanel.setSpacing(5); splitPanel.setWidth("100%"); splitPanel.setVisible(false); @@ -132,6 +133,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements switchLeaderboardsPanel.setWidth("5%"); moveToGroupButton = new Button("<-"); + moveToGroupButton.ensureDebugId("AddLeaderboardButton"); moveToGroupButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -142,6 +144,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements switchLeaderboardsPanel.add(moveToGroupButton); moveToLeaderboardsButton = new Button("->"); + moveToLeaderboardsButton.ensureDebugId("RemoveLeaderboardButton"); moveToLeaderboardsButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -167,10 +170,12 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements leaderboardsPanel.add(leaderboardsFunctionPanel); Label filterLeaderboardsLabel = new Label(stringMessages.filterLeaderboardsByName() + ":"); leaderboardsFunctionPanel.add(filterLeaderboardsLabel); + // Create leaderboards table leaderboardsProvider = new ListDataProvider(); ListHandler leaderboardsListHandler = new ListHandler(leaderboardsProvider.getList()); leaderboardsTable = new CellTable(10000, tableRes); + leaderboardsTable.ensureDebugId("LeaderboardsCellTable"); leaderboardsFilterablePanel = new AbstractFilterablePanel(filterLeaderboardsLabel, availableLeaderboards, leaderboardsTable, leaderboardsProvider) { @Override public Iterable getSearchableStrings(StrippedLeaderboardDTO t) { @@ -180,8 +185,11 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements return strings; } }; + leaderboardsFilterablePanel.getTextBox().ensureDebugId("LeaderboardsFilterTextBox"); leaderboardsFunctionPanel.add(leaderboardsFilterablePanel); + Button refreshLeaderboardsButton = new Button(stringMessages.refresh()); + refreshLeaderboardsButton.ensureDebugId("RefreshLeaderboardsButton"); refreshLeaderboardsButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -189,6 +197,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements } }); leaderboardsFunctionPanel.add(refreshLeaderboardsButton); + TextColumn leaderboardsNameColumn = new TextColumn() { @Override public String getValue(StrippedLeaderboardDTO leaderboard) { @@ -256,6 +265,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements descriptionCaptionPanel.add(descriptionPanel); descriptionTextArea = new TextArea(); + descriptionTextArea.ensureDebugId("DescriptionTextArea"); descriptionTextArea.setCharacterWidth(60); descriptionTextArea.setVisibleLines(8); descriptionTextArea.getElement().getStyle().setProperty("resize", "none"); @@ -267,6 +277,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements descriptionPanel.add(descriptionFunctionsPanel); editDescriptionButton = new Button(stringMessages.edit()); + editDescriptionButton.ensureDebugId("EditDescriptionButton"); editDescriptionButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -276,6 +287,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements descriptionFunctionsPanel.add(editDescriptionButton); abortDescriptionButton = new Button(stringMessages.abort()); + abortDescriptionButton.ensureDebugId("AbortButton"); abortDescriptionButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -291,6 +303,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements descriptionFunctionsPanel.add(abortDescriptionButton); saveDescriptionButton = new Button(stringMessages.save()); + saveDescriptionButton.ensureDebugId("SaveButton"); saveDescriptionButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -326,6 +339,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements }; groupDetailsTable = new CellTable(10000, tableRes); + groupDetailsTable.ensureDebugId("LeaderboardGroupsCellTable"); groupDetailsTable.setWidth("100%"); groupDetailsTable.addColumn(groupDetailsNameColumn, stringMessages.leaderboardName()); groupDetailsTable.addColumn(groupDetailsRacesColumn, stringMessages.races()); @@ -352,6 +366,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements groupDetailsPanel.add(groupDetailsFunctionPanel); leaderboardUpButton = new Button(stringMessages.columnMoveUp()); + leaderboardUpButton.ensureDebugId("MoveLeaderboardGroupUpButton"); leaderboardUpButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -362,6 +377,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements groupDetailsFunctionPanel.add(leaderboardUpButton); leaderboardDownButton = new Button(stringMessages.columnMoveDown()); + leaderboardDownButton.ensureDebugId("MoveLeaderboardGroupDownButton"); leaderboardDownButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -392,6 +408,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements groupsProvider = new ListDataProvider(); ListHandler leaderboardGroupsListHandler = new ListHandler(groupsProvider.getList()); groupsTable = new CellTable(10000, tableRes); + groupsTable.ensureDebugId("LeaderboardGroupsCellTable"); groupsFilterablePanel = new AbstractFilterablePanel(filterLeaderboardGroupsLbl, availableLeaderboardGroups, groupsTable, groupsProvider) { @Override public Iterable getSearchableStrings(LeaderboardGroupDTO t) { @@ -400,8 +417,11 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements return string; } }; + groupsFilterablePanel.getTextBox().ensureDebugId("LeaderboardGroupsFilterTextBox"); leaderboardGroupsFunctionPanel.add(groupsFilterablePanel); + Button createGroupButton = new Button(stringMessages.createNewLeaderboardGroup()); + createGroupButton.ensureDebugId("CreateLeaderboardGroupButton"); createGroupButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -411,6 +431,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements leaderboardGroupsFunctionPanel.add(createGroupButton); removeButton = new Button(stringMessages.remove()); + removeButton.ensureDebugId("RemoveLeaderboardButton"); removeButton.setEnabled(false); removeButton.addClickHandler(new ClickHandler() { @Override @@ -519,9 +540,9 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements } public void fillLeaderboardGroups() { - sailingService.getLeaderboardGroups(false /*withGeoLocationData*/, new AsyncCallback>() { + sailingService.getLeaderboardGroups(false /*withGeoLocationData*/, new MarkedAsyncCallback>() { @Override - public void onSuccess(List groups) { + public void handleSuccess(List groups) { availableLeaderboardGroups.clear(); if (groups != null) { availableLeaderboardGroups.addAll(groups); @@ -530,20 +551,20 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements groupsProvider.getList().addAll(availableLeaderboardGroups); } @Override - public void onFailure(Throwable t) { + public void handleFailure(Throwable t) { errorReporter.reportError("Error trying to obtain list of leaderboard groups: " + t.getMessage()); } }); } private void loadLeaderboards() { - sailingService.getLeaderboards(new AsyncCallback>() { + sailingService.getLeaderboards(new MarkedAsyncCallback>() { @Override - public void onFailure(Throwable t) { + public void handleFailure(Throwable t) { errorReporter.reportError("Error trying to obtain list of leaderboards: " + t.getMessage()); } @Override - public void onSuccess(List leaderboards) { + public void handleSuccess(List leaderboards) { availableLeaderboards.clear(); if (leaderboards != null) { availableLeaderboards.addAll(leaderboards); @@ -564,14 +585,14 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements final LeaderboardGroupDTO selectedGroup = getSelectedGroup(); final Set selectedLeaderboards = leaderboardsSelectionModel.getSelectedSet(); if (isSingleGroupSelected && selectedGroup != null) { - sailingService.getLeaderboards(new AsyncCallback>() { + sailingService.getLeaderboards(new MarkedAsyncCallback>() { @Override - public void onFailure(Throwable t) { + public void handleFailure(Throwable t) { errorReporter.reportError("Error trying to obtain list of leaderboards: " + t.getMessage()); } @Override - public void onSuccess(List leaderboards) { + public void handleSuccess(List leaderboards) { availableLeaderboards.clear(); if (leaderboards != null) { availableLeaderboards.addAll(leaderboards); @@ -600,20 +621,21 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements createNewGroup(newGroup); } }); + dialog.ensureDebugId("LeaderboardGroupCreateDialog"); dialog.show(); } private void createNewGroup(final LeaderboardGroupDescriptor newGroup) { sailingService.createLeaderboardGroup(newGroup.getName(), newGroup.getDescription(), newGroup.isDisplayLeaderboardsInReverseOrder(), newGroup.getOverallLeaderboardDiscardThresholds(), - newGroup.getOverallLeaderboardScoringSchemeType(), new AsyncCallback() { + newGroup.getOverallLeaderboardScoringSchemeType(), new MarkedAsyncCallback() { @Override - public void onFailure(Throwable t) { + public void handleFailure(Throwable t) { errorReporter.reportError("Error trying to create new leaderboard group" + newGroup.getName() + ": " + t.getMessage()); } @Override - public void onSuccess(LeaderboardGroupDTO newGroup) { + public void handleSuccess(LeaderboardGroupDTO newGroup) { availableLeaderboardGroups.add(newGroup); groupsProvider.getList().add(newGroup); groupsSelectionModel.clear(); @@ -629,14 +651,14 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements } sailingService.updateLeaderboardGroup(oldGroupName, updateDescriptor.getName(), updateDescriptor.getDescription(), leaderboardNames, updateDescriptor.getOverallLeaderboardDiscardThresholds(), - updateDescriptor.getOverallLeaderboardScoringSchemeType(), new AsyncCallback() { + updateDescriptor.getOverallLeaderboardScoringSchemeType(), new MarkedAsyncCallback() { @Override - public void onFailure(Throwable t) { + public void handleFailure(Throwable t) { errorReporter.reportError("Error trying to update leaderboard group " + oldGroupName + ": " + t.getMessage()); } @Override - public void onSuccess(Void v) { + public void handleSuccess(Void v) { // Update the availableLeaderboardGroups and the list of displayed groups for (int i = 0; i < availableLeaderboardGroups.size(); i++) { LeaderboardGroupDTO group = availableLeaderboardGroups.get(i); @@ -668,14 +690,14 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements } sailingService.updateLeaderboardGroup(group.getName(), group.getName(), group.description, leaderboardNames, group.getOverallLeaderboardDiscardThresholds(), - group.getOverallLeaderboardScoringSchemeType(), new AsyncCallback() { + group.getOverallLeaderboardScoringSchemeType(), new MarkedAsyncCallback() { @Override - public void onFailure(Throwable t) { + public void handleFailure(Throwable t) { errorReporter.reportError("Error trying to update leaderboard group " + group.getName() + ": " + t.getMessage()); } @Override - public void onSuccess(Void v) { + public void handleSuccess(Void v) { } }); } @@ -686,14 +708,14 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements for (LeaderboardGroupDTO group : groups) { groupNames.add(group.getName()); } - sailingService.removeLeaderboardGroups(groupNames, new AsyncCallback() { + sailingService.removeLeaderboardGroups(groupNames, new MarkedAsyncCallback() { @Override - public void onFailure(Throwable t) { + public void handleFailure(Throwable t) { errorReporter.reportError("Error trying to remove the leaderboard groups: " + t.getMessage()); } @Override - public void onSuccess(Void result) { + public void handleSuccess(Void result) { for (LeaderboardGroupDTO group : groups) { removeGroupFromTable(group); } @@ -705,14 +727,14 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements private void removeLeaderboardGroup(final LeaderboardGroupDTO group) { Set groups = new HashSet(); groups.add(group.getName()); - sailingService.removeLeaderboardGroups(groups, new AsyncCallback() { + sailingService.removeLeaderboardGroups(groups, new MarkedAsyncCallback() { @Override - public void onFailure(Throwable t) { + public void handleFailure(Throwable t) { errorReporter.reportError("Error trying to remove leaderboard group " + group.getName() + ": " + t.getMessage()); } @Override - public void onSuccess(Void v) { + public void handleSuccess(Void v) { removeGroupFromTable(group); } }); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardGroupCreateDialog.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardGroupCreateDialog.java index dcec2893308..39d3e582216 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardGroupCreateDialog.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardGroupCreateDialog.java @@ -12,8 +12,12 @@ public class LeaderboardGroupCreateDialog extends LeaderboardGroupDialog { super(new LeaderboardGroupDTO(), stringMessages, callback, existingGroups); nameEntryField = createTextBox(null, 50); - descriptionEntryField = createTextArea(null); + nameEntryField.ensureDebugId("NameTextBox"); + + descriptionEntryField = createTextArea(null); + descriptionEntryField.ensureDebugId("DescriptionTextArea"); + displayLeaderboardsInReverseOrderCheckBox.setValue(false); - useOverallLeaderboardCheckBox.setValue(false); + useOverallLeaderboardCheckBox.setValue(false); } } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardGroupDialog.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardGroupDialog.java index 57dbaa87315..0d7e6c4dde3 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardGroupDialog.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardGroupDialog.java @@ -123,8 +123,14 @@ public class LeaderboardGroupDialog extends DataEntryDialog(); seriesSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override @@ -95,6 +107,7 @@ public class RegattaDetailsComposite extends Composite { seriesListDataProvider = new ListDataProvider(); seriesListDataProvider.addDataDisplay(seriesTable); vPanel.add(seriesTable); + initWidget(mainPanel); } @@ -239,6 +252,7 @@ public class RegattaDetailsComposite extends Composite { updateRacesOfRegattaSeries(regatta, result); } }); + raceDialog.ensureDebugId("SeriesEditDialog"); raceDialog.show(); } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaLeaderboardCreateDialog.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaLeaderboardCreateDialog.java index 49dbfcf9637..829ee6b6211 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaLeaderboardCreateDialog.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaLeaderboardCreateDialog.java @@ -16,14 +16,17 @@ public class RegattaLeaderboardCreateDialog extends RegattaLeaderboardDialog { super(stringMessages.createRegattaLeaderboard(), new LeaderboardDescriptor(), existingRegattas, stringMessages, errorReporter, new RegattaLeaderboardDialog.LeaderboardParameterValidator(stringMessages, existingLeaderboards), callback); nameTextBox = createTextBox(null); - displayNameTextBox = createTextBox(null); - + nameTextBox.ensureDebugId("NameTextBox"); + nameTextBox.setVisibleLength(50); // the name of the regatta leaderboard will be derived from the selected regatta nameTextBox.setEnabled(false); - nameTextBox.setVisibleLength(50); + + displayNameTextBox = createTextBox(null); + displayNameTextBox.ensureDebugId("DisplayNameTextBox"); displayNameTextBox.setVisibleLength(50); regattaListBox = createSortedRegattaListBox(existingRegattas, null); + regattaListBox.ensureDebugId("RegattaListBox"); regattaListBox.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { int selectedIndex = regattaListBox.getSelectedIndex(); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaListComposite.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaListComposite.java index 5a835a8a2b4..2e938938350 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaListComposite.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaListComposite.java @@ -29,6 +29,7 @@ import com.sap.sailing.domain.common.RegattaName; import com.sap.sailing.domain.common.impl.NaturalComparator; import com.sap.sailing.gwt.ui.client.DataEntryDialog.DialogCallback; import com.sap.sailing.gwt.ui.client.ErrorReporter; +import com.sap.sailing.gwt.ui.client.MarkedAsyncCallback; import com.sap.sailing.gwt.ui.client.RegattaDisplayer; import com.sap.sailing.gwt.ui.client.RegattaRefresher; import com.sap.sailing.gwt.ui.client.RegattaSelectionProvider; @@ -77,14 +78,18 @@ public class RegattaListComposite extends Composite implements RegattaDisplayer mainPanel = new SimplePanel(); panel = new VerticalPanel(); mainPanel.setWidget(panel); - Label filterRegattasLabel = new Label(stringMessages.filterRegattasByName() + ":"); - filterRegattasLabel.setWordWrap(false); + noRegattasLabel = new Label(stringMessages.noRegattasYet()); + noRegattasLabel.ensureDebugId("NoRegattasLabel"); noRegattasLabel.setWordWrap(false); panel.add(noRegattasLabel); + regattaListDataProvider = new ListDataProvider(); regattaTable = createRegattaTable(); + regattaTable.ensureDebugId("RegattasCellTable"); regattaTable.setVisible(false); + Label filterRegattasLabel = new Label(stringMessages.filterRegattasByName() + ":"); + filterRegattasLabel.setWordWrap(false); filterablePanelRegattas = new AbstractFilterablePanel(filterRegattasLabel, allRegattas, regattaTable, regattaListDataProvider) { @Override @@ -95,7 +100,9 @@ public class RegattaListComposite extends Composite implements RegattaDisplayer return string; } }; + filterablePanelRegattas.getTextBox().ensureDebugId("ReggatasFilterTextBox"); panel.add(filterablePanelRegattas); + regattaSelectionModel = new MultiSelectionModel(); regattaSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override @@ -190,14 +197,14 @@ public class RegattaListComposite extends Composite implements RegattaDisplayer private void editRegatta(final RegattaDTO toBeEdited) { final Collection existingRegattas = getAllRegattas(); - sailingService.getEvents(new AsyncCallback>() { + sailingService.getEvents(new MarkedAsyncCallback>() { @Override - public void onFailure(Throwable caught) { + public void handleFailure(Throwable caught) { openEditRegattaDialog(toBeEdited, existingRegattas, Collections. emptyList()); } @Override - public void onSuccess(List events) { + public void handleSuccess(List events) { openEditRegattaDialog(toBeEdited, existingRegattas, Collections.unmodifiableList(events)); } }); @@ -222,15 +229,14 @@ public class RegattaListComposite extends Composite implements RegattaDisplayer final RegattaIdentifier regattaName = new RegattaName(editedRegatta.getName()); sailingService.updateRegatta(regattaName, editedRegatta.defaultCourseAreaUuidAsString, - editedRegatta.configuration, - new AsyncCallback() { + editedRegatta.configuration, new MarkedAsyncCallback() { @Override - public void onFailure(Throwable caught) { + public void handleFailure(Throwable caught) { errorReporter.reportError("Error trying to update regatta " + editedRegatta.getName() + ": " + caught.getMessage()); } @Override - public void onSuccess(Void result) { + public void handleSuccess(Void result) { regattaRefresher.fillRegattas(); } }); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaStructureManagementPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaStructureManagementPanel.java index 96449b5c68a..f9e94c1ece9 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaStructureManagementPanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaStructureManagementPanel.java @@ -65,7 +65,9 @@ public class RegattaStructureManagementPanel extends SimplePanel implements Rega HorizontalPanel regattaManagementControlsPanel = new HorizontalPanel(); regattaManagementControlsPanel.setSpacing(5); + Button addRegattaBtn = new Button(stringMessages.addRegatta()); + addRegattaBtn.ensureDebugId("AddRegattaButton"); addRegattaBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -75,6 +77,7 @@ public class RegattaStructureManagementPanel extends SimplePanel implements Rega regattaManagementControlsPanel.add(addRegattaBtn); removeRegattaButton = new Button(stringMessages.remove()); + removeRegattaButton.ensureDebugId("RemoveRegattaButton"); removeRegattaButton.setEnabled(false); removeRegattaButton.addClickHandler(new ClickHandler() { @Override @@ -100,10 +103,12 @@ public class RegattaStructureManagementPanel extends SimplePanel implements Rega regattaSelectionProvider.addRegattaSelectionChangeListener(this); regattaListComposite = new RegattaListComposite(sailingService, regattaSelectionProvider, regattaRefresher, errorReporter, stringMessages); + regattaListComposite.ensureDebugId("RegattaListComposite"); grid.setWidget(0, 0, regattaListComposite); grid.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP); grid.getColumnFormatter().getElement(1).getStyle().setPaddingTop(2.0, Unit.EM); regattaDetailsComposite = new RegattaDetailsComposite(sailingService, regattaRefresher, errorReporter, stringMessages); + regattaDetailsComposite.ensureDebugId("RegattaDetailsComposite"); regattaDetailsComposite.setVisible(false); grid.setWidget(0, 1, regattaDetailsComposite); } @@ -152,6 +157,7 @@ public class RegattaStructureManagementPanel extends SimplePanel implements Rega createNewRegatta(newRegatta); } }); + dialog.ensureDebugId("RegattaCreateDialog"); dialog.show(); } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaWithSeriesAndFleetsDialog.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaWithSeriesAndFleetsDialog.java index fcb050e7a4e..7cedd936c77 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaWithSeriesAndFleetsDialog.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaWithSeriesAndFleetsDialog.java @@ -45,16 +45,19 @@ public abstract class RegattaWithSeriesAndFleetsDialog extends DataEntryDialog() { @Override public void onValueChange(ValueChangeEvent event) { @@ -44,6 +45,7 @@ public class RegattaWithSeriesAndFleetsEditDialog extends RegattaWithSeriesAndFl } }); regattaConfigurationButton = new Button(stringMessages.edit()); + regattaConfigurationButton.ensureDebugId("RacingProcedureConfigurationEditButton"); regattaConfigurationButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -57,7 +59,7 @@ public class RegattaWithSeriesAndFleetsEditDialog extends RegattaWithSeriesAndFl @Override public void cancel() { } - }).show();; + }).show(); } }); regattaConfigurationCheckbox.setValue(regatta.configuration != null); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesEditDialog.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesEditDialog.java index 0c1713177f3..1e60971ef13 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesEditDialog.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesEditDialog.java @@ -153,16 +153,24 @@ public class SeriesEditDialog extends DataEntryDialog { String seriesName = getSelectedSeries().getName(); seriesPanel.add(new Label(stringMessages.series() + ": " + seriesName)); additionalWidgetPanel.add(seriesPanel); + isMedalCheckbox = createCheckbox(stringMessages.medalSeries()); + isMedalCheckbox.ensureDebugId("MedalSeriesCheckbox"); isMedalCheckbox.setValue(selectedSeries.isMedal()); additionalWidgetPanel.add(isMedalCheckbox); + startWithZeroScoreCheckbox = createCheckbox(stringMessages.startsWithZeroScore()); + startWithZeroScoreCheckbox.ensureDebugId("StartsWithZeroScoreCheckbox"); startWithZeroScoreCheckbox.setValue(selectedSeries.isStartsWithZeroScore()); additionalWidgetPanel.add(startWithZeroScoreCheckbox); + firstColumnIsNonDiscardableCarryForwardCheckbox = createCheckbox(stringMessages.firstRaceIsNonDiscardableCarryForward()); + firstColumnIsNonDiscardableCarryForwardCheckbox.ensureDebugId("StartsWithNonDiscardableCarryForwardCheckbox"); firstColumnIsNonDiscardableCarryForwardCheckbox.setValue(selectedSeries.isFirstColumnIsNonDiscardableCarryForward()); additionalWidgetPanel.add(firstColumnIsNonDiscardableCarryForwardCheckbox); + useSeriesResultDiscardingThresholdsCheckbox = createCheckbox(stringMessages.seriesDefinesResultDiscardingRule()); + useSeriesResultDiscardingThresholdsCheckbox.ensureDebugId("DefinesResultDiscardingRulesCheckbox"); useSeriesResultDiscardingThresholdsCheckbox.setValue(selectedSeries.getDiscardThresholds() != null); useSeriesResultDiscardingThresholdsCheckbox.addValueChangeHandler(new ValueChangeHandler() { @Override @@ -171,10 +179,16 @@ public class SeriesEditDialog extends DataEntryDialog { } }); additionalWidgetPanel.add(useSeriesResultDiscardingThresholdsCheckbox); - additionalWidgetPanel.add(discardThresholdBoxes.getWidget()); - discardThresholdBoxes.getWidget().setVisible(useSeriesResultDiscardingThresholdsCheckbox.getValue()); + + Widget discardThresholdBoxesWidget = discardThresholdBoxes.getWidget(); + discardThresholdBoxesWidget.ensureDebugId(""); + discardThresholdBoxesWidget.setVisible(useSeriesResultDiscardingThresholdsCheckbox.getValue()); + additionalWidgetPanel.add(discardThresholdBoxesWidget); + raceNamesEditor = new StringListEditorComposite(getExistingRacesOfSeries(), new RaceNamesEditorUi(stringMessages, resources.removeIcon(), seriesName)); + raceNamesEditor.ensureDebugId("RaceNamesStringListEditorComposite"); additionalWidgetPanel.add(raceNamesEditor); + return additionalWidgetPanel; } @@ -205,10 +219,17 @@ public class SeriesEditDialog extends DataEntryDialog { public RaceNamesEditorUi(StringMessages stringMessages, ImageResource removeImage, String seriesName) { super(stringMessages, removeImage, Collections.emptyList()); - this.addRacesListBox = createListBox(false); - this.raceNamePrefixTextBox = createTextBox(null); - this.addRacesBtn = new Button(stringMessages.add()); + this.seriesName = seriesName; + + this.addRacesListBox = createListBox(false); + this.addRacesListBox.ensureDebugId("NumberOfRacesListBox"); + + this.raceNamePrefixTextBox = createTextBox(null); + this.raceNamePrefixTextBox.ensureDebugId("RaceNamePrefixTextBox"); + + this.addRacesBtn = new Button(stringMessages.add()); + this.addRacesBtn.ensureDebugId("AddRacesButton"); } @Override diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesWithFleetsCreateDialog.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesWithFleetsCreateDialog.java index a3c37717d77..19f0cb64026 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesWithFleetsCreateDialog.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesWithFleetsCreateDialog.java @@ -100,21 +100,36 @@ public class SeriesWithFleetsCreateDialog extends DataEntryDialog { new SeriesParameterValidator(stringMessages, existingSeries), callback); this.stringMessages = stringMessages; this.series = new SeriesDTO(); + nameEntryField = createTextBox(null); + nameEntryField.ensureDebugId("NameTextBox"); nameEntryField.setVisibleLength(40); + isMedalSeriesCheckbox = createCheckbox(stringMessages.medalSeries()); + isMedalSeriesCheckbox.ensureDebugId("MedalSeriesCheckbox"); + startsWithZeroScoreCheckbox = createCheckbox(stringMessages.startsWithZeroScore()); + startsWithZeroScoreCheckbox.ensureDebugId("StartsWithZeroScoreCheckbox"); + firstColumnIsNonDiscardableCarryForwardCheckbox = createCheckbox(stringMessages.firstRaceIsNonDiscardableCarryForward()); + firstColumnIsNonDiscardableCarryForwardCheckbox.ensureDebugId("StartsWithNonDiscardableCarryForwardCheckbox"); + useSeriesResultDiscardingThresholdsCheckbox = createCheckbox(stringMessages.seriesDefinesResultDiscardingRule()); + useSeriesResultDiscardingThresholdsCheckbox.ensureDebugId("DefinesResultDiscardingRulesCheckbox"); useSeriesResultDiscardingThresholdsCheckbox.addValueChangeHandler(new ValueChangeHandler() { @Override public void onValueChange(ValueChangeEvent event) { discardThresholdBoxes.getWidget().setVisible(event.getValue()); } }); + discardThresholdBoxes = new DiscardThresholdBoxes(this, stringMessages); - discardThresholdBoxes.getWidget().setVisible(false); + Widget widget = discardThresholdBoxes.getWidget(); + widget.ensureDebugId("DiscardThresholdBoxes"); + widget.setVisible(false); + fleetListComposite = FleetListEditorComposite.createExpanded(Arrays.asList(new FleetDTO("Default", 0, null)), stringMessages, resources.removeIcon()); + fleetListComposite.ensureDebugId("FleetListEditorComposite"); fleetListComposite.addValueChangeHandler(new ValueChangeHandler>() { @Override diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesWithFleetsListEditor.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesWithFleetsListEditor.java index df0ecafdf16..4ce8adff396 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesWithFleetsListEditor.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesWithFleetsListEditor.java @@ -35,6 +35,7 @@ public class SeriesWithFleetsListEditor extends ListEditorComposite { @Override protected Widget createAddWidget() { Button addSeriesButton = new Button(stringMessages.addSeries()); + addSeriesButton.ensureDebugId("AddSeriesButton"); addSeriesButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -49,6 +50,7 @@ public class SeriesWithFleetsListEditor extends ListEditorComposite { addValue(newSeries); } }); + dialog.ensureDebugId("SeriesCreateDialog"); dialog.show(); } }); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/TracTracEventManagementPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/TracTracEventManagementPanel.java index dc0ba1c8069..396ae9ffe7f 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/TracTracEventManagementPanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/TracTracEventManagementPanel.java @@ -149,7 +149,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel { liveURILabel.setTitle(stringMessages.leaveEmptyForDefault()); liveURITextBox = new TextBox(); - liveURITextBox.ensureDebugId("LiveURI"); + liveURITextBox.ensureDebugId("LiveURITextBox"); liveURITextBox.setVisibleLength(40); liveURITextBox.setTitle(stringMessages.leaveEmptyForDefault()); @@ -160,7 +160,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel { storedURILabel.setTitle(stringMessages.leaveEmptyForDefault()); storedURITextBox = new TextBox(); - storedURITextBox.ensureDebugId("StoredURI"); + storedURITextBox.ensureDebugId("StoredURITextBox"); storedURITextBox.setVisibleLength(40); storedURITextBox.setTitle(stringMessages.leaveEmptyForDefault()); @@ -171,7 +171,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel { Label jsonURLLabel = new Label(stringMessages.jsonUrl() + ":"); jsonURLTextBox = new TextBox(); - jsonURLTextBox.ensureDebugId("JSONURL"); + jsonURLTextBox.ensureDebugId("JsonURLTextBox"); jsonURLTextBox.setVisibleLength(100); grid.setWidget(4, 0, jsonURLLabel); @@ -181,7 +181,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel { Label tracTracUpdateURLLabel = new Label(stringMessages.tracTracUpdateUrl() + ":"); tracTracUpdateURITextBox = new TextBox(); - tracTracUpdateURITextBox.ensureDebugId("TRACTRACUPDATEURI"); + tracTracUpdateURITextBox.ensureDebugId("TracTracUpdateURITextBox"); tracTracUpdateURITextBox.setVisibleLength(100); grid.setWidget(5, 0, tracTracUpdateURLLabel); @@ -189,7 +189,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel { // TracTrac Username tractracUsernameTextBox = new TextBox(); - tractracUsernameTextBox.ensureDebugId("tractracUsername"); + tractracUsernameTextBox.ensureDebugId("TracTracUsernameTextBox"); tractracUsernameTextBox.setVisibleLength(40); grid.setWidget(6, 0, new Label(stringMessages.tractracUsername() + ":")); @@ -197,7 +197,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel { // TracTrac Password tractracPasswordTextBox = new TextBox(); - tractracPasswordTextBox.ensureDebugId("tractracPassword"); + tractracPasswordTextBox.ensureDebugId("TracTracPasswordTextBox"); tractracPasswordTextBox.setVisibleLength(40); grid.setWidget(7, 0, new Label(stringMessages.tractracPassword() + ":")); @@ -205,11 +205,12 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel { grid.setWidget(8, 0, new Label(stringMessages.racesWithHiddenState() + ":")); final CheckBox showHiddenRacesCheckbox = new CheckBox(stringMessages.show()); + showHiddenRacesCheckbox.ensureDebugId("ShowHiddenRacesCheckBox"); grid.setWidget(8, 1, showHiddenRacesCheckbox); // List Races Button listRacesButton = new Button(stringMessages.listRaces()); - listRacesButton.ensureDebugId("ListRaces"); + listRacesButton.ensureDebugId("ListRacesButton"); listRacesButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -265,17 +266,17 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel { Label trackSettingsLabel = new Label(stringMessages.trackSettings() + ":"); final CheckBox trackWindCheckBox = new CheckBox(stringMessages.trackWind()); - trackWindCheckBox.ensureDebugId("TrackWind"); + trackWindCheckBox.ensureDebugId("TrackWindCheckBox"); trackWindCheckBox.setWordWrap(false); trackWindCheckBox.setValue(Boolean.TRUE); final CheckBox correctWindCheckBox = new CheckBox(stringMessages.declinationCheckbox()); - correctWindCheckBox.ensureDebugId("CorrectWind"); + correctWindCheckBox.ensureDebugId("CorrectWindCheckBox"); correctWindCheckBox.setWordWrap(false); correctWindCheckBox.setValue(Boolean.TRUE); final CheckBox simulateWithStartTimeNowCheckBox = new CheckBox(stringMessages.simulateWithStartTimeNow()); - simulateWithStartTimeNowCheckBox.ensureDebugId("SimulateWithStartTimeNow"); + simulateWithStartTimeNowCheckBox.ensureDebugId("SimulateWithStartTimeNowCheckBox"); simulateWithStartTimeNowCheckBox.setWordWrap(false); simulateWithStartTimeNowCheckBox.setValue(Boolean.FALSE); @@ -288,6 +289,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel { Label racesFilterLabel = new Label(stringMessages.filterRacesByName() + ":"); AdminConsoleTableResources tableResources = GWT.create(AdminConsoleTableResources.class); racesTable = new CellTable(10000, tableResources); + racesTable.ensureDebugId("TrackableRacesCellTable"); this.racesFilterablePanel = new AbstractFilterablePanel(racesFilterLabel, availableTracTracRaces, racesTable, raceList) { @Override public List getSearchableStrings(TracTracRaceRecordDTO t) { @@ -297,7 +299,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel { return strings; } }; - racesFilterablePanel.getTextBox().ensureDebugId("FilterRaces"); + racesFilterablePanel.getTextBox().ensureDebugId("TrackableRacesFilterTextBox"); layoutTable.setWidget(4, 0, racesFilterLabel); layoutTable.setWidget(4, 1, racesFilterablePanel); @@ -339,7 +341,6 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel { }; raceStatusColumn.setSortable(true); - racesTable.ensureDebugId("RacesTable"); racesTable.addColumn(regattaNameColumn, stringMessages.event()); racesTable.addColumn(raceNameColumn, stringMessages.race()); racesTable.addColumn(boatClassColumn, stringMessages.boatClass()); @@ -356,7 +357,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel { cellFormatter.setColSpan(5, 0, 2); Button startTrackingButton = new Button(stringMessages.startTracking()); - startTrackingButton.ensureDebugId("StartTracking"); + startTrackingButton.ensureDebugId("StartTrackingButton"); startTrackingButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/TrackedRacesListComposite.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/TrackedRacesListComposite.java index f12dc04a5e1..6136173fa6d 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/TrackedRacesListComposite.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/TrackedRacesListComposite.java @@ -102,7 +102,7 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite @Override protected void addControlButtons(HorizontalPanel trackedRacesButtonPanel) { btnRemoveRace = new Button(stringMessages.remove()); - btnRemoveRace.ensureDebugId("RemoveRave"); + btnRemoveRace.ensureDebugId("RemoveRaceButton"); btnRemoveRace.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -111,8 +111,9 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite }); btnRemoveRace.setEnabled(false); trackedRacesButtonPanel.add(btnRemoveRace); + btnUntrack = new Button(stringMessages.stopTracking()); - btnUntrack.ensureDebugId("UntrackRace"); + btnUntrack.ensureDebugId("StopTrackingButton"); btnUntrack.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent click) { @@ -121,10 +122,9 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite }); btnUntrack.setEnabled(false); trackedRacesButtonPanel.add(btnUntrack); - btnSetDelayToLive = new Button(stringMessages.setDelayToLive() + "..."); - btnSetDelayToLive.ensureDebugId("SetDelayToLive"); + btnSetDelayToLive.ensureDebugId("SetDelayToLiveButton"); btnSetDelayToLive.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -135,6 +135,7 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite exportPopup = new ExportPopup(stringMessages); btnExport = new Button(stringMessages.export()); + btnExport.ensureDebugId("ExportButton"); btnExport.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/panels/AbstractFilterablePanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/panels/AbstractFilterablePanel.java index fbad0effd27..12b0a53cc7a 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/panels/AbstractFilterablePanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/panels/AbstractFilterablePanel.java @@ -42,6 +42,7 @@ public abstract class AbstractFilterablePanel extends HorizontalPanel { this.display = display; this.filtered = filtered; this.textBox = new TextBox(); + this.textBox.ensureDebugId("FilterTextBox"); this.all = all; add(label); add(getTextBox()); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/shared/ListEditorComposite.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/shared/ListEditorComposite.java index 3754a929e24..ea707fb4964 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/shared/ListEditorComposite.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/shared/ListEditorComposite.java @@ -75,10 +75,14 @@ public class ListEditorComposite extends Composite implements HasValu @Override public Widget initWidget() { HorizontalPanel panel = new HorizontalPanel(); + panel.ensureDebugId("CollapsedListEditorWidget"); + collapsedValuesBox = new TextBox(); + collapsedValuesBox.ensureDebugId("CollapsedValuesTextBox"); collapsedValuesBox.setReadOnly(true); collapsedEditButton = new Button(stringMessages.edit()); + collapsedEditButton.ensureDebugId("CollapsedEditButton"); collapsedEditButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -131,6 +135,7 @@ public class ListEditorComposite extends Composite implements HasValu DataEntryDialog.DialogCallback> callback) { super(dialogTitle, "", stringMessages.save(), stringMessages.cancel(), null, callback); expandedComposite = createExpandedUi(initialValues, ui); + expandedComposite.ensureDebugId("ExpandedListEditorComposite"); } @Override @@ -158,11 +163,16 @@ public class ListEditorComposite extends Composite implements HasValu @Override public Widget initWidget() { - expandedValuesGrid = new Grid(0, 2); - VerticalPanel panel = new VerticalPanel(); - panel.add(createAddWidget()); + + Widget addWidget = createAddWidget(); + addWidget.ensureDebugId("AddWidget"); + panel.add(addWidget); + + expandedValuesGrid = new Grid(0, 2); + expandedValuesGrid.ensureDebugId("ExpandedValuesGrid"); panel.add(expandedValuesGrid); + return panel; } @@ -183,6 +193,7 @@ public class ListEditorComposite extends Composite implements HasValu int rowIndex = expandedValuesGrid.insertRow(expandedValuesGrid.getRowCount()); PushButton removeButton = new PushButton(new Image(removeImage)); + removeButton.ensureDebugId("RemoveButton"); removeButton.setTitle(stringMessages.remove()); removeButton.addClickHandler(new ClickHandler() { @@ -194,8 +205,11 @@ public class ListEditorComposite extends Composite implements HasValu context.onChange(); } }); - - expandedValuesGrid.setWidget(rowIndex, 0, createValueWidget(newValue)); + + Widget widget = createValueWidget(newValue); + widget.ensureDebugId("ValueWidget"); + + expandedValuesGrid.setWidget(rowIndex, 0, widget); expandedValuesGrid.setWidget(rowIndex, 1, removeButton); } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/shared/StringListEditorComposite.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/shared/StringListEditorComposite.java index fe408cb4cb2..ca5ed507020 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/shared/StringListEditorComposite.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/shared/StringListEditorComposite.java @@ -74,7 +74,10 @@ public class StringListEditorComposite extends ListEditorComposite { @Override protected Widget createAddWidget() { final SuggestBox inputBox = new SuggestBox(inputOracle); + inputBox.ensureDebugId("InputSuggestBox"); + final Button addButton = new Button(stringMessages.add()); + addButton.ensureDebugId("AddButton"); addButton.setEnabled(false); addButton.addClickHandler(new ClickHandler() { diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/core/BySeleniumId.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/core/BySeleniumId.java index 74774889606..6743ca851a4 100644 --- a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/core/BySeleniumId.java +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/core/BySeleniumId.java @@ -49,4 +49,10 @@ public class BySeleniumId extends By { public List findElements(SearchContext context) { return context.findElements(By.xpath(BY_SELENIUM_ID.format(new Object[] {this.id}))); } + + @Override + public String toString() { + return "BySeleniumId: " + this.id; + } + } diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/Actions.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/Actions.java new file mode 100644 index 00000000000..e3708db859c --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/Actions.java @@ -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 wait = PageObject.createFluentWait(driver, NoAlertPresentException.class); + + Alert alert = wait.until(new Function() { + @Override + public Alert apply(WebDriver driver) { + TargetLocator locator = driver.switchTo(); + + return locator.alert(); + } + }); + + return alert; + } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/AdminConsolePage.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/AdminConsolePage.java index f7111e3f505..77092bb493f 100755 --- a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/AdminConsolePage.java +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/AdminConsolePage.java @@ -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(); diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/FlexibleLeaderboardCreateDialog.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/FlexibleLeaderboardCreateDialog.java index a4414889e42..cf265ac96bd 100755 --- a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/FlexibleLeaderboardCreateDialog.java +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/FlexibleLeaderboardCreateDialog.java @@ -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); } } diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/LeaderboardConfigurationPanel.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/LeaderboardConfigurationPanel.java index fd1f09cba80..715a8dc6fcb 100755 --- a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/LeaderboardConfigurationPanel.java +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/LeaderboardConfigurationPanel.java @@ -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 getAvailableLeaderboards() { - List leaderboards = new ArrayList<>(); - - CellTable table = getLeaderboardTable(); - List 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 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 getAvailableLeaderboards() { + List leaderboards = new ArrayList<>(); + + CellTable table = getLeaderboardTable(); + List entries = table.getEntries(); + + for(DataEntry entry : entries) { + leaderboards.add(entry.getColumnContent(0)); + } + + return leaderboards; + } + + public LeaderboardDetailsPanel getLeaderboardDetails(String leaderboard) { + CellTable table = getLeaderboardTable(); + List 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 getLeaderboardTable() { + return new GenericCellTable<>(this.driver, this.leaderboardsCellTable, DataEntry.class); + } + + private DataEntry findLeaderboard(String leaderboard) { + CellTable table = getLeaderboardTable(); + + for(DataEntry entry : table.getEntries()) { + String name = entry.getColumnContent(0); + + if(leaderboard.equals(name)) { + return entry; + } + } + + return null; } } diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/LeaderboardDetailsPanel.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/LeaderboardDetailsPanel.java new file mode 100644 index 00000000000..aa17a7d4e85 --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/LeaderboardDetailsPanel.java @@ -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 getRaces() { + List result = new ArrayList<>(); + + CellTable 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 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 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 getRacesTable() { + return new GenericCellTable<>(this.driver, this.racesCellTable, DataEntry.class); + } + + private CellTable getTrackedRacesTable() { + WebElement table = findElementBySeleniumId(this.trackedRacesListComposite, "TrackedRacesCellTable"); + + return new GenericCellTable<>(this.driver, table, DataEntry.class); + } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/LeaderboardGroupConfigurationPanel.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/LeaderboardGroupConfigurationPanel.java new file mode 100644 index 00000000000..e2b610c9962 --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/LeaderboardGroupConfigurationPanel.java @@ -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 getLeaderboardGroupsTable() { + return new GenericCellTable(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 table = getLeaderboardGroupsTable(); + final DataEntry alias = Alias.alias(DataEntry.class); + TableQuery query = new TableQuery<>(); + query.from(table) + .where( + $(alias.getColumnContent("Name")).eq(name) + ); + + return query.firstResult(); + } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/LeaderboardGroupCreateDialog.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/LeaderboardGroupCreateDialog.java new file mode 100644 index 00000000000..ccfb5bb2cfb --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/LeaderboardGroupCreateDialog.java @@ -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); + } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/LeaderboardGroupDetailsPanel.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/LeaderboardGroupDetailsPanel.java new file mode 100644 index 00000000000..8f7fc171fd3 --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/LeaderboardGroupDetailsPanel.java @@ -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 getLeaderboardsTable() { + return new GenericCellTable(this.driver, this.leaderboardsCellTable, DataEntry.class); + } + + public DataEntry findLeaderboardEntry(String name) { + CellTable table = getLeaderboardsTable(); + DataEntry alias = Alias.alias(DataEntry.class); + + TableQuery 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); + } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/RegattaLeaderboardCreateDialog.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/RegattaLeaderboardCreateDialog.java new file mode 100644 index 00000000000..352a5510c44 --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/leaderboard/RegattaLeaderboardCreateDialog.java @@ -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()); + } + +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/RegattaCreateDialog.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/RegattaCreateDialog.java new file mode 100644 index 00000000000..e8e826f9e1c --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/RegattaCreateDialog.java @@ -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); + } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/RegattaDetailsComposite.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/RegattaDetailsComposite.java new file mode 100644 index 00000000000..24167fdf9d5 --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/RegattaDetailsComposite.java @@ -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 table = getSeriesTable(); + + for(DataEntry entry : table.getEntries()) { + String name = entry.getColumnContent(0); + + if(series.equals(name)) + return entry; + } + + return null; + } + + private CellTable getSeriesTable() { + return new GenericCellTable<>(this.driver, this.seriesTable, DataEntry.class); + } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/RegattaEditDialog.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/RegattaEditDialog.java new file mode 100644 index 00000000000..dc1a9c4a286 --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/RegattaEditDialog.java @@ -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); + } + +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/RegattaListComposite.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/RegattaListComposite.java new file mode 100644 index 00000000000..c7ca70d8648 --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/RegattaListComposite.java @@ -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 getRegattas() { + List descriptors = new LinkedList<>(); + CellTable 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 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 table = getRegattasTable(); + table.sortByColumn(column, order); + } + + private CellTable getRegattasTable() { + return new GenericCellTable<>(this.driver, this.regattasTable, DataEntry.class); + } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/RegattaStructureManagementPanel.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/RegattaStructureManagementPanel.java new file mode 100644 index 00000000000..d3f793170c0 --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/RegattaStructureManagementPanel.java @@ -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); + } + + /** + *

Creates a regatta with 1 series (named "Default").

+ * + * @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 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; + } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/SeriesCreateDialog.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/SeriesCreateDialog.java new file mode 100644 index 00000000000..3be47e3d7bb --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/SeriesCreateDialog.java @@ -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 +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/SeriesEditDialog.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/SeriesEditDialog.java new file mode 100644 index 00000000000..6a3b0065d1c --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/SeriesEditDialog.java @@ -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(); + } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/tracking/TrackedRacesList.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/tracking/TrackedRacesList.java new file mode 100644 index 00000000000..d493c02e8f8 --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/tracking/TrackedRacesList.java @@ -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 getTrackedRaces() { + List descriptors = new LinkedList<>(); + CellTable 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 = getStatus(Arrays.asList(race)); + + return status.get(0); + } + + public List getStatus(List races) { + List result = new ArrayList<>(Collections.nCopies(races.size(), null)); + + CellTable 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 races) { + + } + + public void remove(List races) { + + } + + public void refresh() { + this.refreshButton.click(); + + waitForAjaxRequests(); + } + + private CellTable getTrackedRacesTable() { + return new GenericCellTable<>(this.driver, this.trackedRacesTable, DataEntry.class); + } + +// private List getTrackedRaces(List races) { +// List result = new ArrayList<>(Collections.nCopies(races.size(), null)); +// +// CellTable table = new CellTable(this.driver, this.trackedRacesTable); +// List rows = table.getRows(); +// Iterator iterator = rows.iterator(); +// +// while(iterator.hasNext()) { +// WebElement row = iterator.next(); +// +// List 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; +// } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/tracking/TrackedRacesManagementPanel.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/tracking/TrackedRacesManagementPanel.java new file mode 100644 index 00000000000..937ada17eff --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/tracking/TrackedRacesManagementPanel.java @@ -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); + } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/tractrac/TracTracEventManagementPanel.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/tractrac/TracTracEventManagementPanel.java index 475792ca65f..8025daee6e8 100644 --- a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/tractrac/TracTracEventManagementPanel.java +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/tractrac/TracTracEventManagementPanel.java @@ -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; + /** *

The page object representing the TracTrac Events tab.

* @@ -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; /** *

@@ -53,6 +120,7 @@ public class TracTracEventManagementPanel extends PageArea { super(driver, element); } + /** *

Lists all available trackable races for the given URL. The list of the races can be obtained via * {@link #getTrackableRaces()}.

@@ -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$ + } + + /** + *

Lists all available trackable races for the given URL. The list of the races can be obtained via + * {@link #getTrackableRaces()}.

+ * + * @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 getTrackableRaces() { - WebElement availableRacesTabel = findElementBySeleniumId(this.context, "RacesTable"); //$NON-NLS-1$ - List elements = availableRacesTabel.findElements(By.xpath("./tbody/tr")); //$NON-NLS-1$ - Iterator iterator = elements.iterator(); + public List getTrackableRaces() { + List descriptors = new LinkedList<>(); + CellTable 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 getAvailableReggatasForTracking() { -// -// } -// -// public String getReggataForTracking() { -// -// } -// -// public void setReggataForTracking(String regatta) { -// -// } + public List getAvailableReggatasForTracking() { + List 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()); + } /** *

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 races) { + CellTable table = getTrackableRacesTable(); + List entries = table.getEntries(); + Iterator 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 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(); + } } diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/common/DataEntryDialog.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/common/DataEntryDialog.java new file mode 100644 index 00000000000..ee25ccbd2dc --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/common/DataEntryDialog.java @@ -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(); + } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/gwt/CellTable.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/gwt/CellTable.java index 13dafef2cad..e826a5179b0 100644 --- a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/gwt/CellTable.java +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/gwt/CellTable.java @@ -50,9 +50,9 @@ public abstract class CellTable 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"; diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/gwt/CheckBox.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/gwt/CheckBox.java new file mode 100644 index 00000000000..d36e794f612 --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/gwt/CheckBox.java @@ -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(); + } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/leaderboard/LeaderboardPage.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/leaderboard/LeaderboardPage.java new file mode 100644 index 00000000000..41afdea9cc1 --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/leaderboard/LeaderboardPage.java @@ -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; + +/** + *

The page object representing the leaderboard.

+ * + * @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$ + + /** + *

Goes to the specified leaderboard and returns the representing page object.

+ * + * @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(); + } + + /** + *

Verifies that the current page is the leaderboard by checking the title of the page.

+ */ + @Override + protected void verify() { + if(!PAGE_TITLE.equals(this.driver.getTitle())) { + throw new IllegalStateException("This is not the leaderboard"); //$NON-NLS-1$ + } + } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/leaderboard/LeaderboardTable.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/leaderboard/LeaderboardTable.java new file mode 100644 index 00000000000..6160fefe520 --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/leaderboard/LeaderboardTable.java @@ -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 { + 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); + } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/adminconsole/TestLeaderboardCreation.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/adminconsole/TestLeaderboardCreation.java index 400744c6a0f..02c43cc8de7 100755 --- a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/adminconsole/TestLeaderboardCreation.java +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/adminconsole/TestLeaderboardCreation.java @@ -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); } } diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/adminconsole/TestLeaderboardFilterInLeaderboardGroupConfig.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/adminconsole/TestLeaderboardFilterInLeaderboardGroupConfig.java new file mode 100644 index 00000000000..8c887844d12 --- /dev/null +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/adminconsole/TestLeaderboardFilterInLeaderboardGroupConfig.java @@ -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 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")); + } +} diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/adminconsole/TestRaceFilterForTracTracEvents.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/adminconsole/TestRaceFilterForTracTracEvents.java index 26ac8fb2e98..f4356bf77e5 100644 --- a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/adminconsole/TestRaceFilterForTracTracEvents.java +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/adminconsole/TestRaceFilterForTracTracEvents.java @@ -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 { /** *

Test with filter which does not match anything.

*/ - // 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)); + } } diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/adminconsole/TestStartAndStopTrackingForTracTracEvents.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/adminconsole/TestStartAndStopTrackingForTracTracEvents.java index a2a9601253f..43729ce70c9 100644 --- a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/adminconsole/TestStartAndStopTrackingForTracTracEvents.java +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/adminconsole/TestStartAndStopTrackingForTracTracEvents.java @@ -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); diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/gwt/widgets/CellTable.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/gwt/widgets/CellTable.java deleted file mode 100644 index d01591feece..00000000000 --- a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/test/gwt/widgets/CellTable.java +++ /dev/null @@ -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; - -/** - *

- * - * @author - * D049941 - */ -public class CellTable extends PageObject { - /** - *

- * - * @param driver - * - * @param element - * - */ - public CellTable(WebDriver driver, WebElement element) { - super(driver, element); - } - - public List getHeaders() { - List 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 getRows() { - List bodies = this.context.findElements(By.tagName("tbody")); - - for(WebElement body : bodies) { - if(!body.isDisplayed()) - continue; - - List rows = body.findElements(By.tagName("tr")); - - Iterator 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 findHeaders() { - return this.context.findElements(By.tagName("th")); - } - - private boolean isRowForLoadingAnimation(WebElement row) { - List 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; - } -}