Search in sources :

Example 1 with MyPage

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);
}
Also used : MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 2 with MyPage

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);
}
Also used : MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 3 with MyPage

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();
}
Also used : MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 4 with MyPage

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();
}
Also used : MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 5 with MyPage

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);
}
Also used : SelectElement(org.definitylabs.flue2ent.element.list.SelectElement) WebElement(org.openqa.selenium.WebElement) MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

MyPage (org.definitylabs.flue2ent.data.MyPage)25 Test (org.junit.Test)25 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)25 WebElement (org.openqa.selenium.WebElement)6 WebElementWrapper (org.definitylabs.flue2ent.element.WebElementWrapper)4 SubPage (org.definitylabs.flue2ent.data.SubPage)2 Method (java.lang.reflect.Method)1 SelectElement (org.definitylabs.flue2ent.element.list.SelectElement)1 TableElement (org.definitylabs.flue2ent.element.table.TableElement)1