use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.
the class AbstractWebElementProxyTest method findByLabel_login_returnsWebElement.
@Test
public void findByLabel_login_returnsWebElement() {
when(website.findElement(ExtendedBy.byLabel("Login"))).thenReturn(new WebElementWrapper(webElement));
MyPage myPage = newInstance(MyPage.class, website);
WebElementWrapper login = myPage.login();
assertThat(login.webElement()).isSameAs(webElement);
}
use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.
the class AbstractWebElementProxyTest method findByTagName_results_returnsTableElement.
@Test
public void findByTagName_results_returnsTableElement() {
when(website.findElement(By.tagName("table"))).thenReturn(new WebElementWrapper(webElement));
MyPage myPage = newInstance(MyPage.class, website);
TableElement results = myPage.results();
assertThat(results.webElement().webElement()).isSameAs(webElement);
}
use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.
the class PageObjectProxyTest method webProxy_subPage_returnsWebElement.
@Test
public void webProxy_subPage_returnsWebElement() {
WebElement h1Element = mock(WebElement.class);
when(website.findElement(By.cssSelector(".subPage"))).thenReturn(new WebElementWrapper(webElement));
when(website.findElement(By.tagName("h1"))).thenReturn(new WebElementWrapper(h1Element));
MyPage myPage = PageObjectProxy.newInstance(MyPage.class, website);
SubPage subPage = myPage.subPage();
assertThat(subPage.title().webElement()).isSameAs(h1Element);
}
use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.
the class PageObjectProxyTest method findByCssUsingProxy_nothing_returnsWebElement.
@Test
public void findByCssUsingProxy_nothing_returnsWebElement() {
WebElement h1Element = mock(WebElement.class);
when(website.findElement(By.cssSelector(".subPage"))).thenReturn(new WebElementWrapper(webElement));
when(website.findElement(By.tagName("h1"))).thenReturn(new WebElementWrapper(h1Element));
MyPage myPage = PageObjectProxy.newInstance(MyPage.class, website);
SubPage subPage = myPage.subPage();
assertThat(subPage.title().webElement()).isSameAs(h1Element);
}
use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.
the class PageObjectProxyTest method findByElements_links_returnsWebElementList.
@Test
public void findByElements_links_returnsWebElementList() {
WebElement linkOne = mock(WebElement.class);
when(linkOne.getText()).thenReturn("Link One");
WebElement linkTwo = mock(WebElement.class);
when(linkTwo.getText()).thenReturn("Link Two");
when(website.findElements(By.tagName("a"))).thenReturn(Arrays.asList(new WebElementWrapper(linkOne), new WebElementWrapper(linkTwo)));
MyPage myPage = PageObjectProxy.newInstance(MyPage.class, website);
List<String> links = myPage.links();
assertThat(links).hasSize(2);
assertThat(links.get(0)).isEqualTo("Link One");
assertThat(links.get(1)).isEqualTo("Link Two");
}
Aggregations