Search in sources :

Example 36 with WebElementWrapper

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

the class PageObjectProxyTest method findByElements_links_returnsWebElementList.

@Test
public void findByElements_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 = PageObjectProxy.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) WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 37 with WebElementWrapper

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

the class ListElementTest method new_returnsListElement.

@Test
public void new_returnsListElement() {
    ListElement listElement = new ListElement(new WebElementWrapper(webElement));
    assertThat(listElement.byItem).isEqualTo(By.tagName("li"));
}
Also used : WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Test(org.junit.Test)

Example 38 with WebElementWrapper

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

the class ListElementTest method createListItem_returnsNewListItemElement.

@Test
public void createListItem_returnsNewListItemElement() {
    ListElement listElement = new ListElement(new WebElementWrapper(webElement));
    WebElement webElementItem = mock(WebElement.class);
    WebElementWrapper webElementWrapper = new WebElementWrapper(webElementItem);
    ListItemElement listItem = listElement.createListItem(webElementWrapper);
    assertThat(listItem.webElement()).isSameAs(webElementWrapper);
}
Also used : WebElement(org.openqa.selenium.WebElement) WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Test(org.junit.Test)

Example 39 with WebElementWrapper

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

the class SelectElementTest method isMultiple_callsIsMultiple.

@Test
public void isMultiple_callsIsMultiple() {
    SelectElement selectElement = new SelectElement(new WebElementWrapper(webElement));
    when(select.isMultiple()).thenReturn(true);
    boolean multiple = selectElement.isMultiple();
    verify(select).isMultiple();
    assertThat(multiple).isTrue();
}
Also used : WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 40 with WebElementWrapper

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

the class TableRowElementTest method beforeEach.

@Before
public void beforeEach() {
    webElementWrapper = new WebElementWrapper(webElement);
    table = new AbstractTableElement<TableRowElement<TableColumnElement>, TableColumnElement>(webElementWrapper) {

        @Override
        protected TableRowElement<TableColumnElement> createRow(WebElementWrapper webElement) {
            return new TableRowElement<>(webElement, this);
        }

        @Override
        protected TableColumnElement createColumn(WebElementWrapper webElement) {
            return new TableColumnElement(webElement, this);
        }
    };
}
Also used : WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Before(org.junit.Before)

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