From 2e3cb47a6bf8042a13492e7f885e587bfbb5cda2 Mon Sep 17 00:00:00 2001 From: Maxim Musienko Date: Tue, 19 Dec 2017 10:51:09 +0200 Subject: [PATCH] Complement unstable parts of the selenium tests with info about known issues (#7934) * add Asserts to tests with depended issues --- .../che/selenium/debugger/NodeJsDebugTest.java | 9 ++++++++- .../factory/DirectUrlFactoryWithRootFolder.java | 7 ++++++- .../DirectUrlFactoryWithSpecificBranch.java | 9 ++++++++- .../testrunner/JavaTestPluginTestNgTest.java | 15 +++++++++++---- 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/NodeJsDebugTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/NodeJsDebugTest.java index 66b21df42d..d05b9e4c87 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/NodeJsDebugTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/NodeJsDebugTest.java @@ -12,6 +12,7 @@ package org.eclipse.che.selenium.debugger; import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.fail; import com.google.inject.Inject; import java.net.URL; @@ -33,6 +34,7 @@ import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; import org.eclipse.che.selenium.pageobject.debug.DebugPanel; import org.eclipse.che.selenium.pageobject.debug.NodeJsDebugConfig; import org.openqa.selenium.By; +import org.openqa.selenium.TimeoutException; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; @@ -127,7 +129,12 @@ public class NodeJsDebugTest { debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.EVALUATE_EXPRESSIONS); debugPanel.typeEvaluateExpression("c.length"); debugPanel.clickEvaluateBtn(); - debugPanel.waitExpectedResultInEvaluateExpression("19"); + try { + debugPanel.waitExpectedResultInEvaluateExpression("19"); + } catch (TimeoutException ex) { + // remove try-catch block after issue has been resolved + fail("Known issue https://github.com/eclipse/che/issues/4720", ex); + } debugPanel.clickCloseEvaluateBtn(); } } diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithRootFolder.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithRootFolder.java index 8b3538a039..e9852307d1 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithRootFolder.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithRootFolder.java @@ -84,7 +84,12 @@ public class DirectUrlFactoryWithRootFolder { "tslint.json", "typings.json", "wallaby.js"); - testFactoryWithRootFolder.authenticateAndOpen(); + try { + testFactoryWithRootFolder.authenticateAndOpen(); + } catch (TimeoutException ex) { + // remove try-catch block after issue has been resolved + fail("Known issue https://github.com/eclipse/che/issues/7555", ex); + } projectExplorer.waitProjectExplorer(); projectExplorer.waitItem(EXPECTED_PROJECT); notificationsPopupPanel.waitProgressPopupPanelClose(); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithSpecificBranch.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithSpecificBranch.java index 6b39108555..ccd02f7069 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithSpecificBranch.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithSpecificBranch.java @@ -12,6 +12,7 @@ package org.eclipse.che.selenium.factory; import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.UPDATING_PROJECT_TIMEOUT_SEC; import static org.testng.Assert.assertTrue; +import static org.testng.Assert.fail; import com.google.common.collect.ImmutableList; import com.google.inject.Inject; @@ -27,6 +28,7 @@ import org.eclipse.che.selenium.pageobject.Events; import org.eclipse.che.selenium.pageobject.Ide; import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; import org.eclipse.che.selenium.pageobject.ProjectExplorer; +import org.openqa.selenium.TimeoutException; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -64,7 +66,12 @@ public class DirectUrlFactoryWithSpecificBranch { @Test public void factoryWithDirectUrlWithSpecificBranch() throws Exception { - testFactoryWithSpecificBranch.authenticateAndOpen(); + try { + testFactoryWithSpecificBranch.authenticateAndOpen(); + } catch (TimeoutException ex) { + // remove try-catch block after issue has been resolved + fail("Known issue https://github.com/eclipse/che/issues/7555", ex); + } projectExplorer.waitProjectExplorer(); notificationsPopupPanel.waitProgressPopupPanelClose(); events.clickEventLogBtn(); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/JavaTestPluginTestNgTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/JavaTestPluginTestNgTest.java index 8b85c5de50..2592c0fd2e 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/JavaTestPluginTestNgTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/JavaTestPluginTestNgTest.java @@ -16,6 +16,7 @@ import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.T import static org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole.JunitMethodsState.FAILED; import static org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole.JunitMethodsState.PASSED; import static org.testng.Assert.assertTrue; +import static org.testng.Assert.fail; import com.google.inject.Inject; import java.net.URL; @@ -38,6 +39,7 @@ import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; import org.eclipse.che.selenium.pageobject.ProjectExplorer; import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; import org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole; +import org.openqa.selenium.TimeoutException; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -105,7 +107,7 @@ public class JavaTestPluginTestNgTest { } @Test - public void shouldExecuteTestClassSuccessfully() throws InterruptedException { + public void shouldExecuteTestClassSuccessfully() { // given projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_ANOTHER_TEST_CLASS); projectExplorer.openItemByPath(PATH_TO_TEST_CLASS); @@ -127,7 +129,7 @@ public class JavaTestPluginTestNgTest { } @Test(priority = 1) - public void shouldExecuteTestMethodsSuccessfully() throws InterruptedException { + public void shouldExecuteTestMethodsSuccessfully() { // given projectExplorer.openItemByPath(PATH_TO_ANOTHER_TEST_CLASS); @@ -140,7 +142,12 @@ public class JavaTestPluginTestNgTest { assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1); editor.goToCursorPositionVisible(30, 17); menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); - pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppAnother"); + try { + pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppAnother"); + } catch (TimeoutException ex) { + // remove try-catch block after issue has been resolved + fail("Known issue https://github.com/eclipse/che/issues/7338", ex); + } assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1); String testErrorMessage = pluginConsole.getTestErrorMessage(); assertTrue( @@ -151,7 +158,7 @@ public class JavaTestPluginTestNgTest { } @Test(priority = 2) - public void shouldExecuteAlltests() throws InterruptedException { + public void shouldExecuteAlltests() { // given projectExplorer.openItemByPath(PATH_TO_ANOTHER_TEST_CLASS);