Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selenium: remove info about known 10177 and 10699 issues #11734

Merged
merged 9 commits into from
Oct 26, 2018
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.RULER_LINES;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.RULER_OVERVIEW;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.SELECTED_ITEM_IN_EDITOR;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.SIGNATURES_CONTAINER;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.TAB_CONTEXT_MENU_BODY;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.TAB_FILE_CLOSE_ICON;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.TAB_FILE_NAME_AND_STYLE;
Expand Down Expand Up @@ -77,7 +78,6 @@
import static org.openqa.selenium.support.ui.ExpectedConditions.presenceOfNestedElementLocatedBy;
import static org.openqa.selenium.support.ui.ExpectedConditions.textToBePresentInElementLocated;
import static org.slf4j.LoggerFactory.getLogger;
import static org.testng.Assert.fail;

import com.google.inject.Inject;
import com.google.inject.Singleton;
Expand All @@ -92,7 +92,6 @@
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
Expand Down Expand Up @@ -209,6 +208,7 @@ public interface Locators {
String FOCUSED_TAB_XPATH_TEMPLATE =
"//div[@id='gwt-debug-editor-tab-title' and text()='%s']"
+ "//parent::div[@id='gwt-debug-editor-tab' and @focused]";
String SIGNATURES_CONTAINER = "//div[text()='Signatures:']//following::div/ulist";
}

