use of org.seleniumhq.selenium.fluent.FluentWebDriver in project selenium_java by sergueik.
the class AngularAndWebDriverTest method basic_locators_by_repeater_should_find_one_row_by_partial_match.
/*
Ported from protractor/spec/basic/locators_spec.js
TODO - many more specs in here
*/
@Test(enabled = false)
public void basic_locators_by_repeater_should_find_one_row_by_partial_match() {
FluentWebDriver fwd = new FluentWebDriver(driver);
driver.get("http://localhost:8080/index.html#/repeater");
fwd.li(ByAngular.repeater("baz in days | filter:'T'").row(0)).getText().shouldBe("T");
fwd.li(ByAngular.repeater("baz in days | filter:'T'").row(1)).getText().shouldBe("Th");
fwd.li(ByAngular.repeater("baz in days | filt").row(1)).getText().shouldBe("Th");
try {
fwd.li(ByAngular.exactRepeater("baz in days | filt").row(1)).getText().shouldBe("T");
fail("should have barfed");
} catch (FluentExecutionStopped e) {
assertThat(e.getMessage(), startsWith("NoSuchElementException during invocation of: ?.li(exactRepeater(baz in days | filt).row(1))"));
assertThat(e.getCause().getMessage(), startsWith("exactRepeater(baz in days | filt).row(1) didn't have any matching elements at this place in the DOM"));
}
}
use of org.seleniumhq.selenium.fluent.FluentWebDriver in project selenium_java by sergueik.
the class AngularAndWebDriverTest method basic_locators_by_repeater_should_find_by_partial_match.
/*
Ported from protractor/spec/basic/locators_spec.js
TODO - many more specs in here
*/
@Test(enabled = false)
public void basic_locators_by_repeater_should_find_by_partial_match() {
FluentWebDriver fwd = new FluentWebDriver(driver);
driver.get("http://localhost:8080/index.html#/repeater");
fwd.span(ByAngular.repeater("baz in days | filter:'T'").row(0).column("baz.initial")).getText().shouldBe("T");
fwd.span(ByAngular.repeater("baz in days | fil").row(0).column("baz.initial")).getText().shouldBe("T");
try {
fwd.li(ByAngular.exactRepeater("baz in days | fil").row(0).column("baz.initial")).getText().shouldBe("T");
fail("should have barfed");
} catch (FluentExecutionStopped e) {
assertThat(e.getMessage(), startsWith("NoSuchElementException during invocation of: ?.li(exactRepeater(baz in days | fil).row(0).column(baz.initial))"));
assertThat(e.getCause().getMessage(), startsWith("exactRepeater(baz in days | fil).row(0).column(baz.initial) didn't have any matching elements at this place in the DOM"));
}
}
use of org.seleniumhq.selenium.fluent.FluentWebDriver in project selenium_java by sergueik.
the class AngularAndWebDriverTest method basic_locators_by_repeater_should_find_many_rows_by_partial_match.
/*
Ported from protractor/spec/basic/locators_spec.js
TODO - many more specs in here
*/
@Test(enabled = false)
public void basic_locators_by_repeater_should_find_many_rows_by_partial_match() {
FluentWebDriver fwd = new FluentWebDriver(driver);
driver.get("http://localhost:8080/index.html#/repeater");
FluentWebElements spans = fwd.spans(ByAngular.repeater("baz in days | filter:'T'").column("baz.initial"));
spans.getText().shouldBe("TTh");
spans.get(0).getText().shouldBe("T");
spans.get(1).getText().shouldBe("Th");
spans = fwd.spans(ByAngular.repeater("baz in days | fil").column("baz.initial"));
spans.getText().shouldBe("TTh");
spans.get(0).getText().shouldBe("T");
spans.get(1).getText().shouldBe("Th");
try {
fwd.li(ByAngular.exactRepeater("baz in days | fil").column("baz.initial")).getText().shouldBe("TTh");
fail("should have barfed");
} catch (FluentExecutionStopped e) {
assertThat(e.getMessage(), startsWith("NoSuchElementException during invocation of: ?.li(exactRepeater(baz in days | fil).column(baz.initial))"));
assertThat(e.getCause().getMessage(), startsWith("exactRepeater(baz in days | fil).column(baz.initial) didn't have any matching elements at this place in the DOM"));
}
}
use of org.seleniumhq.selenium.fluent.FluentWebDriver in project selenium_java by sergueik.
the class AngularAndWebDriverTest method basic_lib_getLocationAbsUrl_gets_url.
/*
Ported from protractor/spec/basic/lib_spec.js
TODO - many more specs in here
*/
@Test(enabled = false)
public void basic_lib_getLocationAbsUrl_gets_url() {
FluentWebDriver fwd = new FluentWebDriver(driver);
driver.get("http://localhost:8080/index.html");
assertThat(ngWebDriver.getLocationAbsUrl(), endsWith("/form"));
fwd.link(By.linkText("repeater")).click();
assertThat(ngWebDriver.getLocationAbsUrl(), endsWith("/repeater"));
}
use of org.seleniumhq.selenium.fluent.FluentWebDriver 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");
}
}
Aggregations