Search in sources :

Example 26 with WebElementWrapper

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

the class SelectElementTest method selectByIndex_callsSelectByIndex.

@Test
public void selectByIndex_callsSelectByIndex() {
    int index = 1;
    SelectElement selectElement = new SelectElement(new WebElementWrapper(webElement));
    SelectElement result = selectElement.selectByIndex(index);
    verify(select).selectByIndex(index);
    assertThat(result).isSameAs(selectElement);
}
Also used : WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 27 with WebElementWrapper

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

the class SelectElementTest method selectByValue_callsSelectByValue.

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

Example 28 with WebElementWrapper

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

Example 29 with WebElementWrapper

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

the class SimpleWebElementDecoratorProxyTest method findElement_webElement_returnsNestedElement.

@Test
public void findElement_webElement_returnsNestedElement() {
    WebElementWrapper webElementWrapper = new WebElementWrapper(webElement);
    FakeTableElement fakeTableElement = SimpleWebElementDecoratorProxy.newInstance(FakeTableElement.class, webElementWrapper);
    expectedException.expect(RuntimeException.class);
    expectedException.expectMessage("Method not implemented");
    fakeTableElement.webElement(0);
}
Also used : FakeTableElement(org.definitylabs.flue2ent.data.FakeTableElement) WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Test(org.junit.Test)

Example 30 with WebElementWrapper

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

the class SimpleWebElementDecoratorProxyTest method findElement_undefined_returnsNestedElement.

@Test
public void findElement_undefined_returnsNestedElement() {
    WebElementWrapper webElementWrapper = new WebElementWrapper(webElement);
    FakeTableElement fakeTableElement = SimpleWebElementDecoratorProxy.newInstance(FakeTableElement.class, webElementWrapper);
    expectedException.expect(RuntimeException.class);
    expectedException.expectMessage("Method not implemented");
    fakeTableElement.undefined();
}
Also used : FakeTableElement(org.definitylabs.flue2ent.data.FakeTableElement) 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