Search in sources :

Example 1 with SubPage

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

Example 2 with SubPage

use of org.definitylabs.flue2ent.data.SubPage 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);
}
Also used : SubPage(org.definitylabs.flue2ent.data.SubPage) WebElement(org.openqa.selenium.WebElement) 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)2 SubPage (org.definitylabs.flue2ent.data.SubPage)2 WebElementWrapper (org.definitylabs.flue2ent.element.WebElementWrapper)2 Test (org.junit.Test)2 WebElement (org.openqa.selenium.WebElement)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2