-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Reworks CheckWsAgentAfterStopProcessTest test #6445
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,17 +10,22 @@ | |
*/ | ||
package org.eclipse.che.selenium.miscellaneous; | ||
|
||
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC; | ||
import static org.eclipse.che.api.core.model.workspace.WorkspaceStatus.RUNNING; | ||
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC; | ||
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.WIDGET_TIMEOUT_SEC; | ||
|
||
import com.google.inject.Inject; | ||
import java.net.URL; | ||
import java.nio.file.Paths; | ||
import org.eclipse.che.commons.lang.NameGenerator; | ||
import org.eclipse.che.selenium.core.SeleniumWebDriver; | ||
import org.eclipse.che.selenium.core.client.TestCommandServiceClient; | ||
import org.eclipse.che.selenium.core.client.TestProjectServiceClient; | ||
import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; | ||
import org.eclipse.che.selenium.core.constant.TestCommandsConstants; | ||
import org.eclipse.che.selenium.core.constant.TestWorkspaceConstants; | ||
import org.eclipse.che.selenium.core.project.ProjectTemplates; | ||
import org.eclipse.che.selenium.core.user.DefaultTestUser; | ||
import org.eclipse.che.selenium.core.workspace.TestWorkspace; | ||
import org.eclipse.che.selenium.pageobject.Events; | ||
import org.eclipse.che.selenium.pageobject.Ide; | ||
|
@@ -38,18 +43,22 @@ | |
* @author Musienko Maxim | ||
*/ | ||
public class CheckWsAgentAfterStopProcessTest { | ||
private static final String PROJECT_NAME = CheckWsAgentAfterStopProcessTest.class.getSimpleName(); | ||
private static final String PROJECT_NAME = | ||
NameGenerator.generate("CheckWsAgentAfterStopProcessTest", 4); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
private static final String nameCommandForKillWsAgent = "killWsAgent"; | ||
private static final String killPIDWSAgentCommand = | ||
"kill -9 $(ps ax | grep java | grep ws-agent | grep conf | grep -v grep | awk '{print $1}')"; | ||
|
||
@Inject private TestWorkspace workspace; | ||
@Inject private DefaultTestUser defaultTestUser; | ||
@Inject private Ide ide; | ||
@Inject private ProjectExplorer projectExplorer; | ||
@Inject private Events events; | ||
@Inject private ToastLoader toastLoader; | ||
@Inject private TestCommandServiceClient testCommandServiceClient; | ||
@Inject private TestProjectServiceClient testProjectServiceClient; | ||
@Inject private TestWorkspaceServiceClient testWorkspaceServiceClient; | ||
@Inject private SeleniumWebDriver seleniumWebDriver; | ||
|
||
@BeforeClass | ||
public void setUp() throws Exception { | ||
|
@@ -58,7 +67,7 @@ public void setUp() throws Exception { | |
workspace.getId(), | ||
Paths.get(resource.toURI()), | ||
PROJECT_NAME, | ||
ProjectTemplates.MAVEN_SPRING.toString()); | ||
ProjectTemplates.MAVEN_SPRING); | ||
testCommandServiceClient.createCommand( | ||
killPIDWSAgentCommand, | ||
nameCommandForKillWsAgent, | ||
|
@@ -67,21 +76,26 @@ public void setUp() throws Exception { | |
ide.open(workspace); | ||
} | ||
|
||
@Test | ||
public void checkDialogAfterKillingProcess() throws Exception { | ||
@Test(priority = 0) | ||
public void checkWorkspaceRestartingByApi() throws Exception { | ||
String expectedMessageOInDialog = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And name of method this one like: checkRestoreWsAgent |
||
"Workspace agent is no longer responding. To fix the problem, restart the workspace."; | ||
projectExplorer.waitItem(PROJECT_NAME); | ||
toastLoader.waitAppeareanceAndClosing(); | ||
projectExplorer.invokeCommandWithContextMenu( | ||
ProjectExplorer.CommandsGoal.COMMON, PROJECT_NAME, nameCommandForKillWsAgent); | ||
new WebDriverWait(ide.driver(), LOAD_PAGE_TIMEOUT_SEC * 3) | ||
new WebDriverWait(seleniumWebDriver, WIDGET_TIMEOUT_SEC) | ||
.until( | ||
ExpectedConditions.visibilityOfElementLocated( | ||
By.xpath("//span[text()='" + expectedMessageOInDialog + "']"))); | ||
new WebDriverWait(ide.driver(), REDRAW_UI_ELEMENTS_TIMEOUT_SEC) | ||
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) | ||
.until(ExpectedConditions.visibilityOfElementLocated(By.id("ask-dialog-first"))) | ||
.click(); | ||
testWorkspaceServiceClient.waitStatus(workspace.getName(), defaultTestUser.getName(), RUNNING); | ||
} | ||
|
||
@Test(priority = 1) | ||
public void checkWorkspaceRestartingByIde() { | ||
projectExplorer.waitItem(PROJECT_NAME); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And checkRestoreIdeItems() |
||
events.clickProjectEventsTab(); | ||
events.waitExpectedMessage(TestWorkspaceConstants.RUNNING_WORKSPACE_MESS); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should rename the name of class because it a bit confuse. May be like: CheckResroingWorkspaceAfterStoppingWsAgentProcess or something like that. WDYF-?