Search in sources :

Example 31 with WebElementWrapper

use of org.definitylabs.flue2ent.element.WebElementWrapper in project flue2ent by DefinityLabs.

the class TableColumnElementTest method table_returnsTableElement.

@Test
public void table_returnsTableElement() {
    WebElementWrapper webElement = mock(WebElementWrapper.class);
    AbstractTableElement<TableRowElement<TableColumnElement>, TableColumnElement> mockedTable = mock(AbstractTableElement.class);
    TableColumnElement tableColumnElement = new TableColumnElement(webElement, mockedTable);
    assertThat(tableColumnElement.table).isSameAs(mockedTable);
}
Also used : WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Test(org.junit.Test)

Example 32 with WebElementWrapper

use of org.definitylabs.flue2ent.element.WebElementWrapper in project flue2ent by DefinityLabs.

the class TableElementTest method createColumn_returnsTableColumnElement.

@Test
public void createColumn_returnsTableColumnElement() {
    WebElementWrapper mockedWebElement = mock(WebElementWrapper.class);
    TableElement table = new TableElement(mockedWebElement);
    TableColumnElement column = table.createColumn(mockedWebElement);
    assertThat(column).isNotNull();
    assertThat(column.webElement()).isSameAs(mockedWebElement);
    assertThat(column.table).isSameAs(table);
}
Also used : WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Test(org.junit.Test)

Example 33 with WebElementWrapper

use of org.definitylabs.flue2ent.element.WebElementWrapper in project flue2ent by DefinityLabs.

the class FindRowByColumnTest method beforeEach.

@Before
public void beforeEach() {
    tableWebElement = mock(WebElement.class);
    columnWebElement = mock(WebElement.class);
    rowWebElement = mock(WebElement.class);
    when(rowWebElement.findElements(By.tagName("td"))).thenReturn(Collections.singletonList(columnWebElement));
    when(tableWebElement.findElements(By.tagName("tr"))).thenReturn(Collections.singletonList(rowWebElement));
    table = new TableElement(new WebElementWrapper(tableWebElement));
    row = table.row(0);
}
Also used : WebElement(org.openqa.selenium.WebElement) TableElement(org.definitylabs.flue2ent.element.table.TableElement) WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Before(org.junit.Before)

Example 34 with WebElementWrapper

use of org.definitylabs.flue2ent.element.WebElementWrapper 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 35 with WebElementWrapper

use of org.definitylabs.flue2ent.element.WebElementWrapper 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

WebElementWrapper (org.definitylabs.flue2ent.element.WebElementWrapper)40 Test (org.junit.Test)35 WebElement (org.openqa.selenium.WebElement)16 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)15 FakeTableElement (org.definitylabs.flue2ent.data.FakeTableElement)5 Before (org.junit.Before)5 MyPage (org.definitylabs.flue2ent.data.MyPage)4 FindElementBy (org.definitylabs.flue2ent.element.FindElementBy)4 By (org.openqa.selenium.By)4 SubPage (org.definitylabs.flue2ent.data.SubPage)2 List (java.util.List)1 TableElement (org.definitylabs.flue2ent.element.table.TableElement)1 Dimension (org.openqa.selenium.Dimension)1 Point (org.openqa.selenium.Point)1 StaleElementReferenceException (org.openqa.selenium.StaleElementReferenceException)1 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)1