use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.
the class AbstractWebElementProxyTest method findByName_age_returnsWebElement.
@Test
public void findByName_age_returnsWebElement() {
when(website.findElement(By.name("age"))).thenReturn(new WebElementWrapper(webElement));
MyPage myPage = newInstance(MyPage.class, website);
WebElementWrapper age = myPage.age();
assertThat(age.webElement()).isEqualTo(webElement);
}
use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.
the class AbstractWebElementProxyTest method findByLabelContaining_password_returnsWebElement.
@Test
public void findByLabelContaining_password_returnsWebElement() {
when(website.findElement(ExtendedBy.byLabelContaining("Password or PIN"))).thenReturn(new WebElementWrapper(webElement));
MyPage myPage = newInstance(MyPage.class, website);
WebElementWrapper password = myPage.password();
assertThat(password.webElement()).isSameAs(webElement);
}
use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.
the class AbstractWebElementProxyTest method findByXpath_getBirthDate_throwsException.
@Test
public void findByXpath_getBirthDate_throwsException() {
when(website.findElement(By.xpath("//input[name()='birthday']"))).thenReturn(new WebElementWrapper(webElement));
when(webElement.getAttribute("value")).thenReturn("birthday");
MyPage myPage = newInstance(MyPage.class, website);
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("return type should be String");
myPage.getBirthDate();
}
use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.
the class AbstractWebElementProxyTest method noAnnotation_nothing_throwsException.
@Test
public void noAnnotation_nothing_throwsException() {
MyPage myPage = newInstance(MyPage.class, website);
expectedException.expect(RuntimeException.class);
expectedException.expectMessage("Method not implemented");
myPage.nothing();
}
use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.
the class AbstractWebElementProxyTest method list_rows_returnsWebElementList.
@Test
public void list_rows_returnsWebElementList() {
WebElement selectOne = mock(WebElement.class);
WebElement selectTwo = mock(WebElement.class);
when(website.findElements(By.tagName("select"))).thenReturn(Arrays.asList(new WebElementWrapper(selectOne), new WebElementWrapper(selectTwo)));
MyPage myPage = newInstance(MyPage.class, website);
List<SelectElement> selects = myPage.selects();
assertThat(selects).hasSize(2);
assertThat(selects.get(0).webElement().webElement()).isSameAs(selectOne);
assertThat(selects.get(1).webElement().webElement()).isSameAs(selectTwo);
}
Aggregations