Search in sources :

Example 6 with WebElementWrapper

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

the class ActionsPluginTest method beforeEach.

@Before
public void beforeEach() throws Exception {
    PowerMockito.mockStatic(SeleniumElementCreator.class, invocationOnMock -> actions);
    webElementWrapper = new WebElementWrapper(webElement);
}
Also used : WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Before(org.junit.Before)

Example 7 with WebElementWrapper

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

the class MousePluginTest method beforeEach.

@Before
public void beforeEach() {
    when(website.actions()).thenReturn(actionsPlugin);
    when(actionsPlugin.click(any())).thenReturn(actionsPlugin);
    when(actionsPlugin.moveToElement(any())).thenReturn(actionsPlugin);
    when(actionsPlugin.doubleClick(any())).thenReturn(actionsPlugin);
    when(actionsPlugin.build()).thenReturn(action);
    when(actionsPlugin.click()).thenReturn(actionsPlugin);
    webElementWrapper = new WebElementWrapper(webElement);
}
Also used : WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Before(org.junit.Before)

Example 8 with WebElementWrapper

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

the class SelectElementTest method selectedItem_returnsFirstSelectedItem.

@Test
public void selectedItem_returnsFirstSelectedItem() {
    WebElement optionOne = mock(WebElement.class);
    when(optionOne.isSelected()).thenReturn(true);
    WebElement optionTwo = mock(WebElement.class);
    when(optionTwo.isSelected()).thenReturn(true);
    when(webElement.findElements(By.tagName("option"))).thenReturn(Arrays.asList(optionOne, optionTwo));
    SelectElement selectElement = new SelectElement(new WebElementWrapper(webElement));
    SelectOptionElement optionElement = selectElement.selectedItem();
    assertThat(optionElement.webElement().webElement()).isSameAs(optionOne);
}
Also used : WebElement(org.openqa.selenium.WebElement) WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 9 with WebElementWrapper

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

the class SelectElementTest method selectByVisibleText_callsSelectByVisibleText.

@Test
public void selectByVisibleText_callsSelectByVisibleText() {
    String text = "text";
    SelectElement selectElement = new SelectElement(new WebElementWrapper(webElement));
    SelectElement result = selectElement.selectByVisibleText(text);
    verify(select).selectByVisibleText(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 10 with WebElementWrapper

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

the class SelectElementTest method deselectByValue_callsDeselectByValue.

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

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