Search in sources :

Example 6 with MyPage

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

the class AbstractWebElementProxyTest method findByClassName_getBirthday_returnsWebElementValueAttribute.

@Test
public void findByClassName_getBirthday_returnsWebElementValueAttribute() {
    when(website.findElement(By.className("birthday"))).thenReturn(new WebElementWrapper(webElement));
    when(webElement.getAttribute("value")).thenReturn("birthday");
    MyPage myPage = newInstance(MyPage.class, website);
    String birthday = myPage.getBirthday();
    assertThat(birthday).isEqualTo("birthday");
}
Also used : MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 7 with MyPage

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

the class AbstractWebElementProxyTest method findByCss_birthday_returnsWebElement.

@Test
public void findByCss_birthday_returnsWebElement() {
    when(website.findElement(By.cssSelector(".birthday"))).thenReturn(new WebElementWrapper(webElement));
    MyPage myPage = newInstance(MyPage.class, website);
    WebElementWrapper birthday = myPage.birthday();
    assertThat(birthday.webElement()).isEqualTo(webElement);
}
Also used : MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 8 with MyPage

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

the class AbstractWebElementProxyTest method findByWithoutArguments_nothing_whenCanHandleIsTrue_returnsNull.

@Test
public void findByWithoutArguments_nothing_whenCanHandleIsTrue_returnsNull() {
    when(webElementProxy.canHandle(any(Method.class))).thenReturn(true);
    MyPage myPage = newInstance(MyPage.class, website);
    String undefined = myPage.nothing();
    assertThat(undefined).isNull();
}
Also used : Method(java.lang.reflect.Method) MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 9 with MyPage

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

the class AbstractWebElementProxyTest method findById_getName_returnsWebElementText.

@Test
public void findById_getName_returnsWebElementText() {
    when(website.findElement(By.id("name"))).thenReturn(new WebElementWrapper(webElement));
    when(webElement.getText()).thenReturn("name");
    MyPage myPage = newInstance(MyPage.class, website);
    String name = myPage.getName();
    assertThat(name).isEqualTo("name");
}
Also used : MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 10 with MyPage

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

the class AbstractWebElementProxyTest method findByPartialLinkText_address_returnsTableElement.

@Test
public void findByPartialLinkText_address_returnsTableElement() {
    when(website.findElement(By.partialLinkText("Address"))).thenReturn(new WebElementWrapper(webElement));
    MyPage myPage = newInstance(MyPage.class, website);
    WebElementWrapper address = myPage.address();
    assertThat(address.webElement()).isSameAs(webElement);
}
Also used : 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