Skip to content

Commit

Permalink
Adapt tests to correct observed behaviour (#10824)
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Mäder <[email protected]>
  • Loading branch information
tsmaeder committed Oct 17, 2018
1 parent 7b5d56f commit 1229990
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,9 @@ public void runActionForTabFromContextMenu(TabActionLocator tabAction) {
* @param text text which should be typed
*/
public void typeTextIntoEditor(String text) {
loader.waitOnClosed();
seleniumWebDriverHelper.sendKeys(text);
loader.waitOnClosed();
}

/**
Expand Down Expand Up @@ -796,6 +798,7 @@ public void launchAutocompleteAndWaitContainer() {

/** Launches code assistant by "ctrl" + "space" keys pressing. */
public void launchAutocomplete() {
loader.waitOnClosed();
Actions action = actionsFactory.createAction(seleniumWebDriver);
action.keyDown(CONTROL).perform();
typeTextIntoEditor(SPACE.toString());
Expand Down Expand Up @@ -1050,7 +1053,7 @@ public void selectItemIntoAutocompleteAndPerformDoubleClick(String item) {
*/
public void selectAutocompleteProposal(String item) {
seleniumWebDriverHelper.waitAndClick(
By.xpath(format(AUTOCOMPLETE_CONTAINER + "/li/span[.='%s']", item)));
By.xpath(format(AUTOCOMPLETE_CONTAINER + "/li/span[text()='%s']", item)));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
package org.eclipse.che.selenium.editor.autocomplete;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;

import com.google.inject.Inject;
import java.io.IOException;
Expand Down Expand Up @@ -96,8 +95,7 @@ public void shouldDisplayJavaDocOfClassMethod() throws Exception {
"concat(String part1, String part2, char divider) : String App");

// then
assertEquals(
editor.getProposalDocumentationHTML(),
editor.waitProposalDocumentationHTML(
"<p><strong>Deprecated</strong> <em>As of version 1.0, use <a href=\"jdt://contents/commons-lang-2.6.jar/org.apache.commons.lang/StringUtils.class?=app/%5C/home%5C/user%5C/.m2%5C/repository%5C/commons-lang%5C/commons-lang%5C/2.6%5C/commons-lang-2.6.jar%3Corg.apache.commons.lang%28StringUtils.class#3169\">org.apache.commons.lang.StringUtils.join(Object [], char)</a></em></p>\n"
+ "<p>Returns concatination of two strings into one divided by special symbol.</p>\n"
+ "<ul>\n"
Expand Down Expand Up @@ -134,7 +132,7 @@ public void shouldWorkAroundAbsentJavaDocOfConstructor() throws IOException {
editor.selectAutocompleteProposal("App() multimodule.App");

// then
assertEquals(editor.getProposalDocumentationHTML(), "<p>No documentation found.</p>\n");
editor.waitProposalDocumentationHTML("<p>No documentation found.</p>\n");
}

@Test
Expand All @@ -147,8 +145,7 @@ public void shouldDisplayAnotherModuleClassJavaDoc() throws IOException {
editor.selectAutocompleteProposal("isEquals(Object o) : boolean Book");

// then
assertEquals(
editor.getProposalDocumentationHTML(),
editor.waitProposalDocumentationHTML(
"<p>Returns <code>true</code> if the argument is equal to instance. otherwise <code>false</code></p>\n"
+ "<ul>\n"
+ "<li><p><strong>Parameters:</strong></p>\n"
Expand Down Expand Up @@ -190,10 +187,7 @@ public void shouldReflectChangesInJavaDoc() throws IOException {
editor.selectAutocompleteProposal("BookImpl - multimodule.model");

// then
assertTrue(
editor
.getProposalDocumentationHTML()
.contains("UPDATE. Implementation of Book interface."));
editor.waitProposalDocumentationHTML("UPDATE. Implementation of Book interface.");
}

@Test
Expand All @@ -206,12 +200,9 @@ public void shouldDisplayJavaDocOfJreClass() throws IOException {
editor.selectAutocompleteProposal("hashCode() : int Object");

// then
assertTrue(
editor
.getProposalDocumentationHTML()
.contains(
"Returns a hash code value for the object. "
+ "This method is supported for the benefit of hash tables such as those provided by"));
editor.waitProposalDocumentationHTML(
"Returns a hash code value for the object. "
+ "This method is supported for the benefit of hash tables such as those provided by");
}

@Test
Expand All @@ -227,7 +218,7 @@ public void shouldWorkAroundAbsentSourcesOfExternalLib() throws IOException {
editor.selectAutocompleteProposal("info(String msg) : void Logger");

// then
assertEquals(editor.getProposalDocumentationHTML(), ".*No documentation found.*");
editor.waitProposalDocumentationHTML(".*No documentation found.*");

// when
editor.closeAutocomplete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void checkAutocompleteFeature() {
editor.typeTextIntoEditor("fmt.");
editor.launchAutocompleteAndWaitContainer();

assertEquals(editor.getProposalDocumentationHTML(), "No documentation found.");
editor.waitProposalDocumentationHTML("<p>No documentation found.</p>\n");
editor.waitProposalsIntoAutocompleteContainer(expectedProposals);

editor.deleteCurrentLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,6 @@ private void checkGoToDefinition() {
editor.goToPosition(25, 20);
menu.runCommand(ASSISTANT, FIND_DEFINITION);
editor.waitActiveTabFileName("testPrint.ts");
editor.waitCursorPosition(15, 6);
editor.waitCursorPosition(15, 1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import static org.eclipse.che.selenium.pageobject.Preferences.DropDownLanguageServerSettings.YAML;
import static org.openqa.selenium.Keys.DELETE;
import static org.openqa.selenium.Keys.ENTER;
import static org.testng.Assert.assertEquals;

import com.google.inject.Inject;
import java.net.URL;
Expand Down Expand Up @@ -126,12 +125,11 @@ public void checkAutocompleteFeature() {
editor.launchAutocompleteAndWaitContainer();
editor.waitProposalIntoAutocompleteContainer("diskName");
editor.selectAutocompleteProposal("diskName");
assertEquals(
editor.getProposalDocumentationHTML(), "The Name of the data disk in the blob storage");
editor.waitProposalDocumentationHTML(
"<p>The Name of the data disk in the blob storage</p>\n", 2);
editor.waitProposalIntoAutocompleteContainer("diskURI");
editor.selectAutocompleteProposal("diskURI");
assertEquals(
editor.getProposalDocumentationHTML(), "The URI the data disk in the blob storage");
editor.waitProposalDocumentationHTML("<p>The URI the data disk in the blob storage</p>\n", 2);

// select proposal and check expected text in the Editor
editor.enterAutocompleteProposal("kind");
Expand Down

0 comments on commit 1229990

Please sign in to comment.