Search in sources :

Example 1 with FluentWebElement

use of org.fluentlenium.core.domain.FluentWebElement in project incubator-dubbo-ops by apache.

the class ServicePage method checkDetailForService.

public ServicePage checkDetailForService(String fullName) {
    await().until(serviceSearchInput).displayed();
    serviceSearchInput.fill().with(fullName);
    serviceSearchButton.click();
    await().untilPredicate(p -> serviceList.asList().size() > 0);
    for (FluentWebElement row : serviceList.asList()) {
        for (FluentWebElement td : row.find(By.cssSelector("td"))) {
            if (StringUtils.contains(fullName, td.text())) {
                row.find(By.cssSelector("a.success")).first().click();
                break;
            }
        }
    }
    await().untilPredicate(p -> basicContainer.text().contains("dubbo-admin-integration-provider"));
    return this;
}
Also used : FluentWebElement(org.fluentlenium.core.domain.FluentWebElement)

Example 2 with FluentWebElement

use of org.fluentlenium.core.domain.FluentWebElement in project archiva by apache.

the class WebDriverBrowseTest method simpletest.

@Test
public void simpletest() throws Exception {
    Properties p = new Properties();
    p.load(this.getClass().getClassLoader().getResourceAsStream("test.properties"));
    String baseUrl = WebdriverUtility.getBaseUrl();
    String url = baseUrl + "/index.html?request_lang=en";
    goTo(url);
    // wait until topbar-menu-container is feeded
    await().atMost(5, TimeUnit.SECONDS).untilPredicate((fl) -> $("#topbar-menu").present());
    await().atMost(10, TimeUnit.SECONDS).untilPredicate((fl) -> el("#create-admin-link-a").conditions().clickable() || el("#login-link-a").conditions().clickable());
    FluentList<FluentWebElement> elements = find("#create-admin-link-a");
    if (!elements.isEmpty() && elements.get(0).displayed()) {
        WebElement webElement = elements.get(0).getElement();
        Assert.assertEquals("Create Admin User", webElement.getText());
        webElement.click();
        await().atMost(2, TimeUnit.SECONDS).untilPredicate((fl) -> $("#user-create").present());
        assertThat(find("#username").value().equals("admin"));
        assertThat(find("#password").value().isEmpty());
        assertThat(find("#confirmPassword").value().isEmpty());
        assertThat(find("#email").value().isEmpty());
        $("#fullname").fill().with(p.getProperty("ADMIN_FULLNAME"));
        $("#email").fill().with(p.getProperty("ADMIN_EMAIL"));
        $("#password").fill().with(p.getProperty("ADMIN_PASSWORD"));
        $("#confirmPassword").fill().with(p.getProperty("ADMIN_PASSWORD"));
        find("#user-create-form-register-button").click();
        await().atMost(2, TimeUnit.SECONDS).untilPredicate((fl) -> $("#logout-link").present());
        FluentList<FluentWebElement> elementss = find("#menu-find-browse-a");
        WebElement webElsement = elementss.get(0).getElement();
        webElsement.click();
        await().atMost(5, TimeUnit.SECONDS).untilPredicate((fl) -> $("#main_browse_result").present());
        // give me search page :( not  browse page
        takeScreenShot("search.png");
        goTo(baseUrl + "/index.html#browse?request_lang=en");
        takeScreenShot("browse.png");
    // give me a browse page
    } else {
        elements = find(By.id("login-link-a"));
        WebElement webElement = elements.get(0).getElement();
        if (getDriver() instanceof HtmlUnitDriver) {
            Assert.assertEquals("LOGIN", webElement.getText().toUpperCase());
        } else {
            Assert.assertEquals("LOGIN", webElement.getText());
        }
    }
}
Also used : FluentWebElement(org.fluentlenium.core.domain.FluentWebElement) ConfigurationProperties(org.fluentlenium.configuration.ConfigurationProperties) Properties(java.util.Properties) WebElement(org.openqa.selenium.WebElement) FluentWebElement(org.fluentlenium.core.domain.FluentWebElement) HtmlUnitDriver(org.openqa.selenium.htmlunit.HtmlUnitDriver) Test(org.junit.Test) FluentTest(org.fluentlenium.adapter.junit.FluentTest)

Example 3 with FluentWebElement

use of org.fluentlenium.core.domain.FluentWebElement in project archiva by apache.

the class WebDriverTest method simpletest.

@Test
public void simpletest() throws Exception {
    String url = WebdriverUtility.getBaseUrl() + "/index.html?request_lang=en";
    goTo(url);
    // wait until topbar-menu-container is feeded
    // await().atMost(20, TimeUnit.SECONDS).until($("#topbar-menu")).present();
    await().untilPredicate((fl) -> $("#topbar-menu").present());
    await().atMost(10, TimeUnit.SECONDS).untilPredicate((fl) -> el("#create-admin-link-a").conditions().clickable() || el("#login-link-a").conditions().clickable());
    FluentList<FluentWebElement> elements = find("#create-admin-link-a");
    if (!elements.isEmpty() && elements.get(0).displayed()) {
        WebElement webElement = elements.get(0).getElement();
        Assert.assertEquals("Create Admin User", webElement.getText());
    } else {
        elements = find(By.id("login-link-a"));
        for (FluentWebElement element : elements) {
            log.info("Found login link: " + element.getElement().getTagName() + " " + element.getElement().getText());
        }
        WebElement webElement = elements.get(0).getElement();
        if (getDriver() instanceof HtmlUnitDriver) {
            Assert.assertEquals("LOGIN", webElement.getText().toUpperCase());
        } else {
            Assert.assertEquals("LOGIN", webElement.getText());
        }
    }
}
Also used : FluentWebElement(org.fluentlenium.core.domain.FluentWebElement) WebElement(org.openqa.selenium.WebElement) FluentWebElement(org.fluentlenium.core.domain.FluentWebElement) HtmlUnitDriver(org.openqa.selenium.htmlunit.HtmlUnitDriver) Test(org.junit.Test) FluentTest(org.fluentlenium.adapter.junit.FluentTest)

Example 4 with FluentWebElement

use of org.fluentlenium.core.domain.FluentWebElement in project incubator-dubbo-ops by apache.

the class ManagePage method showConfigDetailFor.

public ManagePage showConfigDetailFor(String name) {
    await().untilPredicate(p -> configList.asList().size() > 0);
    for (FluentWebElement row : configList.asList()) {
        for (FluentWebElement td : row.find(By.cssSelector("td"))) {
            if (td.text().equalsIgnoreCase(name)) {
                for (FluentWebElement i : row.find(By.tagName("i"))) {
                    if (i.text().equalsIgnoreCase("visibility")) {
                        i.click();
                        await().until(configCard).displayed();
                        return this;
                    }
                }
            }
        }
    }
    throw new RuntimeException("can't load detail");
}
Also used : FluentWebElement(org.fluentlenium.core.domain.FluentWebElement)

Example 5 with FluentWebElement

use of org.fluentlenium.core.domain.FluentWebElement in project incubator-dubbo-ops by apache.

the class ServicePage method checkTestDetailForService.

public ServicePage checkTestDetailForService(String fullName) {
    await().until(serviceSearchInput).displayed();
    serviceSearchInput.fill().with(fullName);
    serviceSearchButton.click();
    await().untilPredicate(p -> serviceList.asList().size() > 0);
    for (FluentWebElement row : serviceList.asList()) {
        for (FluentWebElement td : row.find(By.cssSelector("td"))) {
            if (StringUtils.contains(fullName, td.text())) {
                row.find(By.cssSelector("a.v-btn--depressed")).first().click();
                break;
            }
        }
    }
    await().untilPredicate(p -> testMethodList.asList().size() > 0);
    return this;
}
Also used : FluentWebElement(org.fluentlenium.core.domain.FluentWebElement)

Aggregations

FluentWebElement (org.fluentlenium.core.domain.FluentWebElement)5 FluentTest (org.fluentlenium.adapter.junit.FluentTest)2 Test (org.junit.Test)2 WebElement (org.openqa.selenium.WebElement)2 HtmlUnitDriver (org.openqa.selenium.htmlunit.HtmlUnitDriver)2 Properties (java.util.Properties)1 ConfigurationProperties (org.fluentlenium.configuration.ConfigurationProperties)1