use of org.openqa.selenium.TimeoutException in project openolat by klemens.
the class OOGraphene method closeModalDialogWindow.
public static final void closeModalDialogWindow(WebDriver browser) {
By closeModalDialogButtonBy = By.xpath("//div[not(@id='o_form_dirty_message')]/div[contains(@class,'modal-dialog')]//div[contains(@class,'modal-header')]/button[@class='close']");
List<WebElement> closeButtons = browser.findElements(closeModalDialogButtonBy);
for (WebElement closeButton : closeButtons) {
if (closeButton.isDisplayed()) {
try {
clickModalDialogCloseButton(browser, closeButton);
} catch (TimeoutException e) {
try {
clickModalDialogCloseButton(browser, closeButton);
} catch (Exception e2) {
//
}
}
}
}
}
use of org.openqa.selenium.TimeoutException in project zeppelin by apache.
the class SparkParagraphIT method testSqlSpark.
@Test
public void testSqlSpark() throws Exception {
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"));
}
// Age, Job, Marital, Education, Balance
List<WebElement> tableHeaders = driver.findElements(By.cssSelector("span.ui-grid-header-cell-label"));
String headerNames = "";
for (WebElement header : tableHeaders) {
headerNames += header.getText().toString() + "|";
}
collector.checkThat("Paragraph from SparkParagraphIT of testSqlSpark result: ", headerNames, CoreMatchers.equalTo("age|job|marital|education|balance|"));
} 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 {
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.containsString("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 AuthenticationIT method testAnyOfRolesUser.
@Test
public void testAnyOfRolesUser() throws Exception {
try {
AuthenticationIT authenticationIT = new AuthenticationIT();
authenticationIT.authenticationUser("admin", "password1");
pollingWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), MAX_BROWSER_TIMEOUT_SEC).click();
clickAndWait(By.xpath("//li/a[contains(@href, '#/interpreter')]"));
collector.checkThat("Check is user has permission to view this page", true, CoreMatchers.equalTo(pollingWait(By.xpath("//div[@id='main']/div/div[2]"), MIN_IMPLICIT_WAIT).isDisplayed()));
authenticationIT.logoutUser("admin");
authenticationIT.authenticationUser("finance1", "finance1");
pollingWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), MAX_BROWSER_TIMEOUT_SEC).click();
clickAndWait(By.xpath("//li/a[contains(@href, '#/interpreter')]"));
collector.checkThat("Check is user has permission to view this page", true, CoreMatchers.equalTo(pollingWait(By.xpath("//div[@id='main']/div/div[2]"), MIN_IMPLICIT_WAIT).isDisplayed()));
authenticationIT.logoutUser("finance1");
authenticationIT.authenticationUser("hr1", "hr1");
pollingWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), MAX_BROWSER_TIMEOUT_SEC).click();
clickAndWait(By.xpath("//li/a[contains(@href, '#/interpreter')]"));
try {
collector.checkThat("Check is user has permission to view this page", true, CoreMatchers.equalTo(pollingWait(By.xpath("//li[contains(@class, 'ng-toast__message')]//span/span"), MIN_IMPLICIT_WAIT).isDisplayed()));
} catch (TimeoutException e) {
throw new Exception("Expected ngToast not found", e);
}
authenticationIT.logoutUser("hr1");
} catch (Exception e) {
handleException("Exception in AuthenticationIT while testAnyOfRolesUser ", e);
}
}
use of org.openqa.selenium.TimeoutException in project zeppelin by apache.
the class InterpreterModeActionsIT method testPerUserIsolatedAction.
@Test
public void testPerUserIsolatedAction() throws Exception {
try {
// step 1: (admin) login, set 'Per user in isolated' mode of python interpreter, logout
InterpreterModeActionsIT interpreterModeActionsIT = new InterpreterModeActionsIT();
interpreterModeActionsIT.authenticationUser("admin", "password1");
pollingWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), MAX_BROWSER_TIMEOUT_SEC).click();
clickAndWait(By.xpath("//li/a[contains(@href, '#/interpreter')]"));
pollingWait(By.xpath("//input[contains(@ng-model, 'searchInterpreter')]"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("python");
ZeppelinITUtils.sleep(500, false);
clickAndWait(By.xpath("//div[contains(@id, 'python')]//button[contains(@ng-click, 'valueform.$show();\n" + " copyOriginInterpreterSettingProperties(setting.id)')]"));
clickAndWait(By.xpath("//div[contains(@id, 'python')]/div[2]/div/div/div[1]/span[1]/button"));
clickAndWait(By.xpath("//div[contains(@id, 'python')]//li/a[contains(.,'Per User')]"));
clickAndWait(By.xpath("//div[contains(@id, 'python')]/div[2]/div/div/div[1]/span[2]/button"));
clickAndWait(By.xpath("//div[contains(@id, 'python')]//li/a[contains(.,'isolated per user')]"));
JavascriptExecutor jse = (JavascriptExecutor) driver;
jse.executeScript("window.scrollBy(0,250)", "");
ZeppelinITUtils.sleep(500, false);
clickAndWait(By.xpath("//div[contains(@id, 'python')]//div/form/button[contains(@type, 'submit')]"));
clickAndWait(By.xpath("//div[@class='modal-dialog']//div[@class='bootstrap-dialog-footer-buttons']//button[contains(., 'OK')]"));
clickAndWait(By.xpath("//a[@class='navbar-brand navbar-title'][contains(@href, '#/')]"));
interpreterModeActionsIT.logoutUser("admin");
// step 2: (user1) login, create a new note, run two paragraph with 'python', check result, check process, logout
// paragraph: Check if the result is 'user1' in the second paragraph
// System: Check if the number of python interpreter process is '1'
// System: Check if the number of python process is '1'
interpreterModeActionsIT.authenticationUser("user1", "password2");
By locator = By.xpath("//div[contains(@class, 'col-md-4')]/div/h5/a[contains(.,'Create new" + " note')]");
WebElement element = (new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC)).until(ExpectedConditions.visibilityOfElementLocated(locator));
if (element.isDisplayed()) {
createNewNote();
}
String user1noteId = driver.getCurrentUrl().substring(driver.getCurrentUrl().lastIndexOf("/") + 1);
waitForParagraph(1, "READY");
interpreterModeActionsIT.setPythonParagraph(1, "user=\"user1\"");
waitForParagraph(2, "READY");
interpreterModeActionsIT.setPythonParagraph(2, "print(user)");
collector.checkThat("The output field paragraph contains", driver.findElement(By.xpath(getParagraphXPath(2) + "//div[contains(@class, 'text plainTextContent')]")).getText(), CoreMatchers.equalTo("user1"));
String resultProcessNum = (String) CommandExecutor.executeCommandLocalHost(cmdPsPython, false, ProcessData.Types_Of_Data.OUTPUT);
resultProcessNum = resultProcessNum.trim().replaceAll("\n", "");
collector.checkThat("The number of python process is", resultProcessNum, CoreMatchers.equalTo("1"));
resultProcessNum = (String) CommandExecutor.executeCommandLocalHost(cmdPsInterpreter, false, ProcessData.Types_Of_Data.OUTPUT);
resultProcessNum = resultProcessNum.trim().replaceAll("\n", "");
collector.checkThat("The number of python interpreter process is", resultProcessNum, CoreMatchers.equalTo("1"));
interpreterModeActionsIT.logoutUser("user1");
// step 3: (user2) login, create a new note, run two paragraph with 'python', check result, check process, logout
// paragraph: Check if the result is 'user2' in the second paragraph
// System: Check if the number of python interpreter process is '2'
// System: Check if the number of python process is '2'
interpreterModeActionsIT.authenticationUser("user2", "password3");
locator = By.xpath("//div[contains(@class, 'col-md-4')]/div/h5/a[contains(.,'Create new" + " note')]");
element = (new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC)).until(ExpectedConditions.visibilityOfElementLocated(locator));
if (element.isDisplayed()) {
createNewNote();
}
String user2noteId = driver.getCurrentUrl().substring(driver.getCurrentUrl().lastIndexOf("/") + 1);
waitForParagraph(1, "READY");
interpreterModeActionsIT.setPythonParagraph(1, "user=\"user2\"");
waitForParagraph(2, "READY");
interpreterModeActionsIT.setPythonParagraph(2, "print(user)");
collector.checkThat("The output field paragraph contains", driver.findElement(By.xpath(getParagraphXPath(2) + "//div[contains(@class, 'text plainTextContent')]")).getText(), CoreMatchers.equalTo("user2"));
resultProcessNum = (String) CommandExecutor.executeCommandLocalHost(cmdPsPython, false, ProcessData.Types_Of_Data.OUTPUT);
resultProcessNum = resultProcessNum.trim().replaceAll("\n", "");
collector.checkThat("The number of python process is", resultProcessNum, CoreMatchers.equalTo("2"));
resultProcessNum = (String) CommandExecutor.executeCommandLocalHost(cmdPsInterpreter, false, ProcessData.Types_Of_Data.OUTPUT);
resultProcessNum = resultProcessNum.trim().replaceAll("\n", "");
collector.checkThat("The number of python interpreter process is", resultProcessNum, CoreMatchers.equalTo("2"));
interpreterModeActionsIT.logoutUser("user2");
// step 4: (user1) login, come back note user1 made, run second paragraph, check result,
// restart python interpreter in note, check process again, logout
// paragraph: Check if the result is 'user1' in the second paragraph
// System: Check if the number of python interpreter process is '1'
// System: Check if the number of python process is '1'
interpreterModeActionsIT.authenticationUser("user1", "password2");
locator = By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user1noteId + "')]");
element = (new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC)).until(ExpectedConditions.visibilityOfElementLocated(locator));
if (element.isDisplayed()) {
pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user1noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click();
}
runParagraph(2);
try {
waitForParagraph(2, "FINISHED");
} catch (TimeoutException e) {
waitForParagraph(2, "ERROR");
collector.checkThat("Exception in InterpreterModeActionsIT while running Python Paragraph", "ERROR", CoreMatchers.equalTo("FINISHED"));
}
collector.checkThat("The output field paragraph contains", driver.findElement(By.xpath(getParagraphXPath(2) + "//div[contains(@class, 'text plainTextContent')]")).getText(), CoreMatchers.equalTo("user1"));
clickAndWait(By.xpath("//*[@id='actionbar']//span[contains(@uib-tooltip, 'Interpreter binding')]"));
clickAndWait(By.xpath("//div[@data-ng-repeat='item in interpreterBindings' and contains(., 'python')]//a"));
clickAndWait(By.xpath("//div[@class='modal-dialog']" + "[contains(.,'Do you want to restart python interpreter?')]" + "//div[@class='bootstrap-dialog-footer-buttons']//button[contains(., 'OK')]"));
locator = By.xpath("//div[@class='modal-dialog'][contains(.,'Do you want to restart python interpreter?')]");
LOG.info("Holding on until if interpreter restart dialog is disappeared or not in testPerUserIsolatedAction");
boolean invisibilityStatus = (new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC)).until(ExpectedConditions.invisibilityOfElementLocated(locator));
if (invisibilityStatus == false) {
assertTrue("interpreter setting dialog visibility status", invisibilityStatus);
}
locator = By.xpath("//*[@id='actionbar']//span[contains(@uib-tooltip, 'Interpreter binding')]");
element = (new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC)).until(ExpectedConditions.visibilityOfElementLocated(locator));
if (element.isDisplayed()) {
clickAndWait(By.xpath("//*[@id='actionbar']//span[contains(@uib-tooltip, 'Interpreter binding')]"));
}
resultProcessNum = (String) CommandExecutor.executeCommandLocalHost(cmdPsPython, false, ProcessData.Types_Of_Data.OUTPUT);
resultProcessNum = resultProcessNum.trim().replaceAll("\n", "");
collector.checkThat("The number of python process is", resultProcessNum, CoreMatchers.equalTo("1"));
resultProcessNum = (String) CommandExecutor.executeCommandLocalHost(cmdPsInterpreter, false, ProcessData.Types_Of_Data.OUTPUT);
resultProcessNum = resultProcessNum.trim().replaceAll("\n", "");
collector.checkThat("The number of python interpreter process is", resultProcessNum, CoreMatchers.equalTo("1"));
interpreterModeActionsIT.logoutUser("user1");
// step 5: (user2) login, come back note user2 made, restart python interpreter in note, check process, logout
// System: Check if the number of python interpreter process is '0'
// System: Check if the number of python process is '0'
interpreterModeActionsIT.authenticationUser("user2", "password3");
locator = By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user2noteId + "')]");
element = (new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC)).until(ExpectedConditions.visibilityOfElementLocated(locator));
if (element.isDisplayed()) {
clickAndWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user2noteId + "')]"));
}
clickAndWait(By.xpath("//*[@id='actionbar']//span[contains(@uib-tooltip, 'Interpreter binding')]"));
clickAndWait(By.xpath("//div[@data-ng-repeat='item in interpreterBindings' and contains(., 'python')]//a"));
clickAndWait(By.xpath("//div[@class='modal-dialog']" + "[contains(.,'Do you want to restart python interpreter?')]" + "//div[@class='bootstrap-dialog-footer-buttons']//button[contains(., 'OK')]"));
locator = By.xpath("//div[@class='modal-dialog'][contains(.,'Do you want to restart python interpreter?')]");
LOG.info("Holding on until if interpreter restart dialog is disappeared or not in testPerUserIsolatedAction");
invisibilityStatus = (new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC)).until(ExpectedConditions.invisibilityOfElementLocated(locator));
if (invisibilityStatus == false) {
assertTrue("interpreter setting dialog visibility status", invisibilityStatus);
}
locator = By.xpath("//*[@id='actionbar']//span[contains(@uib-tooltip, 'Interpreter binding')]");
element = (new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC)).until(ExpectedConditions.visibilityOfElementLocated(locator));
if (element.isDisplayed()) {
clickAndWait(By.xpath("//*[@id='actionbar']//span[contains(@uib-tooltip, 'Interpreter binding')]"));
}
resultProcessNum = (String) CommandExecutor.executeCommandLocalHost(cmdPsPython, false, ProcessData.Types_Of_Data.OUTPUT);
resultProcessNum = resultProcessNum.trim().replaceAll("\n", "");
collector.checkThat("The number of python process is", resultProcessNum, CoreMatchers.equalTo("0"));
resultProcessNum = (String) CommandExecutor.executeCommandLocalHost(cmdPsInterpreter, false, ProcessData.Types_Of_Data.OUTPUT);
resultProcessNum = resultProcessNum.trim().replaceAll("\n", "");
collector.checkThat("The number of python interpreter process is", resultProcessNum, CoreMatchers.equalTo("0"));
interpreterModeActionsIT.logoutUser("user2");
// step 6: (user1) login, come back note user1 made, run first paragraph,logout
// (user2) login, come back note user2 made, run first paragraph, check process, logout
// System: Check if the number of python process is '2'
// System: Check if the number of python interpreter process is '2'
interpreterModeActionsIT.authenticationUser("user1", "password2");
locator = By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user1noteId + "')]");
element = (new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC)).until(ExpectedConditions.visibilityOfElementLocated(locator));
if (element.isDisplayed()) {
pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user1noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click();
}
waitForParagraph(1, "FINISHED");
runParagraph(1);
try {
waitForParagraph(1, "FINISHED");
} catch (TimeoutException e) {
waitForParagraph(1, "ERROR");
collector.checkThat("Exception in InterpreterModeActionsIT while running Python Paragraph", "ERROR", CoreMatchers.equalTo("FINISHED"));
}
interpreterModeActionsIT.logoutUser("user1");
interpreterModeActionsIT.authenticationUser("user2", "password3");
locator = By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user2noteId + "')]");
element = (new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC)).until(ExpectedConditions.visibilityOfElementLocated(locator));
if (element.isDisplayed()) {
pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user2noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click();
}
runParagraph(1);
try {
waitForParagraph(1, "FINISHED");
} catch (TimeoutException e) {
waitForParagraph(1, "ERROR");
collector.checkThat("Exception in InterpreterModeActionsIT while running Python Paragraph", "ERROR", CoreMatchers.equalTo("FINISHED"));
}
resultProcessNum = (String) CommandExecutor.executeCommandLocalHost(cmdPsPython, false, ProcessData.Types_Of_Data.OUTPUT);
resultProcessNum = resultProcessNum.trim().replaceAll("\n", "");
collector.checkThat("The number of python process is", resultProcessNum, CoreMatchers.equalTo("2"));
resultProcessNum = (String) CommandExecutor.executeCommandLocalHost(cmdPsInterpreter, false, ProcessData.Types_Of_Data.OUTPUT);
resultProcessNum = resultProcessNum.trim().replaceAll("\n", "");
collector.checkThat("The number of python interpreter process is", resultProcessNum, CoreMatchers.equalTo("2"));
interpreterModeActionsIT.logoutUser("user2");
// step 7: (admin) login, restart python interpreter in interpreter tab, check process, logout
// System: Check if the number of python interpreter process is 0
// System: Check if the number of python process is 0
interpreterModeActionsIT.authenticationUser("admin", "password1");
pollingWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), MAX_BROWSER_TIMEOUT_SEC).click();
clickAndWait(By.xpath("//li/a[contains(@href, '#/interpreter')]"));
pollingWait(By.xpath("//input[contains(@ng-model, 'searchInterpreter')]"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("python");
ZeppelinITUtils.sleep(500, false);
clickAndWait(By.xpath("//div[contains(@id, 'python')]" + "//button[contains(@ng-click, 'restartInterpreterSetting(setting.id)')]"));
clickAndWait(By.xpath("//div[@class='modal-dialog']" + "[contains(.,'Do you want to restart this interpreter?')]" + "//div[@class='bootstrap-dialog-footer-buttons']//button[contains(., 'OK')]"));
locator = By.xpath("//div[@class='modal-dialog'][contains(.,'Do you want to restart python interpreter?')]");
LOG.info("Holding on until if interpreter restart dialog is disappeared or not in testPerUserIsolatedAction");
invisibilityStatus = (new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC)).until(ExpectedConditions.invisibilityOfElementLocated(locator));
if (invisibilityStatus == false) {
assertTrue("interpreter setting dialog visibility status", invisibilityStatus);
}
resultProcessNum = (String) CommandExecutor.executeCommandLocalHost(cmdPsPython, false, ProcessData.Types_Of_Data.OUTPUT);
resultProcessNum = resultProcessNum.trim().replaceAll("\n", "");
collector.checkThat("The number of python process is", resultProcessNum, CoreMatchers.equalTo("0"));
resultProcessNum = (String) CommandExecutor.executeCommandLocalHost(cmdPsInterpreter, false, ProcessData.Types_Of_Data.OUTPUT);
resultProcessNum = resultProcessNum.trim().replaceAll("\n", "");
collector.checkThat("The number of python interpreter process is", resultProcessNum, CoreMatchers.equalTo("0"));
interpreterModeActionsIT.logoutUser("admin");
} catch (Exception e) {
handleException("Exception in InterpreterModeActionsIT while testPerUserIsolatedAction ", e);
}
}
Aggregations