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 from dashboard package #14571

Merged
merged 8 commits into from
Sep 18, 2019
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.eclipse.che.selenium.core.webdriver.WebDriverWaitFactory;
import org.eclipse.che.selenium.pageobject.TestWebElementRenderChecker;
import org.openqa.selenium.By;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
Expand Down Expand Up @@ -185,7 +186,12 @@ public boolean isDevfileVisible(Devfile devfile) {

public void selectDevfile(Devfile devfile) {
waitDevfiles(asList(devfile));
seleniumWebDriverHelper.waitAndClick(By.xpath(format(DEVFILE_ROW_XPATH, devfile.getId())));
try {
seleniumWebDriverHelper.waitAndClick(By.xpath(format(DEVFILE_ROW_XPATH, devfile.getId())));
waitDevfileSelected(devfile);
} catch (TimeoutException ex) {
seleniumWebDriverHelper.waitAndClick(By.xpath(format(DEVFILE_ROW_XPATH, devfile.getId())));
}
}

public boolean isCreateWorkspaceButtonEnabled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.eclipse.che.selenium.core.utils.WaitUtils;
import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper;
import org.openqa.selenium.By;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
Expand Down Expand Up @@ -151,7 +152,12 @@ public void waitNotificationPanelClosed() {
}

public void waitTheiaIde() {
seleniumWebDriverHelper.waitVisibility(theiaIde, PREPARING_WS_TIMEOUT_SEC);
try {
seleniumWebDriverHelper.waitVisibility(theiaIde, PREPARING_WS_TIMEOUT_SEC);
} catch (TimeoutException ex) {
switchToIdeFrame();
seleniumWebDriverHelper.waitVisibility(theiaIde, PREPARING_WS_TIMEOUT_SEC);
}
}

public void waitTheiaIdeTopPanel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ public void createProjectTest() {
dashboardWindow = seleniumWebDriver.getWindowHandle();

// we are selecting 'Java' stack from the 'All Devfile' tab for compatibility with OSIO
newWorkspace.selectDevfile(Devfile.JAVA_MAVEN);
newWorkspace.typeWorkspaceName(WORKSPACE);
newWorkspace.selectDevfile(Devfile.JAVA_MAVEN);
newWorkspace.waitDevfileSelected(Devfile.JAVA_MAVEN);
projectSourcePage.waitCreatedProjectButton(CONSOLE_JAVA_SIMPLE);

// create 'console-java-simple-1' project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public void checkWorkspaceName() {
public void checkProjectSourcePage() {
// add a project from the 'console-java-simple' sample
newWorkspace.selectDevfile(Devfile.JAVA_MAVEN);
newWorkspace.waitDevfileSelected(Devfile.JAVA_MAVEN);
projectSourcePage.waitOpened();
projectSourcePage.waitCreatedProjectButton(projectName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ public void checkAbilityImportMavenProjectTest() {
workspaces.clickOnAddWorkspaceBtn();
newWorkspace.waitToolbar();

newWorkspace.typeWorkspaceName(WORKSPACE);
// we are selecting 'Java' stack from the 'All Devfile' tab for compatibility with OSIO
newWorkspace.selectDevfile(Devfile.JAVA_MAVEN);
newWorkspace.typeWorkspaceName(WORKSPACE);
newWorkspace.waitDevfileSelected(Devfile.JAVA_MAVEN);

projectSourcePage.clickOnAddOrImportProjectButton();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ public void checkAbilityImportProjectFromGithub() {
dashboard.selectWorkspacesItemOnDashboard();
workspaces.clickOnAddWorkspaceBtn();
newWorkspace.waitToolbar();
newWorkspace.typeWorkspaceName(WORKSPACE);
// we are selecting 'Java' stack from the 'All Devfile' tab for compatibility with OSIO
newWorkspace.selectDevfile(Devfile.JAVA_MAVEN);
newWorkspace.typeWorkspaceName(WORKSPACE);
newWorkspace.waitDevfileSelected(Devfile.JAVA_MAVEN);

projectSourcePage.clickOnAddOrImportProjectButton();
projectSourcePage.selectSourceTab(GITHUB);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ private void createWorkspace(String organizationName, String workspaceName) {
newWorkspace.waitToolbar();
newWorkspace.openOrganizationsList();
newWorkspace.selectOrganizationFromList(organizationName);
newWorkspace.selectDevfile(Devfile.JAVA_MAVEN);
newWorkspace.typeWorkspaceName(workspaceName);
newWorkspace.selectDevfile(Devfile.JAVA_MAVEN);
newWorkspace.waitDevfileSelected(Devfile.JAVA_MAVEN);
newWorkspace.clickOnCreateButtonAndEditWorkspace();
workspaceDetails.waitToolbarTitleName(workspaceName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@ private void createWorkspace(String organizationName, String workspaceName) {
newWorkspace.waitToolbar();
newWorkspace.openOrganizationsList();
newWorkspace.selectOrganizationFromList(organizationName);
newWorkspace.selectDevfile(Devfile.JAVA_MAVEN);
newWorkspace.typeWorkspaceName(workspaceName);
newWorkspace.selectDevfile(Devfile.JAVA_MAVEN);
newWorkspace.waitDevfileSelected(Devfile.JAVA_MAVEN);
newWorkspace.clickOnCreateButtonAndEditWorkspace();
workspaceDetails.waitToolbarTitleName(workspaceName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public void factoryWithDirectUrlWithKeepDirectory() {
theiaIde.switchToIdeFrame();
theiaIde.waitTheiaIde();
theiaIde.waitLoaderInvisibility();
theiaIde.waitNotificationEqualsTo("Che Workspace: Finished cloning projects.");
theiaIde.waitNotificationDisappearance(
"Che Workspace: Finished cloning projects.", UPDATING_PROJECT_TIMEOUT_SEC);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public void factoryWithDirectUrlWithRootFolder() {
theiaIde.switchToIdeFrame();
theiaIde.waitTheiaIde();
theiaIde.waitLoaderInvisibility();
theiaIde.waitNotificationEqualsTo("Che Workspace: Finished cloning projects.");
theiaIde.waitNotificationDisappearance(
"Che Workspace: Finished cloning projects.", UPDATING_PROJECT_TIMEOUT_SEC);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public void factoryWithDirectUrlWithSpecificBranch() {
theiaIde.switchToIdeFrame();
theiaIde.waitTheiaIde();
theiaIde.waitLoaderInvisibility();
theiaIde.waitNotificationEqualsTo("Che Workspace: Finished cloning projects.");
theiaIde.waitNotificationDisappearance(
"Che Workspace: Finished cloning projects.", UPDATING_PROJECT_TIMEOUT_SEC);

Expand Down