Skip to content

Commit

Permalink
change steps in the tests according to new behavior for init the LS (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
musienko-maxim authored Aug 14, 2018
1 parent 324a7f6 commit 36f3b80
Showing 1 changed file with 20 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@
*/
package org.eclipse.che.selenium.languageserver;

import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.CREATE_PROJECT;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.INFO;
import static org.eclipse.che.selenium.pageobject.Wizard.SamplesName.ASP_DOT_NET_WEB_SIMPLE;
import static org.openqa.selenium.Keys.BACK_SPACE;
import static org.testng.Assert.fail;

import com.google.inject.Inject;
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.TestWorkspaceServiceClient;
import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants;
import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace;
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
import org.eclipse.che.selenium.core.workspace.WorkspaceTemplate;
Expand All @@ -32,7 +35,6 @@
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.Wizard;
import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette;
import org.openqa.selenium.Keys;
import org.openqa.selenium.TimeoutException;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
Expand All @@ -42,7 +44,9 @@
public class CSharpFileEditingTest {

private final String PROJECT_NAME = NameGenerator.generate("AspProject", 4);
private final String COMMAND_NAME_FOR_RESTORE_LS = PROJECT_NAME + ": update dependencies";
private final String LANGUAGE_SERVER_INIT_MESSAGE =
"Finished language servers initialization, file path";
private final String NAME_OF_EDITING_FILE = "Program.cs";

@InjectTestWorkspace(template = WorkspaceTemplate.UBUNTU_LSP)
private TestWorkspace workspace;
Expand All @@ -63,8 +67,7 @@ public class CSharpFileEditingTest {
public void setUp() throws Exception {
ide.open(workspace);
createDotNetAppFromWizard();
restoreDependenciesForLanguageServerByCommand();
projectExplorer.quickRevealToItemWithJavaScript(PROJECT_NAME + "/Program.cs");
initLanguageServer();
}

@AfterMethod
Expand All @@ -73,13 +76,11 @@ public void restartWorkspace() throws Exception {
testWorkspaceServiceClient.stop(workspace.getName(), workspace.getOwner().getName());
ide.open(workspace);
ide.waitOpenedWorkspaceIsReadyToUse();
restoreDependenciesForLanguageServerByCommand();
projectExplorer.quickRevealToItemWithJavaScript(PROJECT_NAME + "/Program.cs");
initLanguageServer();
}

@Test
public void checkCodeEditing() {
projectExplorer.openItemByPath(PROJECT_NAME + "/Program.cs");
checkCodeValidation();
}

Expand All @@ -98,13 +99,21 @@ public void checkInitializingAfterFirstStarting() {
public void checkCodeValidation() {
editor.goToCursorPositionVisible(24, 12);
for (int i = 0; i < 9; i++) {
editor.typeTextIntoEditor(Keys.BACK_SPACE.toString());
editor.typeTextIntoEditor(BACK_SPACE.toString());
}
editor.waitMarkerInPosition(INFO, 23);
editor.waitMarkerInPosition(ERROR, 21);
checkAutocompletion();
}

private void initLanguageServer() {
projectExplorer.quickRevealToItemWithJavaScript(PROJECT_NAME + "/" + NAME_OF_EDITING_FILE);
projectExplorer.openItemByPath(PROJECT_NAME + "/" + NAME_OF_EDITING_FILE);
consoles.selectProcessByTabName("dev-machine");
consoles.waitExpectedTextIntoConsole(LANGUAGE_SERVER_INIT_MESSAGE);
editor.selectTabByName(NAME_OF_EDITING_FILE);
}

private void checkAutocompletion() {
editor.goToCursorPositionVisible(23, 49);
editor.typeTextIntoEditor(".");
Expand All @@ -116,18 +125,10 @@ private void checkAutocompletion() {

private void createDotNetAppFromWizard() {
projectExplorer.waitProjectExplorer();
menu.runCommand(
TestMenuCommandsConstants.Workspace.WORKSPACE,
TestMenuCommandsConstants.Workspace.CREATE_PROJECT);
wizard.selectSample(Wizard.SamplesName.ASP_DOT_NET_WEB_SIMPLE);
menu.runCommand(WORKSPACE, CREATE_PROJECT);
wizard.selectSample(ASP_DOT_NET_WEB_SIMPLE);
wizard.typeProjectNameOnWizard(PROJECT_NAME);
wizard.clickCreateButton();
wizard.waitCloseProjectConfigForm();
}

private void restoreDependenciesForLanguageServerByCommand() {
commandsPalette.openCommandPalette();
commandsPalette.startCommandByDoubleClick(COMMAND_NAME_FOR_RESTORE_LS);
consoles.waitExpectedTextIntoConsole("Restore completed");
}
}

0 comments on commit 36f3b80

Please sign in to comment.