Search in sources :

Example 11 with WebElementWrapper

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

the class SelectElementTest method deselectByVisibleText_callsDeselectByVisibleText.

@Test
public void deselectByVisibleText_callsDeselectByVisibleText() {
    String text = "text";
    SelectElement selectElement = new SelectElement(new WebElementWrapper(webElement));
    SelectElement result = selectElement.deselectByVisibleText(text);
    verify(select).deselectByVisibleText(text);
    assertThat(result).isSameAs(selectElement);
}
Also used : WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 12 with WebElementWrapper

use of org.definitylabs.flue2ent.element.WebElementWrapper 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);
}
Also used : FakeTableElement(org.definitylabs.flue2ent.data.FakeTableElement) WebElement(org.openqa.selenium.WebElement) WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Test(org.junit.Test)

Example 13 with WebElementWrapper

use of org.definitylabs.flue2ent.element.WebElementWrapper 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);
}
Also used : FakeTableElement(org.definitylabs.flue2ent.data.FakeTableElement) WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Test(org.junit.Test)

Example 14 with WebElementWrapper

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

the class TableColumnElementTest method text_returnsWebElementText.

@Test
public void text_returnsWebElementText() {
    WebElement webElement = mock(WebElement.class);
    String elementText = "element text";
    when(webElement.getText()).thenReturn(elementText);
    WebElementWrapper webElementWrapper = new WebElementWrapper(webElement);
    AbstractTableElement<TableRowElement<TableColumnElement>, TableColumnElement> mockedTable = mock(AbstractTableElement.class);
    TableColumnElement tableColumnElement = new TableColumnElement(webElementWrapper, mockedTable);
    String text = tableColumnElement.text();
    assertThat(text).isEqualTo(elementText);
}
Also used : WebElement(org.openqa.selenium.WebElement) WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Test(org.junit.Test)

Example 15 with WebElementWrapper

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

the class TableElementTest method createRow_returnsTableRowElement.

@Test
public void createRow_returnsTableRowElement() {
    WebElementWrapper mockedWebElement = mock(WebElementWrapper.class);
    TableElement table = new TableElement(mockedWebElement);
    TableRowElement<TableColumnElement> row = table.createRow(mockedWebElement);
    assertThat(row).isNotNull();
    assertThat(row.webElement()).isSameAs(mockedWebElement);
    assertThat(row.table).isSameAs(table);
}
Also used : WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Test(org.junit.Test)

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