From 3c81587c15a8c14f0db3beabbf5233e4e53591d5 Mon Sep 17 00:00:00 2001 From: Prabhjyot Singh Date: Tue, 20 Sep 2016 14:53:08 +0530 Subject: [PATCH] ZEPPELIN-1456: fix --- .../integration/AuthenticationIT.java | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java index ea3f3637537..60014298566 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java @@ -36,6 +36,7 @@ import java.io.File; import java.io.IOException; +import java.net.URI; import java.util.List; @@ -176,8 +177,16 @@ public void testGroupPermission() throws Exception { authenticationIT.logoutUser("finance1"); authenticationIT.authenticationUser("hr1", "hr1"); - pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), - MAX_BROWSER_TIMEOUT_SEC).click(); + try { + WebElement element = pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), + MAX_BROWSER_TIMEOUT_SEC); + collector.checkThat("Check is user has permission to view this notebook link", false, + CoreMatchers.equalTo(element.isDisplayed())); + } catch (Exception e) { + //This should have failed, nothing to worry. + } + + driver.get(new URI(driver.getCurrentUrl()).resolve("/#/notebook/" + noteId).toString()); List privilegesModal = driver.findElements( By.xpath("//div[@class='modal-content']//div[@class='bootstrap-dialog-header']" + @@ -190,8 +199,16 @@ public void testGroupPermission() throws Exception { authenticationIT.logoutUser("hr1"); authenticationIT.authenticationUser("finance2", "finance2"); - pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), - MAX_BROWSER_TIMEOUT_SEC).click(); + try { + WebElement element = pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), + MAX_BROWSER_TIMEOUT_SEC); + collector.checkThat("Check is user has permission to view this notebook link", false, + CoreMatchers.equalTo(element.isDisplayed())); + } catch (Exception e) { + //This should have failed, nothing to worry. + } + + driver.get(new URI(driver.getCurrentUrl()).resolve("/#/notebook/" + noteId).toString()); privilegesModal = driver.findElements( By.xpath("//div[@class='modal-content']//div[@class='bootstrap-dialog-header']" +