use of org.definitylabs.flue2ent.Website in project flue2ent by DefinityLabs.
the class WaiterPluginTest method driver_until_callsWaitUntil.
@Test
public void driver_until_callsWaitUntil() {
WaiterPlugin waiter = new WaiterPlugin(website);
WebElement mockedElement = mock(WebElement.class);
when(wait.until(any())).thenReturn(mockedElement);
Function<WebDriver, WebElement> function = driver -> mockedElement;
WebElement element = waiter.driver().until(function);
verify(wait).until(same(function));
assertThat(element).isSameAs(mockedElement);
}
use of org.definitylabs.flue2ent.Website in project flue2ent by DefinityLabs.
the class WaiterPluginTest method until_callsWaitUntil.
@Test
public void until_callsWaitUntil() {
WaiterPlugin waiter = new WaiterPlugin(website);
when(wait.until(any())).thenAnswer(invocationOnMock -> {
Function<WebDriver, WebElement> function = invocationOnMock.getArgumentAt(0, Function.class);
return function.apply(null);
});
WebElement mockedElement = mock(WebElement.class);
Function<Website, WebElement> function = mock(Function.class);
when(function.apply(any())).thenReturn(mockedElement);
WebElement element = waiter.until(function);
verify(wait).until(any());
verify(function).apply(website);
assertThat(element).isSameAs(mockedElement);
}
Aggregations