diff --git a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/workspace/WorkspaceTemplate.java b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/workspace/WorkspaceTemplate.java
index 7fca83c7a4..d22eb39cc8 100644
--- a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/workspace/WorkspaceTemplate.java
+++ b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/workspace/WorkspaceTemplate.java
@@ -25,6 +25,7 @@ public class WorkspaceTemplate {
public static final String DEFAULT = "default.json";
public static final String DEFAULT_WITH_GITHUB_PROJECTS = "default_with_github_projects.json";
public static final String PYTHON = "ubuntu_python.json";
+ public static final String UBUNTU_CAMEL = "ubuntu_jdk8_with_camel_ls.json";
private WorkspaceTemplate() {}
}
diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/CodenvyEditor.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/CodenvyEditor.java
index 5199058664..efea126957 100644
--- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/CodenvyEditor.java
+++ b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/CodenvyEditor.java
@@ -31,6 +31,7 @@ import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.DEBUGGE
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.DEBUGGER_PREFIX_XPATH;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.EDITOR_TABS_PANEL;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.HIGHLIGHT_ITEM_PATTERN;
+import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.HOVER_POPUP_XPATH;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.IMPLEMENTATIONS_ITEM;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.IMPLEMENTATION_CONTAINER;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.ITEM_TAB_LIST;
@@ -202,6 +203,9 @@ public class CodenvyEditor {
"//div//iframe[contains(@src, 'api/java/code-assist/compute/info?')]";
String HIGHLIGHT_ITEM_PATTERN = "//li[@selected='true']//span[text()='%s']";
String TOOLTIP_TITLE_CSS = "span.tooltipTitle";
+ String TEXT_TO_MOVE_CURSOR_XPATH =
+ ORION_ACTIVE_EDITOR_CONTAINER_XPATH + "//span[contains(text(),'%s')]";
+ String HOVER_POPUP_XPATH = "//div[@class='textviewTooltip']";
}
public enum TabActionLocator {
@@ -327,6 +331,9 @@ public class CodenvyEditor {
@FindBy(css = TOOLTIP_TITLE_CSS)
private WebElement tooltipTitle;
+ @FindBy(xpath = HOVER_POPUP_XPATH)
+ private WebElement hoverPopup;
+
/**
* Waits during {@code timeout} until current editor's tab is ready to work.
*
@@ -422,6 +429,15 @@ public class CodenvyEditor {
seleniumWebDriverHelper.waitTextContains(tooltipTitle, expectedText);
}
+ /**
+ * wait text in hover pop-up (after hovering on text)
+ *
+ * @param expectedText the expected text into hover pop-up
+ */
+ public void waitTextInHoverPopup(String expectedText) {
+ seleniumWebDriverHelper.waitTextContains(hoverPopup, expectedText);
+ }
+
/**
* Waits during {@code timeout} until specified {@code text} is not present in the editor's tab
* with defined {@code indexOfEditor}.
@@ -2146,4 +2162,9 @@ public class CodenvyEditor {
By.xpath(
format("//div[@id='gwt-debug-multiSplitPanel-tabsPanel']//div[text()='%s']", tabName)));
}
+
+ public void moveCursorToText(String text) {
+ seleniumWebDriverHelper.moveCursorTo(
+ By.xpath(format(Locators.TEXT_TO_MOVE_CURSOR_XPATH, text)));
+ }
}
diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/ApacheCamelFileEditingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/ApacheCamelFileEditingTest.java
new file mode 100644
index 0000000000..a1f17c8bcd
--- /dev/null
+++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/ApacheCamelFileEditingTest.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2012-2018 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 java.lang.String.format;
+import static org.eclipse.che.selenium.core.project.ProjectTemplates.CONSOLE_JAVA_SIMPLE;
+import static org.eclipse.che.selenium.core.workspace.WorkspaceTemplate.UBUNTU_CAMEL;
+
+import com.google.inject.Inject;
+import java.net.URL;
+import java.nio.file.Paths;
+import org.eclipse.che.selenium.core.client.TestProjectServiceClient;
+import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace;
+import org.eclipse.che.selenium.core.workspace.TestWorkspace;
+import org.eclipse.che.selenium.pageobject.CodenvyEditor;
+import org.eclipse.che.selenium.pageobject.Consoles;
+import org.eclipse.che.selenium.pageobject.Ide;
+import org.eclipse.che.selenium.pageobject.ProjectExplorer;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/** @author Skoryk Serhii */
+public class ApacheCamelFileEditingTest {
+
+ private static final String PROJECT_NAME = "project-for-camel-ls";
+ private static final String CAMEL_FILE_NAME = "camel.xml";
+ private static final String PATH_TO_CAMEL_FILE = PROJECT_NAME + "/" + CAMEL_FILE_NAME;
+ private static final String LS_INIT_MESSAGE =
+ format("Finished language servers initialization, file path '/%s'", PATH_TO_CAMEL_FILE);
+
+ @InjectTestWorkspace(template = UBUNTU_CAMEL)
+ private TestWorkspace workspace;
+
+ @Inject private Ide ide;
+ @Inject private Consoles consoles;
+ @Inject private CodenvyEditor editor;
+ @Inject private ProjectExplorer projectExplorer;
+ @Inject private TestProjectServiceClient testProjectServiceClient;
+
+ @BeforeClass
+ public void setUp() throws Exception {
+ URL resource = ApacheCamelFileEditingTest.class.getResource("/projects/project-for-camel-ls");
+ testProjectServiceClient.importProject(
+ workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, CONSOLE_JAVA_SIMPLE);
+ ide.open(workspace);
+ }
+
+ @Test
+ public void checkLanguageServerInitialized() {
+ projectExplorer.waitAndSelectItem(PROJECT_NAME);
+ projectExplorer.openItemByPath(PROJECT_NAME);
+ projectExplorer.openItemByPath(PATH_TO_CAMEL_FILE);
+ editor.waitTabIsPresent(CAMEL_FILE_NAME);
+
+ // check Apache Camel language server initialized
+ consoles.selectProcessByTabName("dev-machine");
+ consoles.waitExpectedTextIntoConsole(LS_INIT_MESSAGE);
+ }
+
+ @Test(priority = 1)
+ public void checkAutocompleteFeature() {
+ editor.selectTabByName(CAMEL_FILE_NAME);
+
+ editor.goToPosition(49, 21);
+
+ editor.launchAutocomplete();
+ editor.waitTextIntoEditor("timer:timerName");
+
+ // launch autocomplete feature, select proposal and check expected text in the Editor
+ editor.typeTextIntoEditor("?");
+ editor.launchAutocompleteAndWaitContainer();
+ editor.waitTextIntoAutocompleteContainer("fixedRate ");
+ editor.enterAutocompleteProposal("fixedRate ");
+ editor.waitTextIntoEditor("timer:timerName?fixedRate=false");
+
+ editor.typeTextIntoEditor("&");
+ editor.launchAutocompleteAndWaitContainer();
+ editor.waitTextIntoAutocompleteContainer("exchangePattern ");
+ editor.enterAutocompleteProposal("exchangePattern ");
+ editor.waitTextIntoEditor("timer:timerName?fixedRate=false&exchangePattern=");
+
+ editor.launchAutocompleteAndWaitContainer();
+ editor.waitTextIntoAutocompleteContainer("InOnly");
+ editor.enterAutocompleteProposal("InOnly");
+ editor.waitTextIntoEditor("timer:timerName?fixedRate=false&exchangePattern=InOnly");
+ }
+
+ @Test(priority = 2)
+ public void checkHoverFeature() {
+ // move cursor on text and check expected text in hover popup
+ editor.moveCursorToText("timer");
+ editor.waitTextInHoverPopup(
+ "The timer component is used for generating message exchanges when a timer fires.");
+ }
+}
diff --git a/selenium/che-selenium-test/src/test/resources/projects/project-for-camel-ls/camel.xml b/selenium/che-selenium-test/src/test/resources/projects/project-for-camel-ls/camel.xml
new file mode 100644
index 0000000000..9f12a84cc8
--- /dev/null
+++ b/selenium/che-selenium-test/src/test/resources/projects/project-for-camel-ls/camel.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ new incident reported
+
+
+
+
+
+
+
diff --git a/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml b/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml
index 174424274f..b4f8872f68 100644
--- a/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml
+++ b/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml
@@ -52,6 +52,7 @@
+
diff --git a/selenium/che-selenium-test/src/test/resources/templates/workspace/docker/ubuntu_jdk8_with_camel_ls.json b/selenium/che-selenium-test/src/test/resources/templates/workspace/docker/ubuntu_jdk8_with_camel_ls.json
new file mode 100644
index 0000000000..eb3bcc8839
--- /dev/null
+++ b/selenium/che-selenium-test/src/test/resources/templates/workspace/docker/ubuntu_jdk8_with_camel_ls.json
@@ -0,0 +1,43 @@
+{
+ "environments": {
+ "replaced_name": {
+ "machines": {
+ "dev-machine": {
+ "installers": [
+ "org.eclipse.che.terminal",
+ "org.eclipse.che.ws-agent",
+ "org.eclipse.che.exec",
+ "org.eclipse.che.ls.camel"
+ ],
+ "attributes": {
+ "memoryLimitBytes": "desired_memory_value"
+ },
+ "servers" : {
+ "tomcat8" : {
+ "port" : "8080",
+ "protocol" : "http"
+ },
+ "tomcat8-debug" : {
+ "port" : "8000",
+ "protocol" : "http"
+ },
+ "codeserver" : {
+ "port" : "9876",
+ "protocol" : "http"
+ }
+ }
+ }
+ },
+ "recipe": {
+ "content": "eclipse/ubuntu_jdk8",
+ "type": "dockerimage"
+ }
+ }
+ },
+ "defaultEnv": "replaced_name",
+ "projects": [],
+ "name": "replaced_name",
+ "attributes": {},
+ "temporary": false
+}
+
diff --git a/selenium/che-selenium-test/src/test/resources/templates/workspace/openshift/ubuntu_jdk8_with_camel_ls.json b/selenium/che-selenium-test/src/test/resources/templates/workspace/openshift/ubuntu_jdk8_with_camel_ls.json
new file mode 100644
index 0000000000..eb3bcc8839
--- /dev/null
+++ b/selenium/che-selenium-test/src/test/resources/templates/workspace/openshift/ubuntu_jdk8_with_camel_ls.json
@@ -0,0 +1,43 @@
+{
+ "environments": {
+ "replaced_name": {
+ "machines": {
+ "dev-machine": {
+ "installers": [
+ "org.eclipse.che.terminal",
+ "org.eclipse.che.ws-agent",
+ "org.eclipse.che.exec",
+ "org.eclipse.che.ls.camel"
+ ],
+ "attributes": {
+ "memoryLimitBytes": "desired_memory_value"
+ },
+ "servers" : {
+ "tomcat8" : {
+ "port" : "8080",
+ "protocol" : "http"
+ },
+ "tomcat8-debug" : {
+ "port" : "8000",
+ "protocol" : "http"
+ },
+ "codeserver" : {
+ "port" : "9876",
+ "protocol" : "http"
+ }
+ }
+ }
+ },
+ "recipe": {
+ "content": "eclipse/ubuntu_jdk8",
+ "type": "dockerimage"
+ }
+ }
+ },
+ "defaultEnv": "replaced_name",
+ "projects": [],
+ "name": "replaced_name",
+ "attributes": {},
+ "temporary": false
+}
+