Selenium: fix unstable selenium tests (#11610)

6.19.x
Sergey Skorik 2018-10-12 16:43:12 +03:00 committed by GitHub
parent baafe61add
commit f9abc930a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 11 deletions

View File

@ -524,17 +524,19 @@ public class Consoles {
waitPreviewUrlIsPresent();
waitPreviewUrlIsResponsive(10);
// wait for 2 sec to prevent "Application is not available" error
WaitUtils.sleepQuietly(2);
// wait for 5 sec to prevent "Application is not available" error
WaitUtils.sleepQuietly(5);
clickOnPreviewUrl();
seleniumWebDriverHelper.switchToNextWindow(currentWindow);
seleniumWebDriverHelper.waitVisibility(webElement, LOADER_TIMEOUT_SEC);
seleniumWebDriver.close();
seleniumWebDriver.switchTo().window(currentWindow);
seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability();
try {
seleniumWebDriverHelper.waitVisibility(webElement, LOADER_TIMEOUT_SEC);
} finally {
seleniumWebDriver.close();
seleniumWebDriver.switchTo().window(currentWindow);
seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability();
}
}
// Start command from project context menu and check expected message in Console

View File

@ -169,6 +169,9 @@ public class FileStructure {
* @param item is the name of the item
*/
public void selectItemInFileStructure(String item) {
// we need to wait a little to avoid quick clicking on nodes
WaitUtils.sleepQuietly(1);
seleniumWebDriverHelper.waitNoExceptions(
() -> selectItem(item), StaleElementReferenceException.class);
}

View File

@ -75,7 +75,9 @@ public class EditMachineForm {
}
public void clickOnRecipeForm() {
seleniumWebDriverHelper.waitAndClick(By.xpath(RECIPE_EDITOR_TEXT_XPATH));
seleniumWebDriverHelper.waitNoExceptions(
() -> seleniumWebDriverHelper.waitAndClick(By.xpath(RECIPE_EDITOR_TEXT_XPATH)),
StaleElementReferenceException.class);
}
public void typeToRecipe(String text) {

View File

@ -114,6 +114,16 @@ public class WorkspaceDetailsMachineActionsTest {
checkEditOfMachineName("FROM " + IMAGE_NAME + "\n");
}
@Test(groups = {OPENSHIFT, K8S, OSIO})
public void checkRamSectionOpenshift() {
checkRamSection(IMAGE_NAME);
}
@Test(groups = DOCKER)
public void checkRamSectionDocker() {
checkRamSection("FROM " + IMAGE_NAME + "\n");
}
private void checkEditOfMachineName(String expectedRecipeText) {
// check default values
workspaceDetailsMachines.clickOnEditButton(MACHINE_NAME);
@ -148,8 +158,7 @@ public class WorkspaceDetailsMachineActionsTest {
editMachineForm.waitSaveButtonDisabling();
}
@Test
public void checkRamSection() {
public void checkRamSection(String expectedRecipeText) {
// check machine name editing
workspaceDetailsMachines.clickOnEditButton(MACHINE_NAME);
editMachineForm.waitForm();
@ -198,7 +207,7 @@ public class WorkspaceDetailsMachineActionsTest {
editMachineForm.waitFormInvisibility();
workspaceDetailsMachines.clickOnEditButton(MACHINE_NAME);
editMachineForm.waitForm();
waitRecipeText(IMAGE_NAME);
waitRecipeText(expectedRecipeText);
// check saving of the changes
editMachineForm.typeRam(CHANGED_RAM_SIZE);