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 #9205

Merged
merged 3 commits into from
Mar 23, 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 @@ -12,7 +12,7 @@

import static java.lang.String.format;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.APPLICATION_START_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ATTACHING_ELEM_TO_DOM_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.utils.WaitUtils.sleepQuietly;
import static org.openqa.selenium.support.ui.ExpectedConditions.frameToBeAvailableAndSwitchToIt;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
Expand Down Expand Up @@ -325,12 +325,13 @@ public void switchFromDashboardIframeToIde() {
public void switchFromDashboardIframeToIde(int timeout) {
wait(timeout).until(visibilityOfElementLocated(By.id("ide-application-iframe")));

wait(ATTACHING_ELEM_TO_DOM_SEC)
wait(LOADER_TIMEOUT_SEC)
.until(
(ExpectedCondition<Boolean>)
driver ->
(((JavascriptExecutor) driver)
.executeScript("return angular.element('body').scope().showIDE"))
.executeScript(
"return angular.element('body').scope().gwt-debug-projectTree"))
.toString()
.equals("true"));

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

import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace.RUNNING;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace.STOPPING;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.TabNames.OVERVIEW;

import com.google.inject.Inject;
Expand Down Expand Up @@ -55,7 +54,6 @@ public void deleteRunningWorkspaceTest() {
workspaceDetails.checkStateOfWorkspace(RUNNING);
workspaceOverview.clickOnDeleteWorkspace();
workspaceDetails.clickOnDeleteButtonInDialogWindow();
workspaceDetails.checkStateOfWorkspace(STOPPING);
dashboard.waitToolbarTitleName("Workspaces");
workspaces.waitWorkspaceIsNotPresent(workspaceName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package org.eclipse.che.selenium.miscellaneous;

import static org.eclipse.che.api.core.model.workspace.WorkspaceStatus.RUNNING;
import static org.eclipse.che.api.core.model.workspace.WorkspaceStatus.STOPPING;
import static org.eclipse.che.selenium.core.constant.TestCommandsConstants.CUSTOM;
import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuCommandGoals.COMMON;
import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SPRING;
Expand All @@ -28,7 +27,6 @@
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.machineperspective.MachineTerminal;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

Expand All @@ -46,7 +44,6 @@ public class CheckRestoringWorkspaceAfterStoppingWsAgentProcess {
@Inject private TestUser defaultTestUser;
@Inject private Ide ide;
@Inject private ProjectExplorer projectExplorer;
@Inject private MachineTerminal terminal;
@Inject private TestCommandServiceClient testCommandServiceClient;
@Inject private TestProjectServiceClient testProjectServiceClient;
@Inject private TestWorkspaceServiceClient testWorkspaceServiceClient;
Expand All @@ -71,7 +68,6 @@ public void checkRestoreWsAgentByApi() throws Exception {

notificationsPopupPanel.waitWorkspaceAgentIsNotRunning();
Copy link
Contributor

@dmytro-ndp dmytro-ndp Mar 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would check that workspace has status "STOPPED" after notificationsPopupPanel.waitWorkspaceAgentIsNotRunning();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually workspace has status "RUNNING" even when ws-agent is stopped.

notificationsPopupPanel.clickOnRestartWorkspaceButton();
testWorkspaceServiceClient.waitStatus(workspace.getName(), defaultTestUser.getName(), STOPPING);
testWorkspaceServiceClient.waitStatus(workspace.getName(), defaultTestUser.getName(), RUNNING);
}

Expand Down