Skip to content
This repository was archived by the owner on Mar 2, 2020. It is now read-only.

Commit 2dc561a

Browse files
committed
Change: method and comment
1 parent d55caf2 commit 2dc561a

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

ui-tests/src/test/java/com/specmate/uitests/pagemodel/UITestUtil.java

+4-21
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,23 @@
1313

1414
public class UITestUtil {
1515
/**
16-
* If the modal is displayed, we wait 1 second and then check again if the modal is still there
17-
* The method checks for 10 seconds at intervals of 1 second (driver.findElement TimeOut
18-
* (defined by implictlyWait) (1 seconds) * counter (10)) if the modal disappeared
16+
* If modal is visible we wait for a maximum of 10 seconds for the modal to become invisible again.
17+
* If modal is not visible in the first place, we simply return
1918
* */
2019
public static void waitForModalToDisappear(WebDriver driver) {
2120
By modalLocator = By.id("loading-modal");
22-
/*boolean modalDisplayed = true;
23-
int counter = 11;
24-
25-
driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
26-
do {
27-
try {
28-
counter--;
29-
// If modal is not displayed, exception is thrown
30-
driver.findElement(modalLocator).isDisplayed();
31-
modalDisplayed = counter>0;
32-
} catch (NoSuchElementException | StaleElementReferenceException e) {
33-
modalDisplayed = false;
34-
}
35-
} while(modalDisplayed);
36-
// Change timeout back to the defined value
37-
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);*/
3821
driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
3922
try {
4023
new WebDriverWait(driver, 2).until(
4124
ExpectedConditions.visibilityOfElementLocated(modalLocator));
42-
} catch (TimeoutException | NoSuchElementException e) {
25+
} catch (TimeoutException te) {
26+
// no modal displayed
4327
return;
4428
}
4529
new WebDriverWait(driver, 10).until(ExpectedConditions.invisibilityOfElementLocated(modalLocator));
4630
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
4731
}
4832

49-
5033
/**
5134
* Checks if the element is present or absent
5235
*

0 commit comments

Comments
 (0)