Search in sources :

Example 21 with WebElementWrapper

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

the class ActionsPluginTest method dragAndDrop_callsDragAndDrop.

@Test
public void dragAndDrop_callsDragAndDrop() throws Exception {
    WebElement toWebElement = mock(WebElement.class);
    WebElementWrapper toWebElementWrapper = new WebElementWrapper(toWebElement);
    ActionsPlugin actionsPlugin = new ActionsPlugin(driver);
    actionsPlugin.dragAndDrop(webElementWrapper, toWebElementWrapper);
    verify(actions).dragAndDrop(webElement, toWebElement);
}
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 22 with WebElementWrapper

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

the class ScrollPluginTest method to_element_executesJavascript.

@Test
public void to_element_executesJavascript() {
    RemoteWebDriver mockedDriver = mock(RemoteWebDriver.class);
    ScrollPlugin scrollPlugin = new ScrollPlugin(mockedDriver);
    WebElement webElement = mock(WebElement.class);
    WebElementWrapper element = new WebElementWrapper(webElement);
    ScrollPlugin result = scrollPlugin.to(element);
    verify(mockedDriver).executeScript("arguments[0].scrollIntoView(true);", webElement);
    assertThat(result).isSameAs(scrollPlugin);
}
Also used : RemoteWebDriver(org.openqa.selenium.remote.RemoteWebDriver) WebElement(org.openqa.selenium.WebElement) WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Test(org.junit.Test)

Example 23 with WebElementWrapper

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

the class SelectElementTest method selectedItems_returnsSelectedItemsList.

@Test
public void selectedItems_returnsSelectedItemsList() {
    WebElement optionOne = mock(WebElement.class);
    when(optionOne.isSelected()).thenReturn(true);
    WebElement optionTwo = mock(WebElement.class);
    when(optionTwo.isSelected()).thenReturn(true);
    WebElement optionThree = mock(WebElement.class);
    when(optionThree.isSelected()).thenReturn(false);
    when(webElement.findElements(By.tagName("option"))).thenReturn(Arrays.asList(optionOne, optionTwo, optionThree));
    SelectElement selectElement = new SelectElement(new WebElementWrapper(webElement));
    List<SelectOptionElement> optionElements = selectElement.selectedItems();
    Assertions.assertThat(optionElements).hasSize(2);
}
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 24 with WebElementWrapper

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

the class SelectElementTest method deselectByIndex_callsDeselectByIndex.

@Test
public void deselectByIndex_callsDeselectByIndex() {
    int index = 1;
    SelectElement selectElement = new SelectElement(new WebElementWrapper(webElement));
    SelectElement result = selectElement.deselectByIndex(index);
    verify(select).deselectByIndex(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 25 with WebElementWrapper

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

the class SelectElementTest method deselectAll_callsDeselectAll.

@Test
public void deselectAll_callsDeselectAll() {
    SelectElement selectElement = new SelectElement(new WebElementWrapper(webElement));
    SelectElement result = selectElement.deselectAll();
    verify(select).deselectAll();
    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