[Selenium] Add catching of the known bug (#11624) to the "TheiaBuildPluginTest" selenium test (#11628)

6.19.x
Igor Ohrimenko 2018-10-16 14:50:05 +03:00 committed by GitHub
parent ffccbdcb8b
commit 398176cada
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View File

@ -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;
}
}
}

View File

@ -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);
}