Example usage for org.openqa.selenium.support.ui ExpectedConditions visibilityOfElementLocated

List of usage examples for org.openqa.selenium.support.ui ExpectedConditions visibilityOfElementLocated

Introduction

In this page you can find the example usage for org.openqa.selenium.support.ui ExpectedConditions visibilityOfElementLocated.

Prototype

public static ExpectedCondition<WebElement> visibilityOfElementLocated(final By locator) 

Source Link

Document

An expectation for checking that an element is present on the DOM of a page and visible.

Usage

From source file:org.eclipse.che.selenium.factory.CheckFactoryWithSvnCVSTest.java

License:Open Source License

@Test
public void checkFactoryProcessing() throws Exception {
    // given/*from   w  w  w.  j  av  a 2  s. co  m*/
    String expectedProject = "SvnFactory";
    List<String> expectedItemsInProjectTree = Arrays.asList("commit-test", "copy", "move", "properties-test",
            "newfile", "test");

    // when
    testFactory.authenticateAndOpen(ide.driver());
    seleniumWebDriver.switchFromDashboardIframeToIde();

    // then
    new WebDriverWait(ide.driver(), LOADER_TIMEOUT_SEC).until(
            ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[text()='SVN Authentication']")));

    subversion.svnLogin(svnUsernameProvider.get(), svnPasswordProvider.get());

    try {
        notifications.waitExpectedMessageOnProgressPanelAndClosed("Project " + expectedProject + " imported");
    } catch (org.openqa.selenium.TimeoutException e) {
        events.clickProjectEventsTab();
        events.waitExpectedMessage("Project " + expectedProject + " imported");
    }

    projectExplorer.openItemByPath(expectedProject);
    for (String item : expectedItemsInProjectTree) {
        projectExplorer.waitItem(expectedProject + "/" + item);
    }
}

From source file:org.eclipse.che.selenium.intelligencecommand.PreviewUrlIntoCommandsEditorTest.java

License:Open Source License

private void checkPageOpenedByPreviewUrl() {
    new WebDriverWait(seleniumWebDriver, TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC).until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//nav[@class='menu-desktop']//a[text()='Technology']")));
    new WebDriverWait(seleniumWebDriver, TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC).until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//nav[@class='menu-desktop']//a[text()='Docs']")));
    new WebDriverWait(seleniumWebDriver, TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC).until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//nav[@class='menu-desktop']//a[text()='Get Started']")));
}

From source file:org.eclipse.che.selenium.miscellaneous.CheckCreatingProjectInEmptyWsTest.java

License:Open Source License

@Test(priority = 1)
public void checkImportAndCreatingFromEditorPanel() {
    WebDriverWait waitForWebElements = new WebDriverWait(ide.driver(), LOAD_PAGE_TIMEOUT_SEC);
    String locatorToEditorContaiPaineId = "//div[@id='gwt-debug-editorMultiPartStack-contentPanel']";
    String locatorToImportProjectLnk = locatorToEditorContaiPaineId + "//div[text()='Import Project...']";
    String locatorToCreateProjectLnk = locatorToEditorContaiPaineId + "//div[text()='Create Project...']";

    loader.waitOnClosed();/*from ww w . j a va2  s.  c o m*/
    waitForWebElements.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(locatorToImportProjectLnk)))
            .click();
    importProjectFromLocation.closeWithIcon();
    waitForWebElements.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(locatorToCreateProjectLnk)))
            .click();
    wizard.closeWithIcon();

    waitForWebElements
            .until(ExpectedConditions.visibilityOfElementLocated((By.xpath(locatorToEditorContaiPaineId))))
            .click();
    try {
        actionsFactory.createAction(ide.driver()).sendKeys(Keys.ALT.toString() + "x").perform();
        wizard.closeWithIcon();
    } catch (org.openqa.selenium.TimeoutException e) {
        actionsFactory.createAction(ide.driver()).sendKeys(Keys.ALT.toString() + "x").perform();
        wizard.closeWithIcon();
    }
    waitForWebElements.until(
            ExpectedConditions.visibilityOf(ide.driver().findElement(By.xpath(locatorToEditorContaiPaineId))))
            .click();
    try {
        actionsFactory.createAction(ide.driver()).sendKeys(Keys.ALT.toString() + Keys.SHIFT.toString() + "A")
                .perform();
        importProjectFromLocation.closeWithIcon();
    } catch (org.openqa.selenium.TimeoutException e) {
        actionsFactory.createAction(ide.driver()).sendKeys(Keys.ALT.toString() + Keys.SHIFT.toString() + "A")
                .perform();
        importProjectFromLocation.closeWithIcon();
    }
}

From source file:org.eclipse.che.selenium.miscellaneous.CheckRestoringWorkspaceAfterStoppingWsAgentProcess.java

License:Open Source License

@Test(priority = 0)
public void checkRestoreWsAgentByApi() throws Exception {
    String expectedMessageOInDialog = "Workspace agent is no longer responding. To fix the problem, restart the workspace.";
    projectExplorer.waitItem(PROJECT_NAME);
    toastLoader.waitAppeareanceAndClosing();
    projectExplorer.invokeCommandWithContextMenu(ProjectExplorer.CommandsGoal.COMMON, PROJECT_NAME,
            nameCommandForKillWsAgent);/* w w  w  .ja  va2 s  .co  m*/
    new WebDriverWait(seleniumWebDriver, WIDGET_TIMEOUT_SEC).until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//span[text()='" + expectedMessageOInDialog + "']")));
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.visibilityOfElementLocated(By.id("ask-dialog-first"))).click();
    testWorkspaceServiceClient.waitStatus(workspace.getName(), defaultTestUser.getName(), RUNNING);
}

From source file:org.eclipse.che.selenium.miscellaneous.CheckWsAgentAfterStopProcessTest.java

License:Open Source License

@Test
public void checkDialogAfterKillingProcess() throws Exception {
    String expectedMessageOInDialog = "Workspace agent is no longer responding. To fix the problem, restart the workspace.";
    projectExplorer.waitItem(PROJECT_NAME);
    toastLoader.waitAppeareanceAndClosing();
    projectExplorer.invokeCommandWithContextMenu(ProjectExplorer.CommandsGoal.COMMON, PROJECT_NAME,
            nameCommandForKillWsAgent);//from  w w  w.jav a2  s.c  om
    new WebDriverWait(ide.driver(), LOAD_PAGE_TIMEOUT_SEC * 3).until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//span[text()='" + expectedMessageOInDialog + "']")));
    new WebDriverWait(ide.driver(), REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.visibilityOfElementLocated(By.id("ask-dialog-first"))).click();
    projectExplorer.waitItem(PROJECT_NAME);
    events.clickProjectEventsTab();
    events.waitExpectedMessage(TestWorkspaceConstants.RUNNING_WORKSPACE_MESS);
}

From source file:org.eclipse.che.selenium.pageobject.CodenvyEditor.java

License:Open Source License

/** Scroll autocomplete form to the bottom */
public void scrollAutocompleteFormToBottom() {
    webDriverWaitFactory.get(ELEMENT_TIMEOUT_SEC)
            .until(ExpectedConditions
                    .visibilityOfElementLocated(By.xpath(Locators.AUTOCOMPLETE_CONTAINER + "/li[2]")))
            .sendKeys(Keys.END);/*from   w w  w.j  a v  a2 s.c om*/
}

From source file:org.eclipse.che.selenium.pageobject.ConfigureClasspath.java

License:Open Source License

/** wait the 'Configure Classpath' form is open */
public void waitConfigureClasspathFormIsOpen() {
    loader.waitOnClosed();//  www  .ja  v a2s .  c o  m
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(CONFIGURE_CLASSPATH_FORM)));
}

From source file:org.eclipse.che.selenium.pageobject.ConfigureClasspath.java

License:Open Source License

/** close the 'Configure Classpath' form by click on the close icon */
public void closeConfigureClasspathFormByIcon() {
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(CONFIGURE_CLASSPATH_CLOSE_ICON)))
            .click();/*from   ww w.  j  ava 2 s .c  om*/
    waitConfigureClasspathFormIsClosed();
}

From source file:org.eclipse.che.selenium.pageobject.ConfigureClasspath.java

License:Open Source License

/** click on the 'Java Build Path' */
public void clickOnJavaBuildPathHeader() {
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.visibilityOfElementLocated(By.id(JAVA_BUILD_PATH))).click();
}

From source file:org.eclipse.che.selenium.pageobject.ConfigureClasspath.java

License:Open Source License

/** select the 'Libraries' category */
public void selectLibrariesCategory() {
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.visibilityOfElementLocated(By.id(LIBRARIES_CATEGORY))).click();
    loader.waitOnClosed();/*from   w w  w.ja  v  a2  s. co  m*/
}