You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by jo...@apache.org on 2017/01/12 06:29:13 UTC

zeppelin git commit: [MINOR] Small Selenium test fixes

Repository: zeppelin
Updated Branches:
  refs/heads/master d393a5b52 -> 434215668


[MINOR] Small Selenium test fixes

### What is this PR for?
Remove unused imports;
Replace "Thread.sleep" (unstable solution);
Add "deleteTestNotebook()" method  -> testWidth.

### What type of PR is it?
[Refactoring]

### Todos
* [ ] - Task

### What is the Jira issue?
* Open an issue on Jira https://issues.apache.org/jira/browse/ZEPPELIN/
* Put link here, and add [ZEPPELIN-*Jira number*] in PR title, eg. [ZEPPELIN-533]

### How should this be tested?
Travis-CI

### Screenshots (if appropriate)
https://travis-ci.org/apache/zeppelin/builds/190644901 -> https://travis-ci.org/apache/zeppelin/jobs/190644918

### Questions:
* Does the licenses files need update? (no)
* Is there breaking changes for older versions? (no)
* Does this needs documentation? (no)

Author: Unknown <So...@gmail.com>

Closes #1882 from bitchelov/automationTestFix and squashes the following commits:

f898c59 [Unknown] [MINOR] Small Selenium test fixes


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/43421566
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/43421566
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/43421566

Branch: refs/heads/master
Commit: 434215668e9db51706230420f8ce2c1c268b2457
Parents: d393a5b
Author: Unknown <So...@gmail.com>
Authored: Tue Jan 10 17:03:03 2017 +0300
Committer: Jongyoul Lee <jo...@apache.org>
Committed: Thu Jan 12 15:29:04 2017 +0900

----------------------------------------------------------------------
 .../java/org/apache/zeppelin/AbstractZeppelinIT.java     | 11 +++--------
 .../apache/zeppelin/integration/ParagraphActionsIT.java  |  8 +-------
 2 files changed, 4 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/43421566/zeppelin-server/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java b/zeppelin-server/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java
index 645109c..f849868 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java
@@ -34,8 +34,6 @@ import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 abstract public class AbstractZeppelinIT {
@@ -111,17 +109,14 @@ abstract public class AbstractZeppelinIT {
     WebDriverWait block = new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC);
     block.until(ExpectedConditions.visibilityOfElementLocated(By.id("noteNameModal")));
     clickAndWait(By.id("createNoteButton"));
-
-    try {
-      Thread.sleep(500); // wait for notebook list updated
-    } catch (InterruptedException e) {
-    }
+    block.until(ExpectedConditions.invisibilityOfElementLocated(By.className("pull-right")));
   }
 
   protected void deleteTestNotebook(final WebDriver driver) {
+    WebDriverWait block = new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC);
     driver.findElement(By.xpath(".//*[@id='main']//button[@ng-click='moveNoteToTrash(note.id)']"))
         .sendKeys(Keys.ENTER);
-    ZeppelinITUtils.sleep(1000, true);
+    block.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//*[@id='main']//button[@ng-click='moveNoteToTrash(note.id)']")));
     driver.findElement(By.xpath("//div[@class='modal-dialog'][contains(.,'This note will be moved to trash')]" +
         "//div[@class='modal-footer']//button[contains(.,'OK')]")).click();
     ZeppelinITUtils.sleep(100, true);

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/43421566/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 d93a6e5..feade7f 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
@@ -123,7 +123,6 @@ public class ParagraphActionsIT extends AbstractZeppelinIT {
           driver.findElements(By.xpath("//div[@ng-controller=\"ParagraphCtrl\"]")).size(),
           CoreMatchers.equalTo(3));
 
-      ZeppelinITUtils.sleep(1000, false);
       deleteTestNotebook(driver);
 
     } catch (Exception e) {
@@ -162,7 +161,6 @@ public class ParagraphActionsIT extends AbstractZeppelinIT {
       collector.checkThat("After Remove : Number of paragraphs are",
           newNosOfParas,
           CoreMatchers.equalTo(oldNosOfParas - 1));
-      ZeppelinITUtils.sleep(1000, false);
       deleteTestNotebook(driver);
 
     } catch (Exception e) {
@@ -215,7 +213,6 @@ public class ParagraphActionsIT extends AbstractZeppelinIT {
       collector.checkThat("The paragraph1 value contains",
           driver.findElement(By.xpath(getParagraphXPath(2) + "//div[contains(@class, 'editor')]")).getText(),
           CoreMatchers.equalTo("2"));
-      ZeppelinITUtils.sleep(1000, false);
       deleteTestNotebook(driver);
 
     } catch (Exception e) {
@@ -251,7 +248,6 @@ public class ParagraphActionsIT extends AbstractZeppelinIT {
           getParagraphStatus(1), CoreMatchers.equalTo("READY")
       );
 
-
       deleteTestNotebook(driver);
 
     } catch (Exception e) {
@@ -285,7 +281,6 @@ public class ParagraphActionsIT extends AbstractZeppelinIT {
       collector.checkThat("After Clear  Output field contains ",
           driver.findElements(By.xpath(xpathToOutputField)).size(),
           CoreMatchers.equalTo(0));
-      ZeppelinITUtils.sleep(1000, false);
       deleteTestNotebook(driver);
 
     } catch (Exception e) {
@@ -315,6 +310,7 @@ public class ParagraphActionsIT extends AbstractZeppelinIT {
             driver.findElement(By.xpath("//div[contains(@class,'col-md-" + newWidth + "')]")).isDisplayed(),
             CoreMatchers.equalTo(true));
       }
+      deleteTestNotebook(driver);
     } catch (Exception e) {
       handleException("Exception in ParagraphActionsIT while testWidth ", e);
     }
@@ -384,7 +380,6 @@ public class ParagraphActionsIT extends AbstractZeppelinIT {
       collector.checkThat("After Page Refresh : The title field contains ",
           driver.findElement(By.xpath(xpathToTitle)).getText(),
           CoreMatchers.equalTo("NEW TITLE"));
-      ZeppelinITUtils.sleep(1000, false);
       deleteTestNotebook(driver);
 
     } catch (Exception e) {
@@ -434,7 +429,6 @@ public class ParagraphActionsIT extends AbstractZeppelinIT {
       collector.checkThat("After \"Hide line number\" the Line Number is Enabled",
           driver.findElement(By.xpath(xpathToLineNumberField)).isDisplayed(),
           CoreMatchers.equalTo(false));
-      ZeppelinITUtils.sleep(1000, false);
       deleteTestNotebook(driver);
 
     } catch (Exception e) {