Search in sources :

Example 1 with FluentWebElement

use of org.seleniumhq.selenium.fluent.FluentWebElement in project selenium_java by sergueik.

the class AngularAndWebDriverTest method stress_test.

/*
	  Ported from protractor/stress/spec.js
	 */
@Test(enabled = false)
public void stress_test() {
    FluentWebDriver fwd = new FluentWebDriver(driver);
    for (int i = 0; i < 20; ++i) {
        resetBrowser();
        driver.get("http://localhost:8080/index.html#/form");
        FluentWebElement usernameInput = fwd.input(ByAngular.model("username"));
        FluentWebElement name = fwd.span(ByAngular.binding("username"));
        ngWebDriver.waitForAngularRequestsToFinish();
        name.getText().shouldBe("Anon");
        usernameInput.clearField().sendKeys("B");
        name.getText().shouldBe("B");
    }
}
Also used : FluentWebDriver(org.seleniumhq.selenium.fluent.FluentWebDriver) FluentWebElement(org.seleniumhq.selenium.fluent.FluentWebElement) Test(org.testng.annotations.Test)

Example 2 with FluentWebElement

use of org.seleniumhq.selenium.fluent.FluentWebElement in project selenium_java by sergueik.

the class AngularAndWebDriverTest method basic_actions.

/*
	  Ported from protractor/spec/basic/action_spec.js
	 */
@Test(enabled = true)
public void basic_actions() {
    FluentWebDriver fwd = new FluentWebDriver(driver);
    driver.get("http://localhost:8080/index.html#/form");
    ngWebDriver.waitForAngularRequestsToFinish();
    FluentWebElement sliderBar = fwd.input(By.name("points"));
    sliderBar.getAttribute("value").shouldBe("1");
    new Actions(driver).dragAndDropBy(sliderBar.getWebElement(), 400, 20).build().perform();
    sliderBar.getAttribute("value").shouldBe("10");
}
Also used : FluentWebDriver(org.seleniumhq.selenium.fluent.FluentWebDriver) Actions(org.openqa.selenium.interactions.Actions) FluentWebElement(org.seleniumhq.selenium.fluent.FluentWebElement) Test(org.testng.annotations.Test)

Example 3 with FluentWebElement

use of org.seleniumhq.selenium.fluent.FluentWebElement in project selenium_java by sergueik.

the class AngularAndWebDriverTest method basic_elements_should_allow_using_repeater_locator_within_map.

/*
	  Ported from protractor/spec/basic/elements_spec.js
	  TODO - many more specs in here
	 */
@SuppressWarnings("serial")
@Test(enabled = false)
public void basic_elements_should_allow_using_repeater_locator_within_map() {
    FluentWebDriver fwd = new FluentWebDriver(driver);
    driver.get("http://localhost:8080/index.html#/repeater");
    Map<String, String> expected = new HashMap<String, String>() {

        {
            put("M", "Monday");
            put("T", "Tuesday");
            put("W", "Wednesday");
            put("Th", "Thursday");
            put("F", "Friday");
        }
    };
    Map<String, String> days = fwd.lis(ByAngular.repeater("allinfo in days")).map(new FluentWebElementMap<String, String>() {

        public void map(FluentWebElement elem, int ix) {
            put(elem.element(ByAngular.binding("allinfo.initial")).getText().toString(), elem.element(ByAngular.binding("allinfo.name")).getText().toString());
        }
    });
    assertThat(days.entrySet(), equalTo(expected.entrySet()));
}
Also used : FluentWebDriver(org.seleniumhq.selenium.fluent.FluentWebDriver) HashMap(java.util.HashMap) FluentWebElement(org.seleniumhq.selenium.fluent.FluentWebElement) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.testng.annotations.Test)

Example 4 with FluentWebElement

use of org.seleniumhq.selenium.fluent.FluentWebElement in project selenium_java by sergueik.

the class BookAFlightTest method a_booking_through_to_united_affiliate.

@Test
public void a_booking_through_to_united_affiliate() {
    new Home(wd) {

        {
            fromAirportField().sendKeys("DAL");
            waitForExpandoToComplete();
            toAirportField().sendKeys("IAH");
            timeBizOperation("DAL->IAH Initial Search Results");
            searchButton().click();
        }
    };
    new SearchResults(wd) {

        {
            waitForFlightListFor("DAL\nIAH");
            bizOperationTiming.end(true);
            timeBizOperation("DAL->IAH Return Leg Search Results");
            firstShownLeg().click();
            waitForFlightListFor("IAH\nDAL");
            bizOperationTiming.end(true);
            firstShownLeg().click();
            new BookingOverlay(wd) {

                {
                    hipmunkWindowHandle = delegate.getWindowHandle();
                    FluentWebElement unitedRow = unitedRow();
                    claimedUnitedPrice = Integer.parseInt(unitedRow.div().getText().toString().replace("$", ""));
                    timeBizOperation("DAL->IAH United.com Transfer");
                    // purchase
                    unitedRow.link().click();
                    changeWebDriverWindow(delegate);
                }
            };
        }
    };
    new UnitedAirlinesBooking(wd) {

        {
            // includes cents
            float actualPrice = getActualPrice();
            assertThat("price", Math.round(actualPrice), equalTo(claimedUnitedPrice));
            bizOperationTiming.end(true);
        }
    };
}
Also used : FluentWebElement(org.seleniumhq.selenium.fluent.FluentWebElement) Test(org.junit.Test)

Example 5 with FluentWebElement

use of org.seleniumhq.selenium.fluent.FluentWebElement in project BuildRadiator by BuildRadiator.

the class RadiatorWebDriverTest method confirmDataRefreshes.

@Test
public void confirmDataRefreshes() {
    Radiator rad = rad("xxx", "sseeccrreett", stepNames("A"), build("1", "running", 0, step("A", 0, "running")));
    app = new TestVersionOfBuildRadiatorApp(rad).withFasterRefresh();
    startAppAndOpenWebDriverOnRadiatorPage(CONTRIVED_PATH_FOR_TESTING + "#xxx/Main_Project_Trunk_Build");
    final FluentWebElement rootDiv = FWD.within(secs(2)).div();
    rootDiv.getText().within(secs(2)).shouldContain("(running)");
    rad.stepPassed("1", "A");
    FWD.trs().get(1).getText().within(secs(4)).shouldContain("(passed)");
    rootDiv.getText().shouldNotContain("(running)");
}
Also used : FluentWebElement(org.seleniumhq.selenium.fluent.FluentWebElement) Radiator(com.paulhammant.buildradiator.radiator.model.Radiator)

Aggregations

FluentWebElement (org.seleniumhq.selenium.fluent.FluentWebElement)6 FluentWebDriver (org.seleniumhq.selenium.fluent.FluentWebDriver)4 Test (org.testng.annotations.Test)4 Radiator (com.paulhammant.buildradiator.radiator.model.Radiator)1 HashMap (java.util.HashMap)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 Test (org.junit.Test)1 Actions (org.openqa.selenium.interactions.Actions)1