diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 2f99846e696..7eecf57638d 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -149,29 +149,11 @@ jobs: defaults: run: shell: bash -l {0} - env: - ZEPPELIN_SELENIUM_BROWSER: "edge" steps: - name: Checkout uses: actions/checkout@v4 - name: Tune Runner VM uses: ./.github/actions/tune-runner-vm - - name: Install Microsoft Edge - run: | - curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-edge.gpg - echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft-edge.gpg] https://packages.microsoft.com/repos/edge stable main" | sudo tee /etc/apt/sources.list.d/microsoft-edge.list - sudo apt-get update - sudo apt-get install -y microsoft-edge-stable - - name: Install msedgedriver - run: | - EDGE_VERSION=$(microsoft-edge --version | awk '{print $3}') - wget -q "https://msedgedriver.microsoft.com/${EDGE_VERSION}/edgedriver_linux64.zip" -O edgedriver.zip - unzip -q edgedriver.zip - sudo mv msedgedriver /usr/local/bin/ - sudo chmod +x /usr/local/bin/msedgedriver - rm edgedriver.zip - - name: Print Edge version - run: msedgedriver --version - name: Set up JDK 11 uses: actions/setup-java@v4 with: diff --git a/zeppelin-integration/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java b/zeppelin-integration/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java index cfffe5051d4..6d2746eeab9 100644 --- a/zeppelin-integration/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java +++ b/zeppelin-integration/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java @@ -18,12 +18,10 @@ package org.apache.zeppelin; -import com.google.common.base.Function; import java.io.File; import java.net.URI; import java.net.URISyntaxException; import java.time.Duration; -import java.time.temporal.ChronoUnit; import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.FileUtils; import org.openqa.selenium.By; @@ -38,8 +36,6 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.FluentWait; -import org.openqa.selenium.support.ui.Wait; import org.openqa.selenium.support.ui.WebDriverWait; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,15 +51,13 @@ abstract public class AbstractZeppelinIT { protected static final long MAX_PARAGRAPH_TIMEOUT_SEC = 120; protected void authenticationUser(String userName, String password) { - pollingWait( + clickableWait( By.xpath("//div[contains(@class, 'navbar-collapse')]//li//button[contains(.,'Login')]"), MAX_BROWSER_TIMEOUT_SEC).click(); - ZeppelinITUtils.sleep(1000, false); - - pollingWait(By.xpath("//*[@id='userName']"), MAX_BROWSER_TIMEOUT_SEC).sendKeys(userName); - pollingWait(By.xpath("//*[@id='password']"), MAX_BROWSER_TIMEOUT_SEC).sendKeys(password); - pollingWait( + visibilityWait(By.xpath("//*[@id='userName']"), MAX_BROWSER_TIMEOUT_SEC).sendKeys(userName); + visibilityWait(By.xpath("//*[@id='password']"), MAX_BROWSER_TIMEOUT_SEC).sendKeys(password); + clickableWait( By.xpath("//*[@id='loginModalContent']//button[contains(.,'Login')]"), MAX_BROWSER_TIMEOUT_SEC).click(); @@ -132,7 +126,7 @@ protected static String getNoteFormsXPath() { protected boolean waitForParagraph(final int paragraphNo, final String state) { By locator = By.xpath(getParagraphXPath(paragraphNo) + "//div[contains(@class, 'control')]//span[2][contains(.,'" + state + "')]"); - WebElement element = pollingWait(locator, MAX_PARAGRAPH_TIMEOUT_SEC); + WebElement element = visibilityWait(locator, MAX_PARAGRAPH_TIMEOUT_SEC); return element.isDisplayed(); } @@ -145,7 +139,7 @@ protected String getParagraphStatus(final int paragraphNo) { protected boolean waitForText(final String txt, final By locator) { try { - WebElement element = pollingWait(locator, MAX_BROWSER_TIMEOUT_SEC); + WebElement element = visibilityWait(locator, MAX_BROWSER_TIMEOUT_SEC); return txt.equals(element.getText()); } catch (TimeoutException e) { return false; @@ -153,12 +147,21 @@ protected boolean waitForText(final String txt, final By locator) { } protected WebElement pollingWait(final By locator, final long timeWait) { - Wait wait = new FluentWait<>(manager.getWebDriver()) - .withTimeout(Duration.of(timeWait, ChronoUnit.SECONDS)) - .pollingEvery(Duration.of(1, ChronoUnit.SECONDS)) - .ignoring(NoSuchElementException.class); + WebDriverWait wait = new WebDriverWait(manager.getWebDriver(), + Duration.ofSeconds(timeWait)); + return wait.until(ExpectedConditions.presenceOfElementLocated(locator)); + } + + protected WebElement visibilityWait(final By locator, final long timeWait) { + WebDriverWait wait = new WebDriverWait(manager.getWebDriver(), + Duration.ofSeconds(timeWait)); + return wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); + } - return wait.until((Function) driver -> driver.findElement(locator)); + protected WebElement clickableWait(final By locator, final long timeWait) { + WebDriverWait wait = new WebDriverWait(manager.getWebDriver(), + Duration.ofSeconds(timeWait)); + return wait.until(ExpectedConditions.elementToBeClickable(locator)); } protected void createNewNote() { @@ -193,7 +196,7 @@ protected void deleteTrashNotebook(final WebDriver driver) { } protected void clickAndWait(final By locator) { - WebElement element = pollingWait(locator, MAX_IMPLICIT_WAIT); + WebElement element = clickableWait(locator, MAX_IMPLICIT_WAIT); try { element.click(); ZeppelinITUtils.sleep(1000, false); diff --git a/zeppelin-integration/src/test/java/org/apache/zeppelin/WebDriverManager.java b/zeppelin-integration/src/test/java/org/apache/zeppelin/WebDriverManager.java index f2e1c91d808..a6aa0341a2b 100644 --- a/zeppelin-integration/src/test/java/org/apache/zeppelin/WebDriverManager.java +++ b/zeppelin-integration/src/test/java/org/apache/zeppelin/WebDriverManager.java @@ -30,6 +30,7 @@ import org.apache.commons.lang3.SystemUtils; import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; import org.openqa.selenium.TimeoutException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; @@ -84,6 +85,12 @@ private WebDriver constructWebDriver(int port) { Supplier chromeDriverSupplier = () -> { try { ChromeOptions options = new ChromeOptions(); + options.addArguments("--disable-search-engine-choice-screen"); + options.setExperimentalOption("prefs", Map.of( + "credentials_enable_service", false, + "profile.password_manager_enabled", false, + "profile.password_manager_leak_detection", false + )); return new ChromeDriver(options); } catch (Exception e) { LOG.error("Exception in WebDriverManager while ChromeDriver ", e); @@ -169,7 +176,8 @@ public Boolean apply(WebDriver d) { assertTrue(loaded); try { - driver.manage().window().maximize(); + // Manually setting fixed window size since `maximize()` crashes for Chrome/Edge driver on linux with xvfb. + driver.manage().window().setSize(new Dimension(1920, 1080)); } catch (Exception e) { LOG.warn("Failed to maximize browser window. Consider using setSize() instead.", e); } diff --git a/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java b/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java index 64713b8062a..0eb414327e2 100644 --- a/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java +++ b/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java @@ -109,11 +109,11 @@ void testAnyOfRolesUser() throws Exception { try { authenticationUser("admin", "password1"); - pollingWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), + clickableWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), MAX_BROWSER_TIMEOUT_SEC).click(); clickAndWait(By.xpath("//li/a[contains(@href, '#/interpreter')]")); - assertTrue(pollingWait(By.xpath( + assertTrue(visibilityWait(By.xpath( "//div[@id='main']/div/div[2]"), MIN_IMPLICIT_WAIT).isDisplayed(), "Check is user has permission to view this page"); @@ -121,25 +121,25 @@ void testAnyOfRolesUser() throws Exception { authenticationUser("finance1", "finance1"); - pollingWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), + clickableWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), MAX_BROWSER_TIMEOUT_SEC).click(); clickAndWait(By.xpath("//li/a[contains(@href, '#/interpreter')]")); assertTrue( - pollingWait(By.xpath("//div[@id='main']/div/div[2]"), MIN_IMPLICIT_WAIT).isDisplayed(), + visibilityWait(By.xpath("//div[@id='main']/div/div[2]"), MIN_IMPLICIT_WAIT).isDisplayed(), "Check is user has permission to view this page"); logoutUser("finance1"); authenticationUser("hr1", "hr1"); - pollingWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), + clickableWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), MAX_BROWSER_TIMEOUT_SEC).click(); clickAndWait(By.xpath("//li/a[contains(@href, '#/interpreter')]")); try { assertTrue( - pollingWait(By.xpath("//li[contains(@class, 'ng-toast__message')]//span/span"), + visibilityWait(By.xpath("//li[contains(@class, 'ng-toast__message')]//span/span"), MIN_IMPLICIT_WAIT).isDisplayed(), "Check is user has permission to view this page"); } catch (TimeoutException e) { @@ -161,27 +161,27 @@ void testGroupPermission() throws Exception { String noteId = manager.getWebDriver().getCurrentUrl() .substring(manager.getWebDriver().getCurrentUrl().lastIndexOf("/") + 1); - pollingWait(By.xpath("//span[@uib-tooltip='Note permissions']"), + clickableWait(By.xpath("//span[@uib-tooltip='Note permissions']"), MAX_BROWSER_TIMEOUT_SEC).click(); - pollingWait(By.xpath(".//*[@id='selectOwners']/following::span//input"), + visibilityWait(By.xpath(".//*[@id='selectOwners']/following::span//input"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("finance "); - pollingWait(By.xpath(".//*[@id='selectReaders']/following::span//input"), + visibilityWait(By.xpath(".//*[@id='selectReaders']/following::span//input"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("finance "); - pollingWait(By.xpath(".//*[@id='selectRunners']/following::span//input"), + visibilityWait(By.xpath(".//*[@id='selectRunners']/following::span//input"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("finance "); - pollingWait(By.xpath(".//*[@id='selectWriters']/following::span//input"), + visibilityWait(By.xpath(".//*[@id='selectWriters']/following::span//input"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("finance "); - pollingWait(By.xpath("//button[@ng-click='savePermissions()']"), MAX_BROWSER_TIMEOUT_SEC) + visibilityWait(By.xpath("//button[@ng-click='savePermissions()']"), MAX_BROWSER_TIMEOUT_SEC) .sendKeys(Keys.ENTER); - pollingWait(By.xpath("//div[@class='modal-dialog'][contains(.,'Permissions Saved ')]" + + clickableWait(By.xpath("//div[@class='modal-dialog'][contains(.,'Permissions Saved ')]" + "//div[@class='modal-footer']//button[contains(.,'OK')]"), MAX_BROWSER_TIMEOUT_SEC).click(); logoutUser("finance1"); authenticationUser("hr1", "hr1"); try { - WebElement element = pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), + WebElement element = visibilityWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC); assertFalse(element.isDisplayed(), "Check is user has permission to view this note link"); } catch (Exception e) { @@ -202,7 +202,7 @@ void testGroupPermission() throws Exception { authenticationUser("finance2", "finance2"); try { - WebElement element = pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), + WebElement element = visibilityWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC); assertTrue(element.isDisplayed(), "Check is user has permission to view this note link"); } catch (Exception e) { diff --git a/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/InterpreterModeActionsIT.java b/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/InterpreterModeActionsIT.java index 35b98046c39..2dfb87d2e0b 100644 --- a/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/InterpreterModeActionsIT.java +++ b/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/InterpreterModeActionsIT.java @@ -111,10 +111,10 @@ void testGloballyAction() throws Exception { try { //step 1: (admin) login, set 'globally in shared' mode of python interpreter, logout authenticationUser("admin", "password1"); - pollingWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), + clickableWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), MAX_BROWSER_TIMEOUT_SEC).click(); clickAndWait(By.xpath("//li/a[contains(@href, '#/interpreter')]")); - pollingWait(By.xpath("//input[contains(@ng-model, 'searchInterpreter')]"), + visibilityWait(By.xpath("//input[contains(@ng-model, 'searchInterpreter')]"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("python"); ZeppelinITUtils.sleep(500, false); clickAndWait(By.xpath("//div[contains(@id, 'python')]//button[contains(@ng-click, 'valueform.$show();\n" + @@ -206,7 +206,7 @@ void testGloballyAction() throws Exception { (new WebDriverWait(manager.getWebDriver(), Duration.ofSeconds(MAX_BROWSER_TIMEOUT_SEC))) .until(ExpectedConditions.visibilityOfElementLocated(locator)); if (element.isDisplayed()) { - pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user1noteId + "')]"), + clickableWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user1noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click(); } waitForParagraph(2, "FINISHED"); @@ -265,11 +265,11 @@ void testPerUserScopedAction() throws Exception { try { //step 1: (admin) login, set 'Per user in scoped' mode of python interpreter, logout authenticationUser("admin", "password1"); - pollingWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), + clickableWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), MAX_BROWSER_TIMEOUT_SEC).click(); clickAndWait(By.xpath("//li/a[contains(@href, '#/interpreter')]")); - pollingWait(By.xpath("//input[contains(@ng-model, 'searchInterpreter')]"), + visibilityWait(By.xpath("//input[contains(@ng-model, 'searchInterpreter')]"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("python"); ZeppelinITUtils.sleep(500, false); @@ -370,7 +370,7 @@ void testPerUserScopedAction() throws Exception { (new WebDriverWait(manager.getWebDriver(), Duration.ofSeconds(MAX_BROWSER_TIMEOUT_SEC))) .until(ExpectedConditions.visibilityOfElementLocated(locator)); if (element.isDisplayed()) { - pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user1noteId + "')]"), + clickableWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user1noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click(); } runParagraph(2); @@ -467,7 +467,7 @@ void testPerUserScopedAction() throws Exception { (new WebDriverWait(manager.getWebDriver(), Duration.ofSeconds(MAX_BROWSER_TIMEOUT_SEC))) .until(ExpectedConditions.visibilityOfElementLocated(locator)); if (element.isDisplayed()) { - pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user1noteId + "')]"), + clickableWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user1noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click(); } waitForParagraph(1, "FINISHED"); @@ -486,7 +486,7 @@ void testPerUserScopedAction() throws Exception { (new WebDriverWait(manager.getWebDriver(), Duration.ofSeconds(MAX_BROWSER_TIMEOUT_SEC))) .until(ExpectedConditions.visibilityOfElementLocated(locator)); if (element.isDisplayed()) { - pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user2noteId + "')]"), + clickableWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user2noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click(); } runParagraph(1); @@ -510,11 +510,11 @@ void testPerUserScopedAction() throws Exception { //System: Check if the number of python interpreter process is 0 //System: Check if the number of python process is 0 authenticationUser("admin", "password1"); - pollingWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), + clickableWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), MAX_BROWSER_TIMEOUT_SEC).click(); clickAndWait(By.xpath("//li/a[contains(@href, '#/interpreter')]")); - pollingWait(By.xpath("//input[contains(@ng-model, 'searchInterpreter')]"), + visibilityWait(By.xpath("//input[contains(@ng-model, 'searchInterpreter')]"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("python"); ZeppelinITUtils.sleep(500, false); @@ -553,10 +553,10 @@ void testPerUserIsolatedAction() throws Exception { try { //step 1: (admin) login, set 'Per user in isolated' mode of python interpreter, logout authenticationUser("admin", "password1"); - pollingWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), + clickableWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), MAX_BROWSER_TIMEOUT_SEC).click(); clickAndWait(By.xpath("//li/a[contains(@href, '#/interpreter')]")); - pollingWait(By.xpath("//input[contains(@ng-model, 'searchInterpreter')]"), + visibilityWait(By.xpath("//input[contains(@ng-model, 'searchInterpreter')]"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("python"); ZeppelinITUtils.sleep(500, false); clickAndWait(By.xpath("//div[contains(@id, 'python')]//button[contains(@ng-click, 'valueform.$show();\n" + @@ -653,7 +653,7 @@ void testPerUserIsolatedAction() throws Exception { (new WebDriverWait(manager.getWebDriver(), Duration.ofSeconds(MAX_BROWSER_TIMEOUT_SEC))) .until(ExpectedConditions.visibilityOfElementLocated(locator)); if (element.isDisplayed()) { - pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user1noteId + "')]"), + clickableWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user1noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click(); } runParagraph(2); @@ -752,7 +752,7 @@ void testPerUserIsolatedAction() throws Exception { (new WebDriverWait(manager.getWebDriver(), Duration.ofSeconds(MAX_BROWSER_TIMEOUT_SEC))) .until(ExpectedConditions.visibilityOfElementLocated(locator)); if (element.isDisplayed()) { - pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user1noteId + "')]"), + clickableWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user1noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click(); } waitForParagraph(1, "FINISHED"); @@ -771,7 +771,7 @@ void testPerUserIsolatedAction() throws Exception { (new WebDriverWait(manager.getWebDriver(), Duration.ofSeconds(MAX_BROWSER_TIMEOUT_SEC))) .until(ExpectedConditions.visibilityOfElementLocated(locator)); if (element.isDisplayed()) { - pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user2noteId + "')]"), + clickableWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + user2noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click(); } runParagraph(1); @@ -795,11 +795,11 @@ void testPerUserIsolatedAction() throws Exception { //System: Check if the number of python interpreter process is 0 //System: Check if the number of python process is 0 authenticationUser("admin", "password1"); - pollingWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), + clickableWait(By.xpath("//div/button[contains(@class, 'nav-btn dropdown-toggle ng-scope')]"), MAX_BROWSER_TIMEOUT_SEC).click(); clickAndWait(By.xpath("//li/a[contains(@href, '#/interpreter')]")); - pollingWait(By.xpath("//input[contains(@ng-model, 'searchInterpreter')]"), + visibilityWait(By.xpath("//input[contains(@ng-model, 'searchInterpreter')]"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("python"); ZeppelinITUtils.sleep(500, false); diff --git a/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/PersonalizeActionsIT.java b/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/PersonalizeActionsIT.java index bc4e0277c01..ea3ad80e319 100644 --- a/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/PersonalizeActionsIT.java +++ b/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/PersonalizeActionsIT.java @@ -117,7 +117,7 @@ void testSimpleAction() throws Exception { .findElement( By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'markdown-body')]")) .getText()); - pollingWait(By.xpath("//*[@id='actionbar']" + + clickableWait(By.xpath("//*[@id='actionbar']" + "//button[contains(@uib-tooltip, 'Switch to personal mode')]"), MAX_BROWSER_TIMEOUT_SEC).click(); clickAndWait(By.xpath("//div[@class='modal-dialog'][contains(.,'Do you want to personalize your analysis?')" + "]//div[@class='modal-footer']//button[contains(.,'OK')]")); @@ -129,7 +129,7 @@ void testSimpleAction() throws Exception { wait = new WebDriverWait(manager.getWebDriver(), Duration.ofSeconds(MAX_BROWSER_TIMEOUT_SEC)); element = wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); if (element.isDisplayed()) { - pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), + clickableWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click(); } assertEquals("Switch to personal mode (owner can change)", @@ -149,7 +149,7 @@ void testSimpleAction() throws Exception { locator = By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"); element = wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); if (element.isDisplayed()) { - pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click(); + clickableWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click(); } waitForParagraph(1, "FINISHED"); setParagraphText("After"); @@ -164,7 +164,7 @@ void testSimpleAction() throws Exception { locator = By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"); element = wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); if (element.isDisplayed()) { - pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click(); + clickableWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click(); } assertEquals("Before", manager.getWebDriver() .findElement( @@ -205,12 +205,12 @@ void testGraphAction() throws Exception { "Exception in PersonalizeActionsIT while testGraphAction, status of 1st Spark Paragraph "); } - pollingWait(By.xpath("//*[@id='actionbar']" + + clickableWait(By.xpath("//*[@id='actionbar']" + "//button[contains(@uib-tooltip, 'Switch to personal mode')]"), MAX_BROWSER_TIMEOUT_SEC).click(); clickAndWait(By.xpath("//div[@class='modal-dialog'][contains(.,'Do you want to personalize your analysis?')" + "]//div[@class='modal-footer']//button[contains(.,'OK')]")); - pollingWait(By.xpath(getParagraphXPath(1) + + clickableWait(By.xpath(getParagraphXPath(1) + "//button[contains(@uib-tooltip, 'Bar Chart')]"), MAX_BROWSER_TIMEOUT_SEC).click(); assertEquals("fa fa-bar-chart", manager.getWebDriver().findElement(By.xpath(getParagraphXPath(1) @@ -226,7 +226,7 @@ void testGraphAction() throws Exception { locator = By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"); element = wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); if (element.isDisplayed()) { - pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), + clickableWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click(); } assertEquals("Switch to personal mode (owner can change)", @@ -238,7 +238,7 @@ void testGraphAction() throws Exception { + "//button[contains(@class," + "'btn btn-default btn-sm ng-binding ng-scope active')]//i")).getAttribute("class")); - pollingWait(By.xpath(getParagraphXPath(1) + + clickableWait(By.xpath(getParagraphXPath(1) + "//button[contains(@uib-tooltip, 'Table')]"), MAX_BROWSER_TIMEOUT_SEC).click(); ZeppelinITUtils.sleep(1000, false); assertEquals("fa fa-table", manager.getWebDriver().findElement(By.xpath(getParagraphXPath(1) @@ -252,7 +252,7 @@ void testGraphAction() throws Exception { locator = By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"); element = wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); if (element.isDisplayed()) { - pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), + clickableWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click(); } assertEquals("fa fa-bar-chart", @@ -293,7 +293,7 @@ void testDynamicFormAction() throws Exception { assertEquals("Before", manager.getWebDriver().findElement(By.xpath(getParagraphXPath(1) + "//input[contains(@name, 'name')]")).getAttribute("value")); - pollingWait(By.xpath("//*[@id='actionbar']" + + clickableWait(By.xpath("//*[@id='actionbar']" + "//button[contains(@uib-tooltip, 'Switch to personal mode')]"), MAX_BROWSER_TIMEOUT_SEC).click(); clickAndWait(By.xpath("//div[@class='modal-dialog'][contains(.,'Do you want to personalize your analysis?')" + "]//div[@class='modal-footer']//button[contains(.,'OK')]")); @@ -305,7 +305,7 @@ void testDynamicFormAction() throws Exception { locator = By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"); element = wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); if (element.isDisplayed()) { - pollingWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), + clickableWait(By.xpath("//*[@id='notebook-names']//a[contains(@href, '" + noteId + "')]"), MAX_BROWSER_TIMEOUT_SEC).click(); } assertEquals("Switch to personal mode (owner can change)", @@ -316,9 +316,9 @@ void testDynamicFormAction() throws Exception { assertEquals("Before", manager.getWebDriver().findElement(By.xpath(getParagraphXPath(1) + "//input[contains(@name, 'name')]")).getAttribute("value")); - pollingWait(By.xpath(getParagraphXPath(1) + + visibilityWait(By.xpath(getParagraphXPath(1) + "//input[contains(@name, 'name')]"), MAX_BROWSER_TIMEOUT_SEC).clear(); - pollingWait(By.xpath(getParagraphXPath(1) + + visibilityWait(By.xpath(getParagraphXPath(1) + "//input[contains(@name, 'name')]"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("After"); runParagraph(1); diff --git a/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java b/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java index 4d94ce69c71..003f7cc5376 100644 --- a/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java +++ b/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java @@ -236,7 +236,7 @@ void testSparkInterpreterDependencyLoading() throws Exception { manager.getWebDriver().findElement(By.xpath("//div[@id='spark']//button[contains(.,'edit')]")) .sendKeys(Keys.ENTER); - WebElement depArtifact = pollingWait(By.xpath("//input[@ng-model='setting.depArtifact']"), + WebElement depArtifact = visibilityWait(By.xpath("//input[@ng-model='setting.depArtifact']"), MAX_BROWSER_TIMEOUT_SEC); String artifact = "org.apache.commons:commons-csv:1.1"; depArtifact.sendKeys(artifact); @@ -279,7 +279,7 @@ void testSparkInterpreterDependencyLoading() throws Exception { interpreterLink.click(); manager.getWebDriver().findElement(By.xpath("//div[@id='spark']//button[contains(.,'edit')]")) .sendKeys(Keys.ENTER); - WebElement testDepRemoveBtn = pollingWait(By.xpath("//tr[descendant::text()[contains(.,'" + + WebElement testDepRemoveBtn = visibilityWait(By.xpath("//tr[descendant::text()[contains(.,'" + artifact + "')]]/td[3]/button"), MAX_IMPLICIT_WAIT); testDepRemoveBtn.sendKeys(Keys.ENTER); manager.getWebDriver().findElement(By.xpath("//div[@id='spark']//form//button[1]")).click();