use of org.definitylabs.flue2ent.data.FakeTableElement in project flue2ent by DefinityLabs.
the class WebElementConverterTest method convertTo__returnsSelectElement.
@Test
public void convertTo__returnsSelectElement() throws Exception {
WebElement rowElementOne = mock(WebElement.class);
WebElement rowElementTwo = mock(WebElement.class);
WebElement webElement = mock(WebElement.class);
WebElementWrapper webElementWrapper = new WebElementWrapper(webElement);
when(webElement.findElements(By.className("row"))).thenReturn(Arrays.asList(rowElementOne, rowElementTwo));
FakeTableElement fakeTableElement = (FakeTableElement) WebElementConverter.convertTo(webElementWrapper, "", FakeTableElement.class);
assertThat(fakeTableElement.rows()).hasSize(2);
assertThat(fakeTableElement.rows().get(0).webElement()).isEqualTo(rowElementOne);
assertThat(fakeTableElement.rows().get(1).webElement()).isEqualTo(rowElementTwo);
}
use of org.definitylabs.flue2ent.data.FakeTableElement in project flue2ent by DefinityLabs.
the class SimpleWebElementDecoratorProxyTest method findElements_rows_returnsWebElementList.
@Test
public void findElements_rows_returnsWebElementList() {
WebElement rowElementOne = mock(WebElement.class);
WebElement rowElementTwo = mock(WebElement.class);
when(webElement.findElements(By.className("row"))).thenReturn(Arrays.asList(rowElementOne, rowElementTwo));
WebElementWrapper webElementWrapper = new WebElementWrapper(webElement);
FakeTableElement fakeTableElement = SimpleWebElementDecoratorProxy.newInstance(FakeTableElement.class, webElementWrapper);
List<WebElementWrapper> rows = fakeTableElement.rows();
assertThat(rows).hasSize(2);
assertThat(rows.get(0).webElement()).isSameAs(rowElementOne);
assertThat(rows.get(1).webElement()).isSameAs(rowElementTwo);
}
use of org.definitylabs.flue2ent.data.FakeTableElement in project flue2ent by DefinityLabs.
the class SimpleWebElementDecoratorProxyTest method webElement_returnsWebElementWrapperFromDecorator.
@Test
public void webElement_returnsWebElementWrapperFromDecorator() {
WebElementWrapper webElementWrapper = new WebElementWrapper(webElement);
FakeTableElement fakeTableElement = SimpleWebElementDecoratorProxy.newInstance(FakeTableElement.class, webElementWrapper);
WebElementWrapper fakeTableWebElement = fakeTableElement.webElement();
assertThat(fakeTableWebElement).isSameAs(webElementWrapper);
}
use of org.definitylabs.flue2ent.data.FakeTableElement in project flue2ent by DefinityLabs.
the class WebElementWrapperTest method as_whenDecoratorIsSmart_returnsDecorator.
@Test
public void as_whenDecoratorIsSmart_returnsDecorator() {
WebElementWrapper wrapper = new WebElementWrapper(webElement);
FakeTableElement fakeTableElement = wrapper.as(FakeTableElement.class);
assertThat(fakeTableElement).isNotNull();
Assertions.assertThat(fakeTableElement.webElement()).isSameAs(wrapper);
}
use of org.definitylabs.flue2ent.data.FakeTableElement in project flue2ent by DefinityLabs.
the class SimpleWebElementDecoratorProxyTest method findElement_headerRow_returnsNestedElement.
@Test
public void findElement_headerRow_returnsNestedElement() {
WebElement rowElement = mock(WebElement.class);
when(webElement.findElement(By.cssSelector(".header .row:nth-child(0)"))).thenReturn(rowElement);
WebElementWrapper webElementWrapper = new WebElementWrapper(webElement);
FakeTableElement fakeTableElement = SimpleWebElementDecoratorProxy.newInstance(FakeTableElement.class, webElementWrapper);
WebElementWrapper rowElementWrapper = fakeTableElement.headerRow(0);
assertThat(rowElementWrapper.webElement()).isSameAs(rowElement);
}
Aggregations