Bug 5239: Fixed selenium test failures on Hudson by explicitly

dismissing notifications that may cover buttons in dialogs due to
limited screen height on Hudson
This commit is contained in:
Steffen Schaefer committed 2020-08-18 09:10:13 +02:00
1 parent 4b7060a967
commit 6822e1338c
2 files changed
+28

No files matched your search

@@ -706,6 +706,28 @@ public class PageObject {
});
}
protected void dismissAllExistingNotifications() {
boolean retryNecessary = true;
while (retryNecessary) {
retryNecessary = false;
try {
List<WebElement> notificationBar = driver.findElements(By.id("notificationBar"));
if (!notificationBar.isEmpty()) {
// we got the enclosing panel
List<WebElement> notifications = notificationBar.get(0).findElements(By.cssSelector("*"));
if (!notifications.isEmpty()) {
for (WebElement messageElement : notifications) {
messageElement.click();
}
}
}
} catch (Exception e) {
// This call can fail temporarily while notifications are being updated
retryNecessary = true;
}
}
}
protected void scrollToView(WebElement webElement) {
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(false);", webElement);
}
@@ -31,4 +31,10 @@ public class AclPopupPO extends DataEntryDialogPO {
return new AclActionInputPO(driver, context.findElement(new BySeleniumId(ALLOWED_ACTIONS_CONTAINER)));
}
@Override
public void clickOkButtonOrThrow() {
// On Hudson the limited screen height may cause notifications to cover the buttons
dismissAllExistingNotifications();
super.clickOkButtonOrThrow();
}
}