Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master 34734b9c8 -> f8bc54b83


ZEPPELIN-928: fix flaky ZeppelinIT test for Spark interpreter

### What is this PR for?
Fix flaky Integration Test by adding new id to HTML (as of HTML5 it can be [any 
non-empty 
string](https://html.spec.whatwg.org/multipage/dom.html#the-id-attribute)) and 
liverage it in tests for simpler XPath statements that pick only 1 candidate.

### TODO
 - [x] fix test
 - [x] update New Interpreter form validation and error message

### What type of PR is it?
Bug Fix

### What is the Jira issue?
[ZEPPELIN-928](https://issues.apache.org/jira/browse/ZEPPELIN-928)

### How should this be tested?
CI should pass

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

Author: Alexander Bezzubov <[email protected]>

Closes #939 from bzz/fix/ZEPPELIN-928 and squashes the following commits:

9bcba08 [Alexander Bezzubov] Interpreter creation: add ID to the HTML and 
update Integration tests to use simple xpath
8744834 [Alexander Bezzubov] New Interpreter validation: prohibit whitespace 
names and correct error msg


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

Branch: refs/heads/master
Commit: f8bc54b833bf6ea4bfe93e414db2bf00c82a1f4c
Parents: 34734b9
Author: Alexander Bezzubov <[email protected]>
Authored: Tue May 31 20:20:04 2016 +0900
Committer: Alexander Bezzubov <[email protected]>
Committed: Wed Jun 1 09:01:22 2016 +0900

----------------------------------------------------------------------
 .../java/org/apache/zeppelin/integration/ZeppelinIT.java     | 8 ++++----
 .../interpreter/interpreter-create/interpreter-create.html   | 2 +-
 zeppelin-web/src/app/interpreter/interpreter.controller.js   | 5 +++--
 zeppelin-web/src/app/interpreter/interpreter.html            | 2 +-
 4 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/f8bc54b8/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java 
b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java
index e2f2d1f..4ec3ee0 100644
--- 
a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java
+++ 
b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java
@@ -200,13 +200,13 @@ public class ZeppelinIT extends AbstractZeppelinIT {
       interpreterLink.click();
 
       // add new dependency to spark interpreter
-      
driver.findElement(By.xpath("//div[h3[text()[contains(.,'spark')]]]//button[contains(.,'edit')]")).sendKeys(Keys.ENTER);
+      
driver.findElement(By.xpath("//div[@id='spark']//button[contains(.,'edit')]")).sendKeys(Keys.ENTER);
 
       WebElement depArtifact = 
pollingWait(By.xpath("//input[@ng-model='setting.depArtifact']"),
           MAX_BROWSER_TIMEOUT_SEC);
       String artifact = "org.apache.commons:commons-csv:1.1";
       depArtifact.sendKeys(artifact);
-      
driver.findElement(By.xpath("//div[contains(@class,'box')][contains(.,'%spark')]//form//button[1]")).click();
+      
driver.findElement(By.xpath("//div[@id='spark']//form//button[1]")).click();
       driver.findElement(By.xpath("//div[@class='modal-dialog'][contains(.,'Do 
you want to update this interpreter and restart with new settings?')]" +
           "//div[@class='modal-footer']//button[contains(.,'OK')]")).click();
 
@@ -236,11 +236,11 @@ public class ZeppelinIT extends AbstractZeppelinIT {
 
       // reset dependency
       interpreterLink.click();
-      
driver.findElement(By.xpath("//div[h3[text()[contains(.,'spark')]]]//button[contains(.,'edit')]")).sendKeys(Keys.ENTER);
+      
driver.findElement(By.xpath("//div[@id='spark']//button[contains(.,'edit')]")).sendKeys(Keys.ENTER);
       WebElement testDepRemoveBtn = 
pollingWait(By.xpath("//tr[descendant::text()[contains(.,'" +
           artifact + "')]]/td[3]/div"), MAX_IMPLICIT_WAIT);
       testDepRemoveBtn.click();
-      
driver.findElement(By.xpath("//div[contains(@class,'box')][contains(.,'%spark')]//form//button[1]")).click();
+      
driver.findElement(By.xpath("//div[@id='spark']//form//button[1]")).click();
       driver.findElement(By.xpath("//div[@class='modal-dialog'][contains(.,'Do 
you want to update this interpreter and restart with new settings?')]" +
           "//div[@class='modal-footer']//button[contains(.,'OK')]")).click();
     } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/f8bc54b8/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html
----------------------------------------------------------------------
diff --git 
a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html 
b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html
index 651676f..c46c1d1 100644
--- 
a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html
+++ 
b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html
@@ -24,7 +24,7 @@ limitations under the License.
                  pu-elastic-input-minwidth="180px" 
ng-model="newInterpreterSetting.name" />
         </div>
 
-        <b>Interpreter</b>
+        <b>Interpreter group</b>
         <div class="form-group"
              style="width:180px">
           <select class="form-control input-sm" 
ng-model="newInterpreterSetting.group"

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/f8bc54b8/zeppelin-web/src/app/interpreter/interpreter.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js 
b/zeppelin-web/src/app/interpreter/interpreter.controller.js
index 58b2d06..5d561a7 100644
--- a/zeppelin-web/src/app/interpreter/interpreter.controller.js
+++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js
@@ -212,11 +212,12 @@ 
angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope,
   };
 
   $scope.addNewInterpreterSetting = function() {
-    if (!$scope.newInterpreterSetting.name || 
!$scope.newInterpreterSetting.group) {
+    //user input validation on interpreter creation
+    if (!$scope.newInterpreterSetting.name.trim() || 
!$scope.newInterpreterSetting.group) {
       BootstrapDialog.alert({
         closable: true,
         title: 'Add interpreter',
-        message: 'Please determine name and interpreter'
+        message: 'Please fill in interpreter name and choose a group'
       });
       return;
     }

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/f8bc54b8/zeppelin-web/src/app/interpreter/interpreter.html
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/interpreter/interpreter.html 
b/zeppelin-web/src/app/interpreter/interpreter.html
index 95fc320..91fa277 100644
--- a/zeppelin-web/src/app/interpreter/interpreter.html
+++ b/zeppelin-web/src/app/interpreter/interpreter.html
@@ -88,7 +88,7 @@ limitations under the License.
 
 <div class="box width-full home"
      ng-repeat="setting in interpreterSettings | orderBy: 'group' | filter: 
searchInterpreter">
-  <div>
+  <div id="{{setting.name | lowercase}}">
     <div class="row interpreter">
       <div class="col-md-12">
         <h3 class="interpreter-title">{{setting.name}}

Reply via email to