Skip to content
Closed
Show file tree
Hide file tree
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
104 changes: 59 additions & 45 deletions zeppelin-server/src/test/java/org/apache/zeppelin/ZeppelinIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -62,7 +63,7 @@ public void tearDown() {
}

@Test
public void testAngularDisplay() throws InterruptedException{
public void testAngularDisplay() throws Exception {
if (!endToEndTestEnabled()) {
return;
}
Expand Down Expand Up @@ -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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void tearDown() {
}

@Test
public void testMoveUpAndDown() throws InterruptedException {
public void testMoveUpAndDown() throws Exception {
if (!endToEndTestEnabled()) {
return;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

}
Expand Down