diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/theia/TheiaTerminal.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/theia/TheiaTerminal.java index f5b1ebfb57..57f4559c30 100644 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/theia/TheiaTerminal.java +++ b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/theia/TheiaTerminal.java @@ -29,6 +29,7 @@ import org.openqa.selenium.By; import org.openqa.selenium.Dimension; import org.openqa.selenium.Keys; import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.TimeoutException; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; @@ -229,4 +230,13 @@ public class TheiaTerminal { return terminalOutput; } + + public boolean isTextPresentInTerminalOutput(String expectedText, int terminalIndex) { + try { + waitTerminalOutput(expectedText, terminalIndex); + return true; + } catch (TimeoutException ex) { + return false; + } + } } diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/theia/TheiaBuildPluginTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/theia/TheiaBuildPluginTest.java index 55eeaabbbe..65dac7cc52 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/theia/TheiaBuildPluginTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/theia/TheiaBuildPluginTest.java @@ -13,6 +13,7 @@ package org.eclipse.che.selenium.theia; import static org.eclipse.che.selenium.core.TestGroup.OPENSHIFT; import static org.eclipse.che.selenium.pageobject.dashboard.NewWorkspace.Stack.CHE_7_PREVIEW; +import static org.testng.Assert.fail; import com.google.inject.Inject; import org.eclipse.che.commons.lang.NameGenerator; @@ -29,6 +30,7 @@ import org.eclipse.che.selenium.pageobject.theia.TheiaNewFileDialog; import org.eclipse.che.selenium.pageobject.theia.TheiaProjectTree; import org.eclipse.che.selenium.pageobject.theia.TheiaProposalForm; import org.eclipse.che.selenium.pageobject.theia.TheiaTerminal; +import org.openqa.selenium.TimeoutException; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -108,7 +110,17 @@ public class TheiaBuildPluginTest { theiaTerminal.waitTab(WS_THEIA_IDE_TERMINAL_TITLE); theiaTerminal.clickOnTab(WS_THEIA_IDE_TERMINAL_TITLE); theiaTerminal.performCommand(BUILD_COMMAND); - theiaTerminal.waitTerminalOutput(EXPECTED_TERMINAL_OUTPUT, 1); + try { + theiaTerminal.waitTerminalOutput(EXPECTED_TERMINAL_OUTPUT, 1); + } catch (TimeoutException ex) { + // remove try-catch block after issue has been resolved + if (theiaTerminal.isTextPresentInTerminalOutput(EXPECTED_TERMINAL_SUCCESS_OUTPUT, 1)) { + fail("Known permanent failure https://github.com/eclipse/che/issues/11624", ex); + } + + throw ex; + } + theiaTerminal.waitTerminalOutput(EXPECTED_TERMINAL_SUCCESS_OUTPUT, 1); }