delay waiting for AJAX calls after switching tabs to give async call a chance to start; fixed event creation test

Change-Id: I1e2d0d0f3c3e8a600a01aaaa12053e42c014ccb4
This commit is contained in:
Axel Uhl committed 2016-06-09 15:31:01 +02:00
1 parent ad8bbf7777
commit 0868ca7aaf
2 files changed
+14 -1

No files matched your search

@@ -7,6 +7,8 @@ import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.function.BooleanSupplier;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openqa.selenium.By;
import org.openqa.selenium.SearchContext;
@@ -51,6 +53,8 @@ import com.sap.sailing.selenium.core.SeleniumFieldDecorator;
* D049941
*/
public class PageObject {
private static final Logger logger = Logger.getLogger(PageObject.class.getName());
public static final int DEFAULT_WAIT_TIMEOUT_SECONDS = 120;
public static final int DEFAULT_POLLING_INTERVAL = 5;
@@ -465,6 +469,11 @@ public class PageObject {
// Wait for the tab to become visible due to the used animations.
FluentWait<WebElement> wait = createFluentWait(tabPanel);
WebElement content = wait.until(ElementSearchConditions.visibilityOfElementLocated(new BySeleniumId(id)));
try {
Thread.sleep(500);
} catch (InterruptedException e) {
logger.log(Level.WARNING, "internal error sleeping for 500ms", e);
} // wait for a bit to make sure the UI had a change to trigger any asynchronous background update/refresh
waitForAjaxRequests(); // switching tabs can trigger asynchronous updates, replacing UI elements
return content;
}
@@ -82,7 +82,11 @@ public class EventConfigurationPanelPO extends PageArea {
createDialog.addLeaderboardGroup(leaderboardGroupsTab, leaderboardGroupName);
}
createDialog.pressOk();
getPO(ConfirmDialogPO::new, ID_CREATE_DEFAULT_LEADERBOARD_GROUP_CONFIRM_DIALOG).pressNo();
if (leaderboardGroupNames.length == 0) {
getPO(ConfirmDialogPO::new, ID_CREATE_DEFAULT_LEADERBOARD_GROUP_CONFIRM_DIALOG).pressNo();
} else {
getPO(ConfirmDialogPO::new, ID_CREATE_DEFAULT_REGATTA_CONFIRM_DIALOG).pressNo();
}
}
public EventEntryPO getEventEntry(String event) {