bug5576: Quickfix for Selenium test failure on Hudson build.

- reverted Sleep
This commit is contained in:
Udo Wessels
2021-06-18 19:50:15 +02:00
parent d376a7556a
commit 2dab20d43b
2 changed files with 12 additions and 10 deletions
@@ -4,9 +4,11 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import com.google.common.base.Objects;
import com.sap.sailing.selenium.core.BySeleniumId;
import com.sap.sailing.selenium.core.FindBy;
import com.sap.sailing.selenium.pages.PageArea;
@@ -88,15 +90,20 @@ public class RegattaDetailsCompositePO extends PageArea {
}
public List<String> getRaceNames(String seriesName) {
final DataEntryPO seriesEntry = findSeries(seriesName);
final String racesColumnContent = seriesEntry.getColumnContent("Races");
if (racesColumnContent != null && ! racesColumnContent.isEmpty()) {
return Arrays.asList(racesColumnContent.split(", "));
try {
final DataEntryPO seriesEntry = findSeries(seriesName);
final String racesColumnContent = seriesEntry.getColumnContent("Races");
if (racesColumnContent != null && ! racesColumnContent.isEmpty()) {
return Arrays.asList(racesColumnContent.split(", "));
}
} catch(StaleElementReferenceException e) {
// DOM is currently changing and therefore elements are no longer attached or document was refreshed.
return null;
}
return Collections.emptyList();
}
public void waitForRacesOfSeries(final String series, final List<String> races) {
waitUntil(() -> getRaceNames(series).equals(races));
waitUntil(() -> Objects.equal(getRaceNames(series), races));
}
}
@@ -138,11 +138,6 @@ public class TestLeaderboardConfiguration extends AbstractSeleniumTest {
SeriesEditDialogPO seriesDialog = regattaDetails.editSeries(RegattaStructureManagementPanelPO.DEFAULT_SERIES_NAME);
seriesDialog.deleteRace("D3");
seriesDialog.pressOk(true, false);
try {
Thread.sleep(2); // wait for the regatta details to have been updated with the new series information
} catch (InterruptedException e) {
logger.log(Level.SEVERE, "Interrupted!", e);
}
final List<String> expectedRaces = Arrays.asList("D1", "D2", "D4", "D5");
regattaDetails.waitForRacesOfSeries(RegattaStructureManagementPanelPO.DEFAULT_SERIES_NAME, expectedRaces);
// Now we can check the result with our expectation