coding conventions; improved testCompetitorCreation by also checking sail ID and boat class for equality

This commit is contained in:
Axel Uhl committed 2015-11-20 10:07:11 +01:00
1 parent a646f707b8
commit 36801cc550
4 files changed
+25 -23

No files matched your search

@@ -38,8 +38,4 @@ public class TrackedRacesCompetitorCreateDialogPO extends DataEntryDialogPO {
this.boatClassNameSuggestBox.clear();
this.boatClassNameSuggestBox.sendKeys(boatClassName);
}
public void pushOkButton() {
this.okButton.click();
}
}
@@ -12,7 +12,7 @@ public class TrackedRacesCompetitorsPanelPO extends PageArea {
private WebElement addButton;
@FindBy(how = BySeleniumId.class, using = "CompetitorsTable")
private WebElement competitorsTabel;
private WebElement competitorsTable;
public TrackedRacesCompetitorsPanelPO(WebDriver driver, WebElement element) {
super(driver, element);
@@ -26,6 +26,6 @@ public class TrackedRacesCompetitorsPanelPO extends PageArea {
}
public TrackedRacesCompetitorTablePO getCompetitorTable() {
return new TrackedRacesCompetitorTablePO(this.driver, this.competitorsTabel);
return new TrackedRacesCompetitorTablePO(this.driver, this.competitorsTable);
}
}
@@ -2,6 +2,7 @@ package com.sap.sailing.selenium.test.adminconsole;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
@@ -22,32 +23,38 @@ public class TestCompetitorCreation extends AbstractSeleniumTest {
@Test
public void testOpenCreateCompetitorDialog() {
TrackedRacesCompetitorCreateDialogPO dialog;
AdminConsolePage adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
TrackedRacesCompetitorsPanelPO competitorsPanel = adminConsole.goToTrackedRacesCompetitors();
dialog = competitorsPanel.pushAddButton();
final TrackedRacesCompetitorsPanelPO competitorsPanel = goToCompetitorsPanel();
final TrackedRacesCompetitorCreateDialogPO dialog = competitorsPanel.pushAddButton(); // fails with an exception if the dialog is not found
assertNotNull(dialog);
}
private TrackedRacesCompetitorsPanelPO goToCompetitorsPanel() {
final AdminConsolePage adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
final TrackedRacesCompetitorsPanelPO competitorsPanel = adminConsole.goToTrackedRacesCompetitors();
return competitorsPanel;
}
@Test
public void testCompetitorCreation() {
TrackedRacesCompetitorCreateDialogPO dialog;
AdminConsolePage adminConsole = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
TrackedRacesCompetitorsPanelPO competitorsPanel = adminConsole.goToTrackedRacesCompetitors();
dialog = competitorsPanel.pushAddButton();
String name = ""+System.currentTimeMillis();
final TrackedRacesCompetitorsPanelPO competitorsPanel = goToCompetitorsPanel();
final TrackedRacesCompetitorCreateDialogPO dialog = competitorsPanel.pushAddButton();
final String name = ""+System.currentTimeMillis();
dialog.setNameTextBox(name);
String sailId = ""+System.currentTimeMillis();
dialog.setSailIdTextBox(sailId);
dialog.setBoatClassNameSuggestBox("Laser Int.");
final String boatClassName = "Laser Int.";
dialog.setBoatClassNameSuggestBox(boatClassName);
dialog.pressOk();
String result = null;
for(CompetitorEntry it : competitorsPanel.getCompetitorTable().getEntries()) {
boolean found = false;
for (final CompetitorEntry it : competitorsPanel.getCompetitorTable().getEntries()) {
String itName = it.getName();
if(itName.equals(name)) {
result = it.getName();
if (itName.equals(name)) {
found = true;
// found a candidate:
assertEquals(sailId, it.getSailId());
assertEquals(boatClassName, it.getBoatClassName());
}
}
assertEquals(result,name);
assertTrue(found);
}
}