Fix unstable tests from miscellaneous package (#6503)
* fixes for unstables tests: FindUsagesBaseOperationTest, FileStructureNodesTest * changed way of oppening java class in FileStructureNodesTest6.19.x
parent
34ba429d58
commit
03decf4602
|
|
@ -10,6 +10,7 @@
|
|||
*/
|
||||
package org.eclipse.che.selenium.pageobject;
|
||||
|
||||
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 com.google.inject.Inject;
|
||||
|
|
@ -64,13 +65,13 @@ public class NavigateToFile {
|
|||
|
||||
/** wait opening of 'Navigate to file' widget */
|
||||
public void waitFormToOpen() {
|
||||
new WebDriverWait(seleniumWebDriver, 10)
|
||||
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
|
||||
.until(ExpectedConditions.visibilityOf(navigateToFileForm));
|
||||
}
|
||||
|
||||
/** wait closing of 'Navigate to file' widget */
|
||||
public void waitFormToClose() {
|
||||
new WebDriverWait(seleniumWebDriver, 10)
|
||||
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
|
||||
.until(
|
||||
ExpectedConditions.invisibilityOfElementLocated(By.id(Locators.NAVIGATE_TO_FILE_FORM)));
|
||||
}
|
||||
|
|
@ -95,7 +96,8 @@ public class NavigateToFile {
|
|||
*/
|
||||
public void typeSymbolInFileNameField(String symbol) {
|
||||
loader.waitOnClosed();
|
||||
new WebDriverWait(seleniumWebDriver, 10).until(ExpectedConditions.visibilityOf(fileNameInput));
|
||||
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
|
||||
.until(ExpectedConditions.visibilityOf(fileNameInput));
|
||||
fileNameInput.clear();
|
||||
fileNameInput.sendKeys(symbol);
|
||||
}
|
||||
|
|
@ -106,13 +108,14 @@ public class NavigateToFile {
|
|||
* @param symbol the first symbol of search with key word
|
||||
*/
|
||||
public void typeSymbolWithoutClear(String symbol) {
|
||||
new WebDriverWait(seleniumWebDriver, 10).until(ExpectedConditions.visibilityOf(fileNameInput));
|
||||
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
|
||||
.until(ExpectedConditions.visibilityOf(fileNameInput));
|
||||
fileNameInput.sendKeys(symbol);
|
||||
}
|
||||
|
||||
/** wait appearance of the dropdawn list (may be empty) */
|
||||
public void waitFileNamePopUp() {
|
||||
new WebDriverWait(seleniumWebDriver, 10)
|
||||
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
|
||||
.until(ExpectedConditions.visibilityOf(suggestionPanel));
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +125,7 @@ public class NavigateToFile {
|
|||
* @param text a text that should be into list
|
||||
*/
|
||||
public void waitListOfFilesNames(final String text) {
|
||||
new WebDriverWait(seleniumWebDriver, 10)
|
||||
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
|
||||
.until((ExpectedCondition<Boolean>) webDriver -> suggestionPanel.getText().contains(text));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ package org.eclipse.che.selenium.miscellaneous;
|
|||
import com.google.inject.Inject;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Random;
|
||||
import org.eclipse.che.commons.lang.NameGenerator;
|
||||
import org.eclipse.che.selenium.core.client.TestProjectServiceClient;
|
||||
import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants;
|
||||
import org.eclipse.che.selenium.core.project.ProjectTemplates;
|
||||
|
|
@ -28,7 +28,7 @@ import org.testng.annotations.Test;
|
|||
|
||||
/** @author Aleksandr Shmaraev on 12.12.15 */
|
||||
public class FileStructureNodesTest {
|
||||
private static final String PROJECT_NAME = "FileStructureNodes" + new Random().nextInt(999);
|
||||
private static final String PROJECT_NAME = NameGenerator.generate("FileStructureNodes", 4);
|
||||
private static final String JAVA_FILE_NAME = "Company";
|
||||
private static final String INNER_CLASS_NAME = "CompanyHelper";
|
||||
private static final String INTERFACE_NAME = "Inter";
|
||||
|
|
@ -117,8 +117,9 @@ public class FileStructureNodesTest {
|
|||
@Test
|
||||
public void checkFileStructureNodes() {
|
||||
projectExplorer.waitProjectExplorer();
|
||||
projectExplorer.openItemByPath(PROJECT_NAME);
|
||||
expandTReeProjectAndOpenClass(JAVA_FILE_NAME);
|
||||
projectExplorer.waitItem(PROJECT_NAME);
|
||||
projectExplorer.quickExpandWithJavaScript();
|
||||
projectExplorer.openItemByVisibleNameInExplorer("Company.java");
|
||||
|
||||
// check work nodes in the 'file structure' by double click
|
||||
menu.runCommand(
|
||||
|
|
@ -140,7 +141,14 @@ public class FileStructureNodesTest {
|
|||
fileStructure.selectItemInFileStructureByDoubleClick(JAVA_FILE_NAME);
|
||||
fileStructure.waitExpectedTextIsNotPresentInFileStructure(ITEMS_CLASS);
|
||||
fileStructure.selectItemInFileStructureByDoubleClick(JAVA_FILE_NAME);
|
||||
fileStructure.waitExpectedTextInFileStructure(ITEMS_CLASS_1);
|
||||
//try-catch was added because test fails while trying to open node by double click action
|
||||
//issue: https://github.com/eclipse/che/issues/6499
|
||||
try {
|
||||
fileStructure.waitExpectedTextInFileStructure(ITEMS_CLASS_1);
|
||||
} catch (org.openqa.selenium.TimeoutException ex) {
|
||||
fileStructure.selectItemInFileStructureByDoubleClick(JAVA_FILE_NAME);
|
||||
fileStructure.waitExpectedTextInFileStructure(ITEMS_CLASS_1);
|
||||
}
|
||||
|
||||
// check work nodes in the 'file structure' by click on the icon
|
||||
fileStructure.clickOnIconNodeInFileStructure(INNER_CLASS_NAME);
|
||||
|
|
@ -159,23 +167,17 @@ public class FileStructureNodesTest {
|
|||
fileStructure.clickOnIconNodeInFileStructure(JAVA_FILE_NAME);
|
||||
fileStructure.waitExpectedTextIsNotPresentInFileStructure(ITEMS_INNER_CLASS);
|
||||
fileStructure.waitExpectedTextIsNotPresentInFileStructure(ITEMS_INTERFACE);
|
||||
fileStructure.clickOnIconNodeInFileStructure(INNER_CLASS_NAME);
|
||||
//try-catch was added because test fails while trying to open node by click action
|
||||
//issue: https://github.com/eclipse/che/issues/6499
|
||||
try {
|
||||
fileStructure.clickOnIconNodeInFileStructure(INNER_CLASS_NAME);
|
||||
} catch (org.openqa.selenium.TimeoutException ex) {
|
||||
fileStructure.clickOnIconNodeInFileStructure(JAVA_FILE_NAME);
|
||||
fileStructure.waitExpectedTextIsNotPresentInFileStructure(ITEMS_INNER_CLASS);
|
||||
fileStructure.waitExpectedTextIsNotPresentInFileStructure(ITEMS_INTERFACE);
|
||||
fileStructure.clickOnIconNodeInFileStructure(INNER_CLASS_NAME);
|
||||
}
|
||||
fileStructure.clickOnIconNodeInFileStructure(INTERFACE_NAME);
|
||||
fileStructure.waitExpectedTextInFileStructure(ITEMS_CLASS);
|
||||
}
|
||||
|
||||
public void expandTReeProjectAndOpenClass(String fileName) {
|
||||
projectExplorer.openItemByPath(PROJECT_NAME + "/src");
|
||||
projectExplorer.waitItem(PROJECT_NAME + "/src" + "/main");
|
||||
projectExplorer.openItemByPath(PROJECT_NAME + "/src" + "/main");
|
||||
projectExplorer.waitItem(PROJECT_NAME + "/src" + "/main" + "/java");
|
||||
projectExplorer.openItemByPath(PROJECT_NAME + "/src" + "/main" + "/java");
|
||||
projectExplorer.waitItem(PROJECT_NAME + "/src" + "/main" + "/java" + "/com/codenvy/qa");
|
||||
projectExplorer.openItemByPath(PROJECT_NAME + "/src" + "/main" + "/java" + "/com/codenvy/qa");
|
||||
projectExplorer.waitItem(
|
||||
PROJECT_NAME + "/src" + "/main" + "/java" + "/com/codenvy/qa/" + fileName + ".java");
|
||||
projectExplorer.openItemByPath(
|
||||
PROJECT_NAME + "/src" + "/main" + "/java" + "/com/codenvy/qa/" + fileName + ".java");
|
||||
editor.waitActiveEditor();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,8 @@ public class FindUsagesBaseOperationTest {
|
|||
public void checkFindUsagesBaseOperation() {
|
||||
projectExplorer.waitProjectExplorer();
|
||||
projectExplorer.waitItem(PROJECT_NAME);
|
||||
projectExplorer.expandPathInProjectExplorerAndOpenFile(PATH_FOR_EXPAND, "AppController.java");
|
||||
projectExplorer.quickExpandWithJavaScript();
|
||||
projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
|
||||
|
||||
// Check basic operations of the 'find usages' panel
|
||||
editor.selectTabByName("AppController");
|
||||
|
|
@ -116,8 +117,17 @@ public class FindUsagesBaseOperationTest {
|
|||
findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_2);
|
||||
findUsages.clickOnIconNodeInFindUsagesPanel("AppController");
|
||||
findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_2);
|
||||
findUsages.clickOnIconNodeInFindUsagesPanel(
|
||||
"handleRequest(HttpServletRequest, HttpServletResponse)");
|
||||
//try-catch was added because test fails while trying to open node by click action
|
||||
//issue: https://github.com/eclipse/che/issues/6499
|
||||
try {
|
||||
findUsages.clickOnIconNodeInFindUsagesPanel(
|
||||
"handleRequest(HttpServletRequest, HttpServletResponse)");
|
||||
} catch (org.openqa.selenium.TimeoutException ex) {
|
||||
findUsages.clickOnIconNodeInFindUsagesPanel("AppController");
|
||||
findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_2);
|
||||
findUsages.clickOnIconNodeInFindUsagesPanel(
|
||||
"handleRequest(HttpServletRequest, HttpServletResponse)");
|
||||
}
|
||||
findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT_2);
|
||||
|
||||
// Check nodes in the 'find usages' panel by 'Enter'
|
||||
|
|
|
|||
Loading…
Reference in New Issue