diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/ZeppelinIT.java b/zeppelin-server/src/test/java/org/apache/zeppelin/ZeppelinIT.java index e9a56cc108d..d876b177f8a 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/ZeppelinIT.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/ZeppelinIT.java @@ -23,6 +23,7 @@ import org.openqa.selenium.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import scala.reflect.internal.Trees; import java.io.File; @@ -62,7 +63,7 @@ public void tearDown() { } @Test - public void testAngularDisplay() throws InterruptedException{ + public void testAngularDisplay() throws Exception { if (!endToEndTestEnabled()) { return; } @@ -193,55 +194,68 @@ public void testAngularDisplay() throws InterruptedException{ sleep(100, true); System.out.println("testCreateNotebook Test executed"); - } catch (ElementNotVisibleException e) { + } catch (Exception e) { LOG.error("Exception in ZeppelinIT while testAngularDisplay ", e); File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); - + throw e; } } @Test - public void testSparkInterpreterDependencyLoading() { - // navigate to interpreter page - WebElement interpreterLink = driver.findElement(By.linkText("Interpreter")); - interpreterLink.click(); - - // add new dependency to spark interpreter - WebElement sparkEditBtn = pollingWait(By.xpath("//div[h3[text()[contains(.,'spark')]]]//button[contains(.,'edit')]"), - MAX_BROWSER_TIMEOUT_SEC); - sparkEditBtn.click(); - WebElement depArtifact = driver.findElement(By.xpath("//input[@ng-model='setting.depArtifact']")); - String artifact = "org.apache.commons:commons-csv:1.1"; - depArtifact.sendKeys(artifact); - driver.findElement(By.xpath("//button[contains(.,'Save')]")).submit(); - driver.switchTo().alert().accept(); - - driver.navigate().back(); - createNewNote(); - - // wait for first paragraph's " READY " status text - waitForParagraph(1, "READY"); - - WebElement paragraph1Editor = driver.findElement(By.xpath(getParagraphXPath(1) + "//textarea")); - - paragraph1Editor.sendKeys("import org.apache.commons.csv.CSVFormat"); - paragraph1Editor.sendKeys(Keys.chord(Keys.SHIFT, Keys.ENTER)); - waitForParagraph(1, "FINISHED"); - - // check expected text - assertTrue(waitForText("import org.apache.commons.csv.CSVFormat", - By.xpath(getParagraphXPath(1) + "//div[starts-with(@id, 'p') and contains(@id, 'text')]/div"))); - - // reset dependency - interpreterLink.click(); - sparkEditBtn = pollingWait(By.xpath("//div[h3[text()[contains(.,'spark')]]]//button[contains(.,'edit')]"), - MAX_BROWSER_TIMEOUT_SEC); - sparkEditBtn.click(); - WebElement testDepRemoveBtn = driver.findElement(By.xpath("//tr[descendant::text()[contains(.,'" + - artifact + "')]]/td[3]/div")); - sleep(5000, true); - testDepRemoveBtn.click(); - driver.findElement(By.xpath("//button[contains(.,'Save')]")).submit(); - driver.switchTo().alert().accept(); + public void testSparkInterpreterDependencyLoading() throws Exception { + if (!endToEndTestEnabled()) { + return; + } + try { + // navigate to interpreter page + WebElement interpreterLink = driver.findElement(By.linkText("Interpreter")); + interpreterLink.click(); + + // add new dependency to spark interpreter + WebElement sparkEditBtn = pollingWait(By.xpath("//div[h3[text()[contains(.,'spark')]]]//button[contains(.,'edit')]"), + MAX_BROWSER_TIMEOUT_SEC); + sparkEditBtn.click(); + WebElement depArtifact = driver.findElement(By.xpath("//input[@ng-model='setting.depArtifact']")); + String artifact = "org.apache.commons:commons-csv:1.1"; + depArtifact.sendKeys(artifact); + driver.findElement(By.xpath("//button[contains(.,'Save')]")).submit(); + driver.switchTo().alert().accept(); + + driver.navigate().back(); + createNewNote(); + + // wait for first paragraph's " READY " status text + waitForParagraph(1, "READY"); + + WebElement paragraph1Editor = driver.findElement(By.xpath(getParagraphXPath(1) + "//textarea")); + + paragraph1Editor.sendKeys("import org.apache.commons.csv.CSVFormat"); + paragraph1Editor.sendKeys(Keys.chord(Keys.SHIFT, Keys.ENTER)); + waitForParagraph(1, "FINISHED"); + + // check expected text + assertTrue(waitForText("import org.apache.commons.csv.CSVFormat", + By.xpath(getParagraphXPath(1) + "//div[starts-with(@id, 'p') and contains(@id, 'text')]/div"))); + + //delete created notebook for cleanup. + deleteTestNotebook(driver); + sleep(1000, true); + + // reset dependency + interpreterLink.click(); + sparkEditBtn = pollingWait(By.xpath("//div[h3[text()[contains(.,'spark')]]]//button[contains(.,'edit')]"), + MAX_BROWSER_TIMEOUT_SEC); + sparkEditBtn.click(); + WebElement testDepRemoveBtn = driver.findElement(By.xpath("//tr[descendant::text()[contains(.,'" + + artifact + "')]]/td[3]/div")); + sleep(5000, true); + testDepRemoveBtn.click(); + driver.findElement(By.xpath("//button[contains(.,'Save')]")).submit(); + driver.switchTo().alert().accept(); + } catch (Exception e) { + LOG.error("Exception in ZeppelinIT while testSparkInterpreterDependencyLoading ", e); + File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); + throw e; + } } } diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ParagraphActionsIT.java b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ParagraphActionsIT.java index 23aaf6fa65c..ddc7a4d7e2d 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ParagraphActionsIT.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ParagraphActionsIT.java @@ -58,7 +58,7 @@ public void tearDown() { } @Test - public void testMoveUpAndDown() throws InterruptedException { + public void testMoveUpAndDown() throws Exception { if (!endToEndTestEnabled()) { return; } @@ -111,14 +111,16 @@ public void testMoveUpAndDown() throws InterruptedException { ZeppelinITUtils.sleep(1000,false); deleteTestNotebook(driver); - } catch (ElementNotVisibleException e) { + } catch (Exception e) { + LOG.error("Exception in ParagraphActionsIT while testMoveUpAndDown ", e); File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); + throw e; } } @Test - public void testDisableParagraphRunButton() throws InterruptedException { + public void testDisableParagraphRunButton() throws Exception { if (!endToEndTestEnabled()) { return; } @@ -149,8 +151,10 @@ public void testDisableParagraphRunButton() throws InterruptedException { deleteTestNotebook(driver); - } catch (ElementNotVisibleException e) { + } catch (Exception e) { + LOG.error("Exception in ParagraphActionsIT while testDisableParagraphRunButton ", e); File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); + throw e; } }