From be2385a437b27874c7dc55b7c8f171adb5537dba Mon Sep 17 00:00:00 2001 From: SkorikSergey Date: Fri, 5 Jan 2018 12:47:05 +0200 Subject: [PATCH] added method for checking that the suggested panel is displayed in the NavigateToFile page object --- .../che/selenium/pageobject/NavigateToFile.java | 15 +++++++++++---- .../miscellaneous/NavigateToFileTest.java | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/NavigateToFile.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/NavigateToFile.java index 0191514f899..f0f046d823f 100644 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/NavigateToFile.java +++ b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/NavigateToFile.java @@ -11,6 +11,7 @@ package org.eclipse.che.selenium.pageobject; import static java.lang.String.format; +import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ELEMENT_TIMEOUT_SEC; import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC; import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC; import static org.openqa.selenium.Keys.ALT; @@ -30,6 +31,7 @@ import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; +import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.WebDriverWait; /** Created by aleksandr shmaraev on 12.12.14. */ @@ -122,11 +124,16 @@ public void waitFileNamePopUp() { * @param text a text that should be into list */ public boolean isFilenameSuggested(String text) { - WebElement webElement = - new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC) - .until(visibilityOf(suggestionPanel)); + return suggestionPanel.getText().contains(text); + } - return webElement.getText().contains(text); + public void waitSuggestedPanelIsDisplayed() { + new WebDriverWait(seleniumWebDriver, ELEMENT_TIMEOUT_SEC) + .until( + (ExpectedCondition) + webDriver -> { + return suggestionPanel.isDisplayed(); + }); } public String getText() { diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/NavigateToFileTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/NavigateToFileTest.java index 4cc997a3246..dd978cd1a4b 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/NavigateToFileTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/NavigateToFileTest.java @@ -144,6 +144,7 @@ private void launchNavigateToFileAndCheckResults( // in tabs) String openedFileNameInTheTab = openedFileWithExtension.replace(".java", ""); launchNavigateToFileFromUIAndTypeValue(navigatingValue); + navigateToFile.waitSuggestedPanelIsDisplayed(); waitExpectedItemsInNavigateToFileDropdawn(expectedItems); navigateToFile.selectFileByName(dropdownVerificationPath); editor.waitActive();