use of org.openqa.selenium.TimeoutException in project selenium-tests by Wikia.
the class ChatPage method isMessageOnChat.
public boolean isMessageOnChat(String message) {
try {
WebElement userPostedMessage = userPostedMessage(message);
wait.forElementVisible(userPostedMessage);
return true;
} catch (TimeoutException | NoSuchElementException ex) {
PageObjectLogging.log("Message on chat not displayed", ex, true);
return false;
}
}
use of org.openqa.selenium.TimeoutException in project zeppelin by apache.
the class SparkParagraphIT method testSqlSpark.
@Test
public void testSqlSpark() throws Exception {
if (!endToEndTestEnabled()) {
return;
}
try {
setTextOfParagraph(1, "%sql\\n" + "select * from bank limit 1");
runParagraph(1);
try {
waitForParagraph(1, "FINISHED");
} catch (TimeoutException e) {
waitForParagraph(1, "ERROR");
collector.checkThat("Paragraph from SparkParagraphIT of testSqlSpark status: ", "ERROR", CoreMatchers.equalTo("FINISHED"));
}
WebElement paragraph1Result = driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@id,\"_graph\")]/div/div/div/div/div[1]"));
collector.checkThat("Paragraph from SparkParagraphIT of testSqlSpark result: ", paragraph1Result.getText().toString(), CoreMatchers.equalTo("age\n▼\njob\n▼\nmarital\n▼\neducation\n▼\nbalance\n▼\n30 unemployed married primary 1787"));
} catch (Exception e) {
handleException("Exception in SparkParagraphIT while testSqlSpark", e);
}
}
use of org.openqa.selenium.TimeoutException in project zeppelin by apache.
the class SparkParagraphIT method testPySpark.
@Test
public void testPySpark() throws Exception {
if (!endToEndTestEnabled()) {
return;
}
try {
setTextOfParagraph(1, "%pyspark\\n" + "for x in range(0, 3):\\n" + " print \"test loop %d\" % (x)");
runParagraph(1);
try {
waitForParagraph(1, "FINISHED");
} catch (TimeoutException e) {
waitForParagraph(1, "ERROR");
collector.checkThat("Paragraph from SparkParagraphIT of testPySpark status: ", "ERROR", CoreMatchers.equalTo("FINISHED"));
}
WebElement paragraph1Result = driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@id,\"_text\")]"));
collector.checkThat("Paragraph from SparkParagraphIT of testPySpark result: ", paragraph1Result.getText().toString(), CoreMatchers.equalTo("test loop 0\ntest loop 1\ntest loop 2"));
// the last statement's evaluation result is printed
setTextOfParagraph(2, "%pyspark\\n" + "sc.version\\n" + "1+1");
runParagraph(2);
try {
waitForParagraph(2, "FINISHED");
} catch (TimeoutException e) {
waitForParagraph(2, "ERROR");
collector.checkThat("Paragraph from SparkParagraphIT of testPySpark status: ", "ERROR", CoreMatchers.equalTo("FINISHED"));
}
WebElement paragraph2Result = driver.findElement(By.xpath(getParagraphXPath(2) + "//div[contains(@id,\"_text\")]"));
collector.checkThat("Paragraph from SparkParagraphIT of testPySpark result: ", paragraph2Result.getText().toString(), CoreMatchers.equalTo("2"));
} catch (Exception e) {
handleException("Exception in SparkParagraphIT while testPySpark", e);
}
}
use of org.openqa.selenium.TimeoutException in project zeppelin by apache.
the class ZeppelinIT method testSparkInterpreterDependencyLoading.
@Test
public void testSparkInterpreterDependencyLoading() throws Exception {
if (!endToEndTestEnabled()) {
return;
}
try {
// navigate to interpreter page
WebElement settingButton = driver.findElement(By.xpath("//button[@class='nav-btn dropdown-toggle ng-scope']"));
settingButton.click();
WebElement interpreterLink = driver.findElement(By.xpath("//a[@href='#/interpreter']"));
interpreterLink.click();
// add new dependency to spark interpreter
driver.findElement(By.xpath("//div[@id='spark']//button[contains(.,'edit')]")).sendKeys(Keys.ENTER);
WebElement depArtifact = pollingWait(By.xpath("//input[@ng-model='setting.depArtifact']"), MAX_BROWSER_TIMEOUT_SEC);
String artifact = "org.apache.commons:commons-csv:1.1";
depArtifact.sendKeys(artifact);
driver.findElement(By.xpath("//div[@id='spark']//form//button[1]")).click();
clickAndWait(By.xpath("//div[@class='modal-dialog'][contains(.,'Do you want to update this interpreter and restart with new settings?')]" + "//div[@class='modal-footer']//button[contains(.,'OK')]"));
try {
clickAndWait(By.xpath("//div[@class='modal-dialog'][contains(.,'Do you want to " + "update this interpreter and restart with new settings?')]//" + "div[@class='bootstrap-dialog-close-button']/button"));
} catch (TimeoutException | StaleElementReferenceException e) {
//Modal dialog got closed earlier than expected nothing to worry.
}
driver.navigate().back();
createNewNote();
// wait for first paragraph's " READY " status text
waitForParagraph(1, "READY");
setTextOfParagraph(1, "import org.apache.commons.csv.CSVFormat");
runParagraph(1);
waitForParagraph(1, "FINISHED");
// check expected text
WebElement paragraph1Result = driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@id,\"_text\")]"));
collector.checkThat("Paragraph from ZeppelinIT of testSparkInterpreterDependencyLoading result: ", paragraph1Result.getText().toString(), CoreMatchers.containsString("import org.apache.commons.csv.CSVFormat"));
//delete created notebook for cleanup.
deleteTestNotebook(driver);
ZeppelinITUtils.sleep(1000, false);
// reset dependency
settingButton.click();
interpreterLink.click();
driver.findElement(By.xpath("//div[@id='spark']//button[contains(.,'edit')]")).sendKeys(Keys.ENTER);
WebElement testDepRemoveBtn = pollingWait(By.xpath("//tr[descendant::text()[contains(.,'" + artifact + "')]]/td[3]/button"), MAX_IMPLICIT_WAIT);
testDepRemoveBtn.sendKeys(Keys.ENTER);
driver.findElement(By.xpath("//div[@id='spark']//form//button[1]")).click();
driver.findElement(By.xpath("//div[@class='modal-dialog'][contains(.,'Do you want to update this interpreter and restart with new settings?')]" + "//div[@class='modal-footer']//button[contains(.,'OK')]")).click();
} catch (Exception e) {
handleException("Exception in ZeppelinIT while testSparkInterpreterDependencyLoading ", e);
}
}
use of org.openqa.selenium.TimeoutException in project zeppelin by apache.
the class WebDriverManager method getWebDriver.
public static WebDriver getWebDriver() {
WebDriver driver = null;
if (driver == null) {
try {
FirefoxBinary ffox = new FirefoxBinary();
if ("true".equals(System.getenv("TRAVIS"))) {
// xvfb is supposed to
ffox.setEnvironmentProperty("DISPLAY", ":99");
// run with DISPLAY 99
}
int firefoxVersion = WebDriverManager.getFirefoxVersion();
LOG.info("Firefox version " + firefoxVersion + " detected");
downLoadsDir = FileUtils.getTempDirectory().toString();
String tempPath = downLoadsDir + "/firebug/";
downloadFireBug(firefoxVersion, tempPath);
final String firebugPath = tempPath + "firebug.xpi";
final String firepathPath = tempPath + "firepath.xpi";
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.download.dir", downLoadsDir);
profile.setPreference("browser.helperApps.alwaysAsk.force", false);
profile.setPreference("browser.download.manager.showWhenStarting", false);
profile.setPreference("browser.download.manager.showAlertOnComplete", false);
profile.setPreference("browser.download.manager.closeWhenDone", true);
profile.setPreference("app.update.auto", false);
profile.setPreference("app.update.enabled", false);
profile.setPreference("dom.max_script_run_time", 0);
profile.setPreference("dom.max_chrome_script_run_time", 0);
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/x-ustar,application/octet-stream,application/zip,text/csv,text/plain");
profile.setPreference("network.proxy.type", 0);
profile.addExtension(new File(firebugPath));
profile.addExtension(new File(firepathPath));
driver = new FirefoxDriver(ffox, profile);
} catch (Exception e) {
LOG.error("Exception in WebDriverManager while FireFox Driver ", e);
}
}
if (driver == null) {
try {
driver = new ChromeDriver();
} catch (Exception e) {
LOG.error("Exception in WebDriverManager while ChromeDriver ", e);
}
}
if (driver == null) {
try {
driver = new SafariDriver();
} catch (Exception e) {
LOG.error("Exception in WebDriverManager while SafariDriver ", e);
}
}
String url;
if (System.getenv("url") != null) {
url = System.getenv("url");
} else {
url = "http://localhost:8080";
}
long start = System.currentTimeMillis();
boolean loaded = false;
driver.manage().timeouts().implicitlyWait(AbstractZeppelinIT.MAX_IMPLICIT_WAIT, TimeUnit.SECONDS);
driver.get(url);
while (System.currentTimeMillis() - start < 60 * 1000) {
// wait for page load
try {
(new WebDriverWait(driver, 30)).until(new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver d) {
return d.findElement(By.xpath("//i[@tooltip='WebSocket Connected']")).isDisplayed();
}
});
loaded = true;
break;
} catch (TimeoutException e) {
LOG.info("Exception in WebDriverManager while WebDriverWait ", e);
driver.navigate().to(url);
}
}
if (loaded == false) {
fail();
}
return driver;
}
Aggregations