Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
public class ZeppelinIT {
private static final Logger LOG = LoggerFactory.getLogger(ZeppelinIT.class);
private static final long MAX_BROWSER_TIMEOUT_SEC = 30;
private static final long MAX_PARAGRAPH_TIMEOUT_SEC = 60;
private WebDriver driver;

private void setWebDriver() {
Expand Down Expand Up @@ -112,7 +113,7 @@ private void setWebDriver() {

while (System.currentTimeMillis() - start < 60 * 1000) {
try { // wait for page load
WebElement element = pollingWait(By.partialLinkText("Create new note"));
WebElement element = pollingWait(By.partialLinkText("Create new note"), MAX_BROWSER_TIMEOUT_SEC);
loaded = element.isDisplayed();
break;
} catch (TimeoutException e) {
Expand Down Expand Up @@ -149,22 +150,22 @@ String getParagraphXPath(int paragraphNo) {
boolean waitForParagraph(final int paragraphNo, final String state) {
By locator = By.xpath(getParagraphXPath(paragraphNo)
+ "//div[contains(@class, 'control')]//span[1][contains(.,'" + state + "')]");
WebElement element = pollingWait(locator);
WebElement element = pollingWait(locator, MAX_PARAGRAPH_TIMEOUT_SEC);
return element.isDisplayed();
}

boolean waitForText(final String txt, final By locator) {
try {
WebElement element = pollingWait(locator);
WebElement element = pollingWait(locator, MAX_BROWSER_TIMEOUT_SEC);
return txt.equals(element.getText());
} catch (TimeoutException e) {
return false;
}
}

public WebElement pollingWait(final By locator) {
public WebElement pollingWait(final By locator, final long timeWait) {
Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)
.withTimeout(MAX_BROWSER_TIMEOUT_SEC, TimeUnit.SECONDS)
.withTimeout(timeWait, TimeUnit.SECONDS)
.pollingEvery(1, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class);

Expand Down