Repository: incubator-zeppelin Updated Branches: refs/heads/master d16ec20fc -> ea9f13930
Add new selenium test case to test clear output button ##What is this PR for? Add a new test case for testing the clear output button. Clear output button clears the output on the paragraph ##What type of PR is it? Test ##Is there a relevant Jira issue? NA ##How should this be tested? On OSX, you'll need firefox 42.0 installed, then you can run with PATH=~/Applications/Firefox.app/Contents/MacOS/:$PATH CI="" \ mvn -Dtest=org.apache.zeppelin.ParagraphActionsIT -Denforcer.skip=true \ test -pl zeppelin-server ##Questions: Does the licenses files need update?NO Is there breaking changes for older versions?NO Does this needs documentation?NO Author: Ravi Ranjan <[email protected]> Closes #689 from ravicodder/testClearOutputButton and squashes the following commits: 6348430 [Ravi Ranjan] Merge branch 'master' of https://github.com/apache/incubator-zeppelin into testClearOutputButton 60d2ea2 [Ravi Ranjan] Modified code to use reusable vriable to xpath f328061 [Ravi Ranjan] Correcting bad rebase 88ddf31 [Ravi Ranjan] Merge branch 'master' of https://github.com/apache/incubator-zeppelin into testClearOutputButton fcb42d3 [Ravi Ranjan] Use handleException 4cdb6d4 [Ravi Ranjan] Merge branch 'master' of https://github.com/apache/incubator-zeppelin into testClearOutputButton abb9673 [Ravi Ranjan] Merge branch 'master' of https://github.com/apache/incubator-zeppelin into testClearOutputButton 4e7ec99 [Ravi Ranjan] Modifed the xpath and waitforparagraph till FINISHED state 31e2849 [Ravi Ranjan] Merge remote-tracking branch 'origin/master' into testClearOutputButton 3d9b601 [Ravi Ranjan] Add LOG.error message in catch statement 3a99ac2 [Ravi Ranjan] Add LOG.error message in catch statement of test ba079ef [Ravi Ranjan] Debug message improved ccecb6c [Ravi Ranjan] Add new selenium test case to test clear output button a8be230 [Ravi Ranjan] add modified checkthat message f4a0883 [Ravi Ranjan] Add new selenium test case for clear output button of paragraph Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/ea9f1393 Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/ea9f1393 Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/ea9f1393 Branch: refs/heads/master Commit: ea9f139308621704270f73b34dba995b61027b2c Parents: d16ec20 Author: Ravi Ranjan <[email protected]> Authored: Wed Feb 24 11:04:20 2016 +0530 Committer: Damien CORNEAU <[email protected]> Committed: Wed Feb 24 20:07:31 2016 -0800 ---------------------------------------------------------------------- .../integration/ParagraphActionsIT.java | 108 ++++++++++++------- 1 file changed, 71 insertions(+), 37 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/ea9f1393/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ParagraphActionsIT.java ---------------------------------------------------------------------- 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 57835ea..d445b93 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 @@ -69,21 +69,21 @@ public class ParagraphActionsIT extends AbstractZeppelinIT { waitForParagraph(1, "READY"); Integer oldNosOfParas = driver.findElements(By.xpath("//div[@ng-controller=\"ParagraphCtrl\"]")).size(); collector.checkThat("Before Insert New : the number of paragraph ", - oldNosOfParas, - CoreMatchers.equalTo(1)); + oldNosOfParas, + CoreMatchers.equalTo(1)); driver.findElement(By.xpath(getParagraphXPath(1) + "//span[@class='icon-settings']")).click(); driver.findElement(By.xpath(getParagraphXPath(1) + "//ul/li/a[@ng-click='insertNew()']")).click(); waitForParagraph(2, "READY"); Integer newNosOfParas = driver.findElements(By.xpath("//div[@ng-controller=\"ParagraphCtrl\"]")).size(); collector.checkThat("After Insert New (using Insert New button) : number of paragraph", - oldNosOfParas + 1, - CoreMatchers.equalTo(newNosOfParas)); + oldNosOfParas + 1, + CoreMatchers.equalTo(newNosOfParas)); driver.findElement(By.xpath(getParagraphXPath(1) + "//span[@class='icon-settings']")).click(); driver.findElement(By.xpath(getParagraphXPath(1) + "//ul/li/a[@ng-click='removeParagraph()']")).click(); ZeppelinITUtils.sleep(1000, false); driver.findElement(By.xpath("//div[@class='modal-dialog'][contains(.,'delete this paragraph')]" + - "//div[@class='modal-footer']//button[contains(.,'OK')]")).click(); + "//div[@class='modal-footer']//button[contains(.,'OK')]")).click(); ZeppelinITUtils.sleep(1000, false); WebElement oldParagraphEditor = driver.findElement(By.xpath(getParagraphXPath(1) + "//textarea")); @@ -95,8 +95,8 @@ public class ParagraphActionsIT extends AbstractZeppelinIT { waitForParagraph(1, "READY"); collector.checkThat("Paragraph is created above", - driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'editor')]")).getText(), - CoreMatchers.equalTo("")); + driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'editor')]")).getText(), + CoreMatchers.equalTo("")); WebElement aboveParagraphEditor = driver.findElement(By.xpath(getParagraphXPath(1) + "//textarea")); aboveParagraphEditor.sendKeys(" this is above "); @@ -106,32 +106,31 @@ public class ParagraphActionsIT extends AbstractZeppelinIT { waitForParagraph(3, "READY"); collector.checkThat("Paragraph is created below", - driver.findElement(By.xpath(getParagraphXPath(3) + "//div[contains(@class, 'editor')]")).getText(), - CoreMatchers.equalTo("")); + driver.findElement(By.xpath(getParagraphXPath(3) + "//div[contains(@class, 'editor')]")).getText(), + CoreMatchers.equalTo("")); WebElement belowParagraphEditor = driver.findElement(By.xpath(getParagraphXPath(3) + "//textarea")); belowParagraphEditor.sendKeys(" this is below "); collector.checkThat("The output field of paragraph1 contains", - driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'editor')]")).getText(), - CoreMatchers.equalTo(" this is above ")); + driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'editor')]")).getText(), + CoreMatchers.equalTo(" this is above ")); collector.checkThat("The output field paragraph2 contains", - driver.findElement(By.xpath(getParagraphXPath(2) + "//div[contains(@class, 'editor')]")).getText(), - CoreMatchers.equalTo(" original paragraph ")); + driver.findElement(By.xpath(getParagraphXPath(2) + "//div[contains(@class, 'editor')]")).getText(), + CoreMatchers.equalTo(" original paragraph ")); collector.checkThat("The output field paragraph3 contains", - driver.findElement(By.xpath(getParagraphXPath(3) + "//div[contains(@class, 'editor')]")).getText(), - CoreMatchers.equalTo(" this is below ")); + driver.findElement(By.xpath(getParagraphXPath(3) + "//div[contains(@class, 'editor')]")).getText(), + CoreMatchers.equalTo(" this is below ")); collector.checkThat("The current number of paragraphs after creating paragraph above and below", - driver.findElements(By.xpath("//div[@ng-controller=\"ParagraphCtrl\"]")).size(), - CoreMatchers.equalTo(3)); + driver.findElements(By.xpath("//div[@ng-controller=\"ParagraphCtrl\"]")).size(), + CoreMatchers.equalTo(3)); ZeppelinITUtils.sleep(1000, false); deleteTestNotebook(driver); } catch (Exception e) { - handleException("Exception in ParagraphActionsIT while testCreateNewButton ", e); + handleException("Exception in ParagraphActionsIT while testCreateNewButton ", e); } - } @Test @@ -148,17 +147,17 @@ public class ParagraphActionsIT extends AbstractZeppelinIT { waitForParagraph(2, "READY"); Integer oldNosOfParas = driver.findElements(By.xpath("//div[@ng-controller=\"ParagraphCtrl\"]")).size(); collector.checkThat("Before Remove : Number of paragraphs are ", - oldNosOfParas, - CoreMatchers.equalTo(2)); + oldNosOfParas, + CoreMatchers.equalTo(2)); driver.findElement(By.xpath(getParagraphXPath(1) + "//span[@class='icon-settings']")).click(); driver.findElement(By.xpath(getParagraphXPath(1) + "//ul/li/a[@ng-click='removeParagraph()']")).click(); sleep(1000, true); driver.findElement(By.xpath("//div[@class='modal-dialog'][contains(.,'delete this paragraph')]" + - "//div[@class='modal-footer']//button[contains(.,'OK')]")).click(); + "//div[@class='modal-footer']//button[contains(.,'OK')]")).click(); Integer newNosOfParas = driver.findElements(By.xpath("//div[@ng-controller=\"ParagraphCtrl\"]")).size(); collector.checkThat("After Remove : Number of paragraphs are", - oldNosOfParas-1, - CoreMatchers.equalTo(newNosOfParas)); + oldNosOfParas-1, + CoreMatchers.equalTo(newNosOfParas)); ZeppelinITUtils.sleep(1000, false); deleteTestNotebook(driver); @@ -166,7 +165,7 @@ public class ParagraphActionsIT extends AbstractZeppelinIT { handleException("Exception in ParagraphActionsIT while testMoveUpAndDown ", e); } } - + @Test public void testMoveUpAndDown() throws Exception { if (!endToEndTestEnabled()) { @@ -189,11 +188,11 @@ public class ParagraphActionsIT extends AbstractZeppelinIT { collector.checkThat("The paragraph1 value contains", - driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'editor')]")).getText(), - CoreMatchers.equalTo("1")); + driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'editor')]")).getText(), + CoreMatchers.equalTo("1")); collector.checkThat("The paragraph1 value contains", - driver.findElement(By.xpath(getParagraphXPath(2) + "//div[contains(@class, 'editor')]")).getText(), - CoreMatchers.equalTo("2")); + driver.findElement(By.xpath(getParagraphXPath(2) + "//div[contains(@class, 'editor')]")).getText(), + CoreMatchers.equalTo("2")); driver.findElement(By.xpath(getParagraphXPath(1) + "//span[@class='icon-settings']")).click(); driver.findElement(By.xpath(getParagraphXPath(1) + "//ul/li/a[@ng-click='moveDown()']")).click(); @@ -201,11 +200,11 @@ public class ParagraphActionsIT extends AbstractZeppelinIT { ZeppelinITUtils.sleep(1000,false); collector.checkThat("The paragraph1 value contains", - driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'editor')]")).getText(), - CoreMatchers.equalTo("2")); + driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'editor')]")).getText(), + CoreMatchers.equalTo("2")); collector.checkThat("The paragraph1 value contains", - driver.findElement(By.xpath(getParagraphXPath(2) + "//div[contains(@class, 'editor')]")).getText(), - CoreMatchers.equalTo("1")); + driver.findElement(By.xpath(getParagraphXPath(2) + "//div[contains(@class, 'editor')]")).getText(), + CoreMatchers.equalTo("1")); driver.findElement(By.xpath(getParagraphXPath(2) + "//span[@class='icon-settings']")).click(); driver.findElement(By.xpath(getParagraphXPath(2) + "//ul/li/a[@ng-click='moveUp()']")).click(); @@ -213,11 +212,11 @@ public class ParagraphActionsIT extends AbstractZeppelinIT { ZeppelinITUtils.sleep(1000,false); collector.checkThat("The paragraph1 value contains", - driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'editor')]")).getText(), - CoreMatchers.equalTo("1")); + driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'editor')]")).getText(), + CoreMatchers.equalTo("1")); collector.checkThat("The paragraph1 value contains", - driver.findElement(By.xpath(getParagraphXPath(2) + "//div[contains(@class, 'editor')]")).getText(), - CoreMatchers.equalTo("2")); + driver.findElement(By.xpath(getParagraphXPath(2) + "//div[contains(@class, 'editor')]")).getText(), + CoreMatchers.equalTo("2")); ZeppelinITUtils.sleep(1000,false); deleteTestNotebook(driver); @@ -264,4 +263,39 @@ public class ParagraphActionsIT extends AbstractZeppelinIT { } } + + @Test + public void testClearOutputButton() throws Exception { + if (!endToEndTestEnabled()) { + return; + } + try { + createNewNote(); + + waitForParagraph(1, "READY"); + String xpathToOutputField=getParagraphXPath(1) + "//div[contains(@ng-if,'getResultType()')]"; + WebElement paragraph1Editor = driver.findElement(By.xpath(getParagraphXPath(1) + "//textarea")); + paragraph1Editor.sendKeys("println" + Keys.chord(Keys.SHIFT, "9") + "\"" + + "abcd\")"); + collector.checkThat("Before Run Output field contains ", + driver.findElement(By.xpath(xpathToOutputField)).getText(), + CoreMatchers.equalTo("")); + driver.findElement(By.xpath(getParagraphXPath(1) + "//span[@ng-click='runParagraph(getEditorValue())']")).click(); + waitForParagraph(1, "FINISHED"); + collector.checkThat("After Run Output field contains ", + driver.findElement(By.xpath(xpathToOutputField)).getText(), + CoreMatchers.equalTo("abcd")); + driver.findElement(By.xpath(getParagraphXPath(1) + "//span[@class='icon-settings']")).click(); + driver.findElement(By.xpath(getParagraphXPath(1) + "//ul/li/a[@ng-click='clearParagraphOutput()']")).click(); + collector.checkThat("After Clear Output field contains ", + driver.findElement(By.xpath(xpathToOutputField)).getText(), + CoreMatchers.equalTo("")); + ZeppelinITUtils.sleep(1000, false); + deleteTestNotebook(driver); + + } catch (Exception e) { + handleException("Exception in ParagraphActionsIT while testClearOutputButton ",e); + } + + } } \ No newline at end of file