public enum TabActionLocator {
Expand Down Expand Up @@ -344,6 +344,9 @@ private String get() {
@FindBy(css = LANGUAGE_SERVER_REFACTORING_RENAME_FIELD_CSS)
private WebElement languageServerRenameField;

@FindBy(xpath = SIGNATURES_CONTAINER)
private WebElement signaturesContainer;

/**
* Waits until specified {@code editorTab} is presented, selected, focused and editor activated.
*
Expand Down Expand Up @@ -515,21 +518,10 @@ public String getTextFromHoverPopup() {

/** wait full matching of text in hover popup */
public void waitTextInHoverPopUpEqualsTo(String expectedText) {
// waits popup body visibility
try {
seleniumWebDriverHelper.waitVisibility(hoverPopup);
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known permanent failure: issue https://github.com/eclipse/che/issues/10674", ex);
}
seleniumWebDriverHelper.waitVisibility(hoverPopup);

// waits until text in popup is equals to specified
try {
seleniumWebDriverHelper.waitTextEqualsTo(hoverPopup, expectedText);
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known permanent failure: issue https://github.com/eclipse/che/issues/10117", ex);
}
seleniumWebDriverHelper.waitTextEqualsTo(hoverPopup, expectedText);
}

public void waitHoverPopupAppearance() {
Expand All @@ -542,12 +534,7 @@ public void waitHoverPopupAppearance() {
* @param expectedText the expected text into hover pop-up
*/
public void waitTextInHoverPopup(String expectedText) {
try {
seleniumWebDriverHelper.waitTextContains(hoverPopup, expectedText);
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known issue https://github.com/eclipse/che/issues/10674", ex);
}
seleniumWebDriverHelper.waitTextContains(hoverPopup, expectedText);
}

/**
Expand Down Expand Up @@ -2368,4 +2355,31 @@ public void doRenamingByLanguageServerField(String renameValue) {
seleniumWebDriverHelper.setValue(languageServerRenameField, renameValue);
seleniumWebDriverHelper.waitAndSendKeysTo(languageServerRenameField, Keys.ENTER.toString());
}

public void waitSignaturesContainer() {
seleniumWebDriverHelper.waitVisibility(signaturesContainer, ELEMENT_TIMEOUT_SEC);
}

public void closeSignaturesContainer() {
typeTextIntoEditor(ESCAPE.toString());
waitSignaturesContainerIsClosed();
}

public void waitSignaturesContainerIsClosed() {
seleniumWebDriverHelper.waitInvisibility(signaturesContainer);
}

public String getAllVisibleTextFromSignaturesContainer() {
waitSignaturesContainer();
return signaturesContainer.getText();
}

/**
* Waits specified {@code expectedProposal} in signatures container.
*
* @param expectedProposal text which should be present in the container
*/
public void waitProposalIntoSignaturesContainer(final String expectedProposal) {
seleniumWebDriverHelper.waitTextContains(signaturesContainer, expectedProposal);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.GO_TO_SYMBOL;
import static org.eclipse.che.selenium.core.project.ProjectTemplates.CONSOLE_JAVA_SIMPLE;
import static org.eclipse.che.selenium.core.workspace.WorkspaceTemplate.APACHE_CAMEL;
import static org.testng.Assert.fail;

import com.google.inject.Inject;
import java.net.URL;
Expand All @@ -28,6 +29,7 @@
import org.eclipse.che.selenium.pageobject.Ide;
import org.eclipse.che.selenium.pageobject.Menu;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.openqa.selenium.TimeoutException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -106,7 +108,13 @@ public void checkAutocompleteFeature() {
public void checkHoverFeature() {
// move cursor on text and check expected text in hover popup
editor.moveCursorToText("velocity");
editor.waitTextInHoverPopup("Transforms the message using a Velocity template.");

try {
editor.waitTextInHoverPopup("Transforms the message using a Velocity template.");
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known random failure https://github.com/eclipse/che/issues/10674", ex);
}
}

@Test(priority = 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.FORMAT;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR;
import static org.openqa.selenium.Keys.F4;
import static org.testng.Assert.fail;

import com.google.inject.Inject;
import java.net.URL;
Expand All @@ -34,7 +33,6 @@
import org.eclipse.che.selenium.pageobject.Menu;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.openqa.selenium.Keys;
import org.openqa.selenium.TimeoutException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -114,12 +112,12 @@ public void checkCodeValidation() {
editor.deleteCurrentLineAndInsertNew();
editor.typeTextIntoEditor(" std::abs(");

try {
editor.waitExpTextIntoShowHintsPopUp("abs(int __x) -> int");
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known permanent failure https://github.com/eclipse/che/issues/10699", ex);
}
editor.waitSignaturesContainer();
editor.waitProposalIntoSignaturesContainer("abs(int __x) -> int");
editor.closeSignaturesContainer();
editor.waitSignaturesContainerIsClosed();

editor.deleteCurrentLineAndInsertNew();
}

@Test(priority = 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,13 @@ public void checkFindDefinitionFeature() {

// check the 'Hover' popup
editor.moveCursorToText("COLOR_YELLOW");
editor.waitTextInHoverPopup("const COLOR_YELLOW string = \"\\x1b[33;1m \"");

try {
editor.waitTextInHoverPopup("const COLOR_YELLOW string = \"\\x1b[33;1m \"");
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known random failure https://github.com/eclipse/che/issues/10674", ex);
}

// check Find Definition feature from Assistant menu
editor.goToPosition(24, 8);
Expand Down Expand Up @@ -251,13 +257,12 @@ public void checkSignatureHelpFeature() {
editor.goToPosition(27, 1);
editor.typeTextIntoEditor(" hanoi(");

try {
editor.waitExpTextIntoShowHintsPopUp("hanoi(n int, a, b, c string)");
} catch (TimeoutException ex) {
editor.deleteCurrentLineAndInsertNew();
// remove try-catch block after issue has been resolved
fail("Known permanent failure https://github.com/eclipse/che/issues/10699", ex);
}
editor.waitSignaturesContainer();
editor.waitProposalIntoSignaturesContainer("hanoi(n int, a, b, c string)");
editor.closeSignaturesContainer();
editor.waitSignaturesContainerIsClosed();

editor.deleteCurrentLineAndInsertNew();
}

@Test(priority = 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import org.eclipse.che.selenium.pageobject.Menu;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriverException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -158,11 +157,10 @@ public void checkSignatureHelpProvider() {
editor.typeTextIntoEditor(ENTER.toString());
editor.typeTextIntoEditor("printVar.print(");

try {
editor.waitExpTextIntoShowHintsPopUp("setValue: string");
} catch (WebDriverException ex) {
fail("Known permanent failure https://github.com/eclipse/che/issues/10699", ex);
}
editor.waitSignaturesContainer();
editor.waitProposalIntoSignaturesContainer("print(setVAlue: string): void");
editor.closeSignaturesContainer();
editor.waitSignaturesContainerIsClosed();
}

@Test(priority = 6, alwaysRun = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
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.fail;

import com.google.inject.Inject;
import java.net.URL;
Expand All @@ -43,6 +44,7 @@
import org.eclipse.che.selenium.pageobject.Preferences;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.openqa.selenium.Keys;
import org.openqa.selenium.TimeoutException;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -176,10 +178,10 @@ public void checkHoverFeature() {

// move cursor on text and check expected text in hover popup
editor.moveCursorToText("namespace:");
editor.waitTextInHoverPopup("Namespace defines the space within each name must be unique.");
waitTextInHoverPopup("Namespace defines the space within each name must be unique.");

editor.moveCursorToText("kind:");
editor.waitTextInHoverPopup(
waitTextInHoverPopup(
"Kind is a string value representing the REST resource this object represents.");

editor.moveCursorToText("apiVersion:");
Expand All @@ -199,13 +201,13 @@ public void checkCodeValidation() {
editor.typeTextIntoEditor("a");
editor.waitTextElementsActiveLine("aapiVersion: v1");
editor.moveCursorToText("aapiVersion");
editor.waitTextInHoverPopup("Unexpected property aapiVersion");
waitTextInHoverPopup("Unexpected property aapiVersion");

editor.goToPosition(13, 1);
editor.typeTextIntoEditor(DELETE.toString());
editor.waitAllMarkersInvisibility(ERROR);
editor.moveCursorToText("apiVersion");
editor.waitTextInHoverPopup(
waitTextInHoverPopup(
"APIVersion defines the versioned schema of this representation of an object.");
}

Expand Down Expand Up @@ -297,4 +299,13 @@ private void deleteSchema() {

preferences.close();
}

private void waitTextInHoverPopup(String expectedText) {
try {
editor.waitTextInHoverPopup(expectedText);
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known random failure https://github.com/eclipse/che/issues/10674", ex);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,9 @@ public void setUp() throws Exception {
public void checkHoveringFeature() {
String expectedTextInHoverPopUp =
"System.Console\nRepresents the standard input, output, and error streams for console applications. This class cannot be inherited.";
editor.moveCursorToText("Console");
try {

editor.waitTextInHoverPopUpEqualsTo(expectedTextInHoverPopUp);
} catch (TimeoutException ex) {
fail("Known permanent failure: https://github.com/eclipse/che/issues/10117", ex);
}
editor.moveCursorToText("Console");
editor.waitTextInHoverPopUpEqualsTo(expectedTextInHoverPopUp);
}

@Test(priority = 1, alwaysRun = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import static org.openqa.selenium.Keys.ARROW_LEFT;
import static org.openqa.selenium.Keys.CONTROL;
import static org.openqa.selenium.Keys.ENTER;
import static org.testng.Assert.fail;

import com.google.inject.Inject;
import java.net.URL;
Expand All @@ -38,7 +37,6 @@
import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.openqa.selenium.Keys;
import org.openqa.selenium.TimeoutException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

Expand All @@ -50,8 +48,7 @@ public class PhpAssistantFeaturesTest {
"/*\n" + " * Copyright (c) 2012-2018 Red Hat, Inc.";
private static final String EXPECTED_COMMENTED_TEXT =
"/*\n" + "// * Copyright (c) 2012-2018 Red Hat, Inc.";
private static final String EXPECTED_HOVER_POPUP_TEXT =
"php\n" + "<?php function sayHello($name) {\n";
private static final String EXPECTED_HOVER_POPUP_TEXT = "<?php function sayHello($name) {";
private static final String EXPECTED_REFERENCE_TEXT =
PROJECT + "/index.php\n" + "From:15:6 To:15:14";
private static final String EXPECTED_TEXT_AFTER_TYPING =
Expand Down Expand Up @@ -144,9 +141,13 @@ public void signatureShouldBeDisplayed() {
editor.typeTextIntoEditor(ENTER.toString());
editor.waitCursorPosition(16, 1);
editor.typeTextIntoEditor(TEXT_FOR_HOVERING + "(");
editor.waitTextIntoEditor(EXPECTED_TEXT_AFTER_TYPING);
waitExpectedTextIntoShowHintsPopup(EXPECTED_HINT_TEXT);
editor.deleteCurrentLine();

editor.waitSignaturesContainer();
editor.waitProposalIntoSignaturesContainer(EXPECTED_HINT_TEXT);
editor.closeSignaturesContainer();
editor.waitSignaturesContainerIsClosed();

editor.deleteCurrentLineAndInsertNew();
}

@Test
Expand Down Expand Up @@ -178,13 +179,4 @@ private void performCommentAction() {
String comment = Keys.chord(CONTROL, "/");
seleniumWebDriverHelper.sendKeys(comment);
}

private void waitExpectedTextIntoShowHintsPopup(String expectedText) {
try {
editor.waitExpTextIntoShowHintsPopUp(expectedText);
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known permanent failure https://github.com/eclipse/che/issues/10699", ex);
}
}
}
Loading