From af48cd877b674d1bbdf513dd075b6485e50fa5d1 Mon Sep 17 00:00:00 2001 From: Dmytro Nochevnov Date: Fri, 28 Dec 2018 20:55:28 +0100 Subject: [PATCH] Upgrade version of selenium chrome-node to 3.141.59-dubnium (#12286) * Upgrade version of selenium chromenode to 3.141.59-dubnium * Fix test timeouts to comply with new chrome-node version * Fix NewWorkspacePageTest selenium test * Fix ImportProjectFromGitHubTest, AuthorizeOnGithubFromDashboardTest Signed-off-by: Dmytro Nochevnov --- .../core/webdriver/SeleniumWebDriverHelper.java | 3 +-- selenium/che-selenium-test/docker-compose.yml | 4 ++-- .../che/selenium/pageobject/CodenvyEditor.java | 3 ++- .../dashboard/account/DashboardAccount.java | 5 ++++- .../pageobject/dashboard/workspaces/Workspaces.java | 5 ++++- .../dashboard/ImportProjectFromGitHubTest.java | 7 +++++++ .../dashboard/workspaces/NewWorkspacePageTest.java | 12 ++++++------ .../git/AuthorizeOnGithubFromDashboardTest.java | 6 ++++++ 8 files changed, 32 insertions(+), 13 deletions(-) diff --git a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/webdriver/SeleniumWebDriverHelper.java b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/webdriver/SeleniumWebDriverHelper.java index 21bce21153..93f96cb02c 100644 --- a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/webdriver/SeleniumWebDriverHelper.java +++ b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/webdriver/SeleniumWebDriverHelper.java @@ -1201,8 +1201,7 @@ public class SeleniumWebDriverHelper { public void waitOpenedSomeWin() { webDriverWaitFactory .get(WIDGET_TIMEOUT_SEC) - .until( - (ExpectedCondition) driver -> seleniumWebDriver.getWindowHandles().size() > 1); + .until((ExpectedCondition) driver -> isTwoOrMoreWindowsOpened()); } /** diff --git a/selenium/che-selenium-test/docker-compose.yml b/selenium/che-selenium-test/docker-compose.yml index f8b48ec2b4..49a2b93e22 100644 --- a/selenium/che-selenium-test/docker-compose.yml +++ b/selenium/che-selenium-test/docker-compose.yml @@ -1,7 +1,7 @@ version: '2' services: selenium_hub: - image: selenium/hub:3.14.0-curium + image: selenium/hub:3.141.59-dubnium container_name: selenium_hub ports: - 4444:4444 @@ -20,7 +20,7 @@ services: - selenium_grid_internal chromenode: - image: selenium/node-chrome${NODE_CHROME_DEBUG_SUFFIX}:3.14.0-curium + image: selenium/node-chrome${NODE_CHROME_DEBUG_SUFFIX}:3.141.59-dubnium depends_on: - selenium_hub environment: diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/CodenvyEditor.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/CodenvyEditor.java index d2ec2e3f54..acaef8e173 100644 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/CodenvyEditor.java +++ b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/CodenvyEditor.java @@ -18,6 +18,7 @@ import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ELEME import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC; import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC; import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC; +import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.WIDGET_TIMEOUT_SEC; import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.ACTIVE_LINES_XPATH; import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.ACTIVE_TAB_FILE_NAME; import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.ALL_TABS_XPATH; @@ -487,7 +488,7 @@ public class CodenvyEditor { * @param expectedText text which should be present in the editor */ public void waitTextIntoEditor(final String expectedText) { - waitTextIntoEditor(expectedText, ELEMENT_TIMEOUT_SEC); + waitTextIntoEditor(expectedText, WIDGET_TIMEOUT_SEC); } /** diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/account/DashboardAccount.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/account/DashboardAccount.java index 7d0b2dd46e..76f3ee3521 100644 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/account/DashboardAccount.java +++ b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/account/DashboardAccount.java @@ -12,6 +12,7 @@ package org.eclipse.che.selenium.pageobject.dashboard.account; import static java.util.Arrays.asList; +import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ELEMENT_TIMEOUT_SEC; import static org.eclipse.che.selenium.pageobject.dashboard.account.DashboardAccount.Locators.EDIT_BUTTON; import static org.eclipse.che.selenium.pageobject.dashboard.account.DashboardAccount.Locators.EMAIL_FIELD; import static org.eclipse.che.selenium.pageobject.dashboard.account.DashboardAccount.Locators.FIRST_NAME_FIELD; @@ -80,6 +81,8 @@ public class DashboardAccount { public void waitPageIsLoaded() { asList(EMAIL_FIELD, LOGIN_FIELD, FIRST_NAME_FIELD, LAST_NAME_FIELD, EDIT_BUTTON) - .forEach(locator -> seleniumWebDriverHelper.waitVisibility(By.name(locator))); + .forEach( + locator -> + seleniumWebDriverHelper.waitVisibility(By.name(locator), ELEMENT_TIMEOUT_SEC)); } } diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/workspaces/Workspaces.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/workspaces/Workspaces.java index f73f88eccf..1eb1672571 100644 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/workspaces/Workspaces.java +++ b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/workspaces/Workspaces.java @@ -118,7 +118,10 @@ public class Workspaces { public void waitErrorNotificationContainsText(String expectedText) { final String textAttribute = "che-error-text"; seleniumWebDriverHelper.waitAttributeContainsValue( - By.xpath(ERROR_NOTIFICATION_MESSAGE_XPATH), textAttribute, expectedText); + By.xpath(ERROR_NOTIFICATION_MESSAGE_XPATH), + textAttribute, + expectedText, + ELEMENT_TIMEOUT_SEC); } public void waitProgressBarInvisibility() { diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/ImportProjectFromGitHubTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/ImportProjectFromGitHubTest.java index fc7fc8d4bf..236dec525a 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/ImportProjectFromGitHubTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/ImportProjectFromGitHubTest.java @@ -12,6 +12,7 @@ package org.eclipse.che.selenium.dashboard; import static org.eclipse.che.commons.lang.NameGenerator.generate; +import static org.eclipse.che.selenium.core.utils.WaitUtils.sleepQuietly; import static org.eclipse.che.selenium.pageobject.ProjectExplorer.FolderTypes.PROJECT_FOLDER; import static org.eclipse.che.selenium.pageobject.dashboard.NewWorkspace.Stack.JAVA; import static org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage.Sources.GITHUB; @@ -126,9 +127,15 @@ public class ImportProjectFromGitHubTest { private void connectGithubAccount() { projectSourcePage.clickOnConnectGithubAccountButton(); + + seleniumWebDriverHelper.waitOpenedSomeWin(); seleniumWebDriverHelper.switchToNextWindow(ideWin); + // workaround to avoid freezing blank popup window in chrome-node 3.141.59-dubnium + sleepQuietly(5); + projectSourcePage.waitAuthorizationPageOpened(); + projectSourcePage.typeLogin(gitHubUsername); projectSourcePage.typePassword(gitHubPassword); projectSourcePage.clickOnSignInButton(); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/NewWorkspacePageTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/NewWorkspacePageTest.java index e0aa7de921..2699a15b30 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/NewWorkspacePageTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/NewWorkspacePageTest.java @@ -80,8 +80,8 @@ public class NewWorkspacePageTest { private static List EXPECTED_OPENSHIFT_QUICK_START_STACKS = asList( - JAVA, BLANK, + JAVA, DOT_NET, ANDROID, CPP, @@ -99,8 +99,8 @@ public class NewWorkspacePageTest { private static List EXPECTED_K8S_QUICK_START_STACKS = asList( - JAVA, BLANK, + JAVA, DOT_NET, ANDROID, CPP, @@ -117,9 +117,9 @@ public class NewWorkspacePageTest { private static final List EXPECTED_DOCKER_QUICK_START_STACKS = asList( + BLANK, JAVA, JAVA_MYSQL, - BLANK, DOT_NET, ANDROID, CPP, @@ -133,8 +133,8 @@ public class NewWorkspacePageTest { private static List EXPECTED_OPENSHIFT_SINGLE_MACHINE_STACKS = asList( - JAVA, BLANK, + JAVA, DOT_NET, ANDROID, CAMEL_SPRINGBOOT, @@ -159,8 +159,8 @@ public class NewWorkspacePageTest { private static List EXPECTED_K8S_SINGLE_MACHINE_STACKS = asList( - JAVA, BLANK, + JAVA, DOT_NET, ANDROID, CAMEL_SPRINGBOOT, @@ -185,8 +185,8 @@ public class NewWorkspacePageTest { private static List EXPECTED_DOCKER_SINGLE_MACHINE_STACKS = asList( - JAVA, BLANK, + JAVA, DOT_NET, ANDROID, CAMEL_SPRINGBOOT, diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/AuthorizeOnGithubFromDashboardTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/AuthorizeOnGithubFromDashboardTest.java index e880661e74..2369167b3d 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/AuthorizeOnGithubFromDashboardTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/AuthorizeOnGithubFromDashboardTest.java @@ -11,6 +11,7 @@ */ package org.eclipse.che.selenium.git; +import static org.eclipse.che.selenium.core.utils.WaitUtils.sleepQuietly; import static org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage.Sources.GITHUB; import static org.testng.Assert.assertEquals; @@ -110,7 +111,12 @@ public class AuthorizeOnGithubFromDashboardTest { projectSourcePage.clickOnConnectGithubAccountButton(); // login to github + seleniumWebDriverHelper.waitOpenedSomeWin(); seleniumWebDriverHelper.switchToNextWindow(ideWin); + + // workaround to avoid freezing blank popup window in chrome-node 3.141.59-dubnium + sleepQuietly(5); + projectSourcePage.waitAuthorizationPageOpened(); projectSourcePage.typeLogin(gitHubUsername); projectSourcePage.typePassword(gitHubPassword);