Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selenium: fix unstable selenium tests, add info about known issues #12068

Merged
merged 5 commits into from
Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,8 @@ public void openItemByPath(String path) {
waitItemIsSelected(path);
},
(EXPECTED_MESS_IN_CONSOLE_SEC + ELEMENT_TIMEOUT_SEC) * 2,
NoSuchElementException.class);
NoSuchElementException.class,
TimeoutException.class);

seleniumWebDriverHelper.waitNoExceptions(
() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ public void waitNotificationDisappearance(String notificationText, int timeout)
seleniumWebDriverHelper.waitInvisibility(By.xpath(notificationMessage), timeout);
}

public void waitNotificationPanelClosed() {
seleniumWebDriverHelper.waitInvisibility(By.className("theia-Notification"));
}

public void waitTheiaIde() {
seleniumWebDriverHelper.waitVisibility(theiaIde, PREPARING_WS_TIMEOUT_SEC);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public class CreateAndDeleteProjectsTest {
private static final String WORKSPACE = generate("workspace", 4);
private static final String SECOND_WEB_JAVA_SPRING_PROJECT_NAME = WEB_JAVA_SPRING + "-1";

private String dashboardWindow;

@Inject private Dashboard dashboard;
@Inject private WorkspaceProjects workspaceProjects;
@Inject private WorkspaceDetails workspaceDetails;
Expand Down Expand Up @@ -79,7 +81,7 @@ public void tearDown() throws Exception {
}

@Test
public void createAndDeleteProjectTest() {
public void createProjectTest() {
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
workspaces.clickOnAddWorkspaceBtn();
Expand Down Expand Up @@ -107,7 +109,7 @@ public void createAndDeleteProjectTest() {
testWorkspace = testWorkspaceProvider.getWorkspace(WORKSPACE, defaultTestUser);

// switch to the IDE and wait for workspace is ready to use
String dashboardWindow = seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability();
dashboardWindow = seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability();
toastLoader.waitToastLoaderAndClickStartButton();
ide.waitOpenedWorkspaceIsReadyToUse();

Expand All @@ -120,8 +122,10 @@ public void createAndDeleteProjectTest() {
explorer.waitDefinedTypeOfFolder(CONSOLE_JAVA_SIMPLE, PROJECT_FOLDER);
explorer.waitDefinedTypeOfFolder(WEB_JAVA_SPRING, PROJECT_FOLDER);
notificationsPopupPanel.waitPopupPanelsAreClosed();
}

// delete projects from workspace details page
@Test(priority = 1)
public void deleteProjectsFromDashboardTest() {
switchToWindow(dashboardWindow);
dashboard.selectWorkspacesItemOnDashboard();
workspaces.selectWorkspaceItemName(WORKSPACE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public void checkOpenDeclaration() {
editor.closeFileByNameWithSaving("ModelAndView.class");
}

@Test(priority = 6, alwaysRun = true)
@Test(priority = 6, alwaysRun = true, groups = UNDER_REPAIR)
public void checkRefactoring() {
final String editorTabName = "Test1";
final String renamedEditorTabName = "Zclass";
Expand All @@ -295,7 +295,7 @@ public void checkRefactoring() {
editor.waitTabIsPresent(editorTabName);
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known random failure https://github.com/eclipse/che/issues/11697");
fail("Known permanent failure https://github.com/eclipse/che/issues/11697");
}

projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/Test1.java");
Expand All @@ -311,7 +311,7 @@ public void checkRefactoring() {
editor.waitTabIsPresent(renamedEditorTabName);
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known random failure https://github.com/eclipse/che/issues/11697");
fail("Known permanent failure https://github.com/eclipse/che/issues/11697");
}
editor.waitTextIntoEditor("public class Zclass");
projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/Zclass.java");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public void checkRenameFeature() {
editor.waitTextElementsActiveLine("if k == 1");
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known permanent failure https://github.com/eclipse/che/issues/10524");
fail("Known permanent failure https://github.com/eclipse/che/issues/11907");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void checkInitializingAfterFirstStarting() {
}
}

public void checkCodeValidation() {
private void checkCodeValidation() {
editor.goToCursorPositionVisible(24, 12);
for (int i = 0; i < 9; i++) {
editor.typeTextIntoEditor(BACK_SPACE.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
package org.eclipse.che.selenium.refactor.types;

import static org.eclipse.che.commons.lang.NameGenerator.generate;
import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.RENAME;
Expand Down Expand Up @@ -44,6 +45,7 @@
*
* @author Musienko Maxim
*/
@Test(groups = UNDER_REPAIR)
public class GenericsTest {
private static final String PROJECT_NAME = generate("project", 4);
private static final String PATH_TO_PACKAGE_IN_CHE_PREFIX =
Expand Down Expand Up @@ -104,7 +106,7 @@ public void testGenerics2() throws Exception {
assertEquals(editor.getVisibleTextFromEditor(), contentFromOutB);
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known random failure https://github.com/eclipse/che/issues/11779");
fail("Known permanent failure https://github.com/eclipse/che/issues/11779");
}

editor.waitTextIntoEditor(contentFromOutB);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
package org.eclipse.che.selenium.refactor.types;

import static org.eclipse.che.commons.lang.NameGenerator.generate;
import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.RENAME;
Expand Down Expand Up @@ -47,6 +48,7 @@
import org.testng.annotations.Test;

/** @author Musienko Maxim */
@Test(groups = UNDER_REPAIR)
public class RenameTypeTest {
private static final Logger LOG = LoggerFactory.getLogger(RenameTypeTest.class);
private static final String PROJECT_NAME = generate("project", 4);
Expand Down Expand Up @@ -200,7 +202,7 @@ private void testCase() {
editor.waitTextIntoEditor(contentFromOutB);
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known random failure https://github.com/eclipse/che/issues/11779");
fail("Known permanent failure https://github.com/eclipse/che/issues/11779");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import static java.nio.file.Files.readAllLines;
import static java.nio.file.Paths.get;
import static org.eclipse.che.commons.lang.NameGenerator.generate;
import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.RENAME;
Expand All @@ -41,6 +42,7 @@
import org.testng.annotations.Test;

/** @author Musienko Maxim */
@Test(groups = UNDER_REPAIR)
public class TestAnnotationsTest {
private static final String PROJECT_NAME = generate("project", 4);
private static final String PATH_TO_PACKAGE_IN_CHE_PREFIX =
Expand Down Expand Up @@ -102,7 +104,7 @@ public void testAnnotation1() throws Exception {
editor.waitTextIntoEditor(contentFromInB);
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known random failure https://github.com/eclipse/che/issues/11779");
fail("Known permanent failure https://github.com/eclipse/che/issues/11779");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
package org.eclipse.che.selenium.refactor.types;

import static org.eclipse.che.commons.lang.NameGenerator.generate;
import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.RENAME;
Expand Down Expand Up @@ -40,6 +41,7 @@
import org.testng.annotations.Test;

/** @author Musienko Maxim */
@Test(groups = UNDER_REPAIR)
public class TestEnumerationsTest {
private static final String PROJECT_NAME = generate("project", 4);
private static final String PATH_TO_PACKAGE_IN_CHE_PREFIX =
Expand Down Expand Up @@ -97,7 +99,7 @@ public void testEnum1() throws Exception {
assertEquals(editor.getVisibleTextFromEditor(), contentFromOutB);
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known random failure https://github.com/eclipse/che/issues/11779");
fail("Known permanent failure https://github.com/eclipse/che/issues/11779");
}

editor.waitTextIntoEditor(contentFromOutB);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.eclipse.che.selenium.pageobject.CodenvyEditor;
import org.eclipse.che.selenium.pageobject.Consoles;
import org.eclipse.che.selenium.pageobject.Ide;
import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspaceHelper;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
Expand All @@ -47,6 +48,7 @@ public class CreateWorkspaceFromCamelStackTest {
@Inject private Dashboard dashboard;
@Inject private DefaultTestUser defaultTestUser;
@Inject private CreateWorkspaceHelper createWorkspaceHelper;
@Inject private NotificationsPopupPanel notificationsPopupPanel;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private ProjectExplorer projectExplorer;
@Inject private CodenvyEditor editor;
Expand Down Expand Up @@ -88,6 +90,7 @@ private void checkLanguageServerInitialized() throws Exception {
Workspace ws = workspaceServiceClient.getByName(WORKSPACE_NAME, defaultTestUser.getName());
testProjectServiceClient.importProject(
ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, CONSOLE_JAVA_SIMPLE);
notificationsPopupPanel.waitPopupPanelsAreClosed();

projectExplorer.waitAndSelectItem(PROJECT_NAME);
projectExplorer.openItemByPath(PROJECT_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void createWorkspaceFromJavaTheiaDockerStack() {
theiaIde.waitTheiaIde();
theiaIde.waitTheiaIdeTopPanel();
theiaIde.waitLoaderInvisibility();
theiaIde.waitNotificationPanelClosed();

// run 'About' command from 'Help' menu
theiaIde.runMenuCommand("Help", "About");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void createWorkspaceFromJavaTheiaOpenshiftStack() {
theiaIde.waitTheiaIde();
theiaIde.waitTheiaIdeTopPanel();
theiaIde.waitLoaderInvisibility();
theiaIde.waitNotificationPanelClosed();

// run 'About' command from 'Help' menu
theiaIde.runMenuCommand("Help", "About");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuCommandGoals.BUILD_GOAL;
import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuCommandGoals.RUN_GOAL;
import static org.eclipse.che.selenium.pageobject.dashboard.NewWorkspace.Stack.NODE;
import static org.testng.Assert.fail;

import com.google.common.collect.ImmutableList;
import com.google.inject.Inject;
Expand All @@ -32,6 +33,7 @@
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspaceHelper;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.openqa.selenium.By;
import org.openqa.selenium.TimeoutException;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -139,7 +141,12 @@ public void checkWebNodejsSimpleProjectCommands() {
seleniumWebDriver.navigate().refresh();
seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability();
ide.waitOpenedWorkspaceIsReadyToUse();
consoles.waitPreviewUrlIsPresent();

try {
consoles.waitPreviewUrlIsPresent();
} catch (TimeoutException ex) {
fail("Known random failure https://github.com/eclipse/che/issues/11419", ex);
}

consoles.checkWebElementVisibilityAtPreviewPage(textOnPreviewPage);

Expand Down