Search in sources :

Example 1 with SelectElement

use of org.definitylabs.flue2ent.element.list.SelectElement in project flue2ent by DefinityLabs.

the class AbstractWebElementProxyTest method list_rows_returnsWebElementList.

@Test
public void list_rows_returnsWebElementList() {
    WebElement selectOne = mock(WebElement.class);
    WebElement selectTwo = mock(WebElement.class);
    when(website.findElements(By.tagName("select"))).thenReturn(Arrays.asList(new WebElementWrapper(selectOne), new WebElementWrapper(selectTwo)));
    MyPage myPage = newInstance(MyPage.class, website);
    List<SelectElement> selects = myPage.selects();
    assertThat(selects).hasSize(2);
    assertThat(selects.get(0).webElement().webElement()).isSameAs(selectOne);
    assertThat(selects.get(1).webElement().webElement()).isSameAs(selectTwo);
}
Also used : SelectElement(org.definitylabs.flue2ent.element.list.SelectElement) WebElement(org.openqa.selenium.WebElement) MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 2 with SelectElement

use of org.definitylabs.flue2ent.element.list.SelectElement in project flue2ent by DefinityLabs.

the class WebElementConverterTest method convertTo_whenAttributeIsEmptyAndReturnTypeIsSelectElement_returnsSelectElement.

@Test
public void convertTo_whenAttributeIsEmptyAndReturnTypeIsSelectElement_returnsSelectElement() throws Exception {
    WebElement webElement = mock(WebElement.class);
    WebElementWrapper webElementWrapper = new WebElementWrapper(webElement);
    Select select = mock(Select.class);
    PowerMockito.whenNew(Select.class).withAnyArguments().thenReturn(select);
    SelectElement selectElement = (SelectElement) WebElementConverter.convertTo(webElementWrapper, "", SelectElement.class);
    assertThat(selectElement.webElement()).isEqualTo(webElementWrapper);
}
Also used : SelectElement(org.definitylabs.flue2ent.element.list.SelectElement) Select(org.openqa.selenium.support.ui.Select) WebElement(org.openqa.selenium.WebElement) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

SelectElement (org.definitylabs.flue2ent.element.list.SelectElement)2 Test (org.junit.Test)2 WebElement (org.openqa.selenium.WebElement)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 MyPage (org.definitylabs.flue2ent.data.MyPage)1 Select (org.openqa.selenium.support.ui.Select)1