Java tutorial
/* * Copyright (c) 2012-2017 Red Hat, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Red Hat, Inc. - initial API and implementation */ package org.eclipse.che.selenium.languageserver; import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkersType.ERROR_MARKER; import com.google.inject.Inject; import org.eclipse.che.commons.lang.NameGenerator; 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; import org.eclipse.che.selenium.pageobject.CodenvyEditor; import org.eclipse.che.selenium.pageobject.Ide; import org.eclipse.che.selenium.pageobject.Loader; import org.eclipse.che.selenium.pageobject.Menu; import org.eclipse.che.selenium.pageobject.ProjectExplorer; import org.eclipse.che.selenium.pageobject.Wizard; import org.openqa.selenium.Keys; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; /** @author Musienko Maxim */ public class CheckMainFeatureForLanguageTest { private final String PROJECT_NAME = NameGenerator.generate("AspProject", 4); @InjectTestWorkspace(template = WorkspaceTemplate.CODENVY_DEBIAN_JRE) private TestWorkspace workspace; @Inject private Ide ide; @Inject private ProjectExplorer projectExplorer; @Inject private Loader loader; @Inject private CodenvyEditor editor; @Inject private Menu menu; @Inject private Wizard wizard; @BeforeClass public void setUp() throws Exception { ide.open(workspace); } @Test public void checkLaunchingCodeserver() throws Exception { projectExplorer.waitProjectExplorer(); menu.runCommand(TestMenuCommandsConstants.Workspace.WORKSPACE, TestMenuCommandsConstants.Workspace.CREATE_PROJECT); wizard.selectSample(Wizard.SamplesName.ASP_DOT_NET_WEB_SIMPLE); wizard.typeProjectNameOnWizard(PROJECT_NAME); wizard.clickCreateButton(); wizard.waitCloseProjectConfigForm(); projectExplorer.openItemByPath(PROJECT_NAME); projectExplorer.waitItem(PROJECT_NAME + "/Program.cs", 240); projectExplorer.openItemByPath(PROJECT_NAME + "/Program.cs"); loader.waitOnClosed(); editor.setCursorToDefinedLineAndChar(16, 34); for (int i = 0; i < 8; i++) { editor.typeTextIntoEditor(Keys.BACK_SPACE.toString()); } editor.launchAutocomplete(); editor.waitTextIntoAutocompleteContainer("Build()"); editor.closeAutocomplete(); editor.waitMarkerInPosition(ERROR_MARKER, 10); editor.waitMarkerInPosition(ERROR_MARKER, 18); editor.setCursorToDefinedLineAndChar(16, 26); editor.typeTextIntoEditor("Build();"); editor.waitAllMarkersDisappear(ERROR_MARKER); } }