Adapt tests to correct observed behaviour (#10824)

Signed-off-by: Thomas Mäder <tmader@redhat.com>
6.19.x
Thomas Mäder 2018-08-21 16:55:56 +02:00
parent 1ff2367ca0
commit 7d17dae249
5 changed files with 17 additions and 25 deletions

View File

@ -681,7 +681,9 @@ public class CodenvyEditor {
* @param text text which should be typed
*/
public void typeTextIntoEditor(String text) {
loader.waitOnClosed();
seleniumWebDriverHelper.sendKeys(text);
loader.waitOnClosed();
}
/**
@ -796,6 +798,7 @@ public class CodenvyEditor {
/** 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());
@ -1050,7 +1053,7 @@ public class CodenvyEditor {
*/
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)));
}
/**

View File

@ -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;
@ -96,8 +95,7 @@ public class AutocompleteProposalJavaDocTest {
"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"
@ -134,7 +132,7 @@ public class AutocompleteProposalJavaDocTest {
editor.selectAutocompleteProposal("App() multimodule.App");
// then
assertEquals(editor.getProposalDocumentationHTML(), "<p>No documentation found.</p>\n");
editor.waitProposalDocumentationHTML("<p>No documentation found.</p>\n");
}
@Test
@ -147,8 +145,7 @@ public class AutocompleteProposalJavaDocTest {
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"
@ -190,10 +187,7 @@ public class AutocompleteProposalJavaDocTest {
editor.selectAutocompleteProposal("BookImpl - multimodule.model");
// then
assertTrue(
editor
.getProposalDocumentationHTML()
.contains("UPDATE. Implementation of Book interface."));
editor.waitProposalDocumentationHTML("UPDATE. Implementation of Book interface.");
}
@Test
@ -206,12 +200,9 @@ public class AutocompleteProposalJavaDocTest {
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
@ -227,7 +218,7 @@ public class AutocompleteProposalJavaDocTest {
editor.selectAutocompleteProposal("info(String msg) : void Logger");
// then
assertEquals(editor.getProposalDocumentationHTML(), ".*No documentation found.*");
editor.waitProposalDocumentationHTML(".*No documentation found.*");
// when
editor.closeAutocomplete();

View File

@ -132,7 +132,7 @@ public class GolangFileEditingTest {
editor.typeTextIntoEditor("fmt.");
editor.launchAutocompleteAndWaitContainer();
assertEquals(editor.getProposalDocumentationHTML(), "No documentation found.");
editor.waitProposalDocumentationHTML("<p>No documentation found.</p>\n");
editor.waitProposalsIntoAutocompleteContainer(expectedProposals);
editor.deleteCurrentLine();

View File

@ -252,6 +252,6 @@ public class TypeScriptEditingTest {
editor.goToPosition(25, 20);
menu.runCommand(ASSISTANT, FIND_DEFINITION);
editor.waitActiveTabFileName("testPrint.ts");
editor.waitCursorPosition(15, 6);
editor.waitCursorPosition(15, 1);
}
}

View File

@ -26,7 +26,6 @@ import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ER
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;
@ -126,12 +125,11 @@ public class YamlFileEditingTest {
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");