Search in sources :

Example 11 with MyPage

use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.

the class AbstractWebElementProxyTest method args_elementByClassName_throwsException.

@Test
public void args_elementByClassName_throwsException() {
    MyPage myPage = newInstance(MyPage.class, website);
    expectedException.expect(IllegalArgumentException.class);
    expectedException.expectMessage("All parameters should be annotated with @Param");
    myPage.elementByClassName("session");
}
Also used : MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 12 with MyPage

use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.

the class AbstractWebElementProxyTest method findByValue_genderMale_returnsWebElement.

@Test
public void findByValue_genderMale_returnsWebElement() {
    when(website.findElement(ExtendedBy.byValue("MALE"))).thenReturn(new WebElementWrapper(webElement));
    MyPage myPage = newInstance(MyPage.class, website);
    WebElementWrapper genderMale = myPage.genderMale();
    assertThat(genderMale.webElement()).isSameAs(webElement);
}
Also used : MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 13 with MyPage

use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.

the class AbstractWebElementProxyTest method list_links_returnsWebElementList.

@Test
public void list_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 = 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");
}
Also used : WebElement(org.openqa.selenium.WebElement) MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 14 with MyPage

use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.

the class AbstractWebElementProxyTest method findByButton_submit_returnsWebElement.

@Test
public void findByButton_submit_returnsWebElement() {
    when(website.findElement(ExtendedBy.byButton("Submit"))).thenReturn(new WebElementWrapper(webElement));
    MyPage myPage = newInstance(MyPage.class, website);
    WebElementWrapper submit = myPage.submit();
    assertThat(submit.webElement()).isSameAs(webElement);
}
Also used : MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 15 with MyPage

use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.

the class PageObjectProxyTest method findByElement_returnsWebElement.

@Test
public void findByElement_returnsWebElement() {
    when(website.findElement(By.name("age"))).thenReturn(new WebElementWrapper(webElement));
    MyPage myPage = PageObjectProxy.newInstance(MyPage.class, website);
    WebElementWrapper age = myPage.age();
    assertThat(age.webElement()).isEqualTo(webElement);
}
Also used : WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) 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