use of org.openqa.selenium.remote.RemoteWebDriver in project flue2ent by DefinityLabs.
the class ScrollPluginTest method up_executesJavascript.
@Test
public void up_executesJavascript() {
RemoteWebDriver mockedDriver = mock(RemoteWebDriver.class);
ScrollPlugin scrollPlugin = new ScrollPlugin(mockedDriver);
ScrollPlugin result = scrollPlugin.up();
verify(mockedDriver).executeScript("window.scrollBy(0, -250);");
assertThat(result).isSameAs(scrollPlugin);
}
use of org.openqa.selenium.remote.RemoteWebDriver 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);
}
use of org.openqa.selenium.remote.RemoteWebDriver in project flue2ent by DefinityLabs.
the class ScrollPluginTest method to_executesJavascript.
@Test
public void to_executesJavascript() {
RemoteWebDriver mockedDriver = mock(RemoteWebDriver.class);
ScrollPlugin scrollPlugin = new ScrollPlugin(mockedDriver);
ScrollPlugin result = scrollPlugin.to(100, 200);
verify(mockedDriver).executeScript("window.scrollTo(100, 200);");
assertThat(result).isSameAs(scrollPlugin);
}
use of org.openqa.selenium.remote.RemoteWebDriver in project flue2ent by DefinityLabs.
the class PagePluginTest method getTitle_returnsWebDriverTitle.
@Test
public void getTitle_returnsWebDriverTitle() {
RemoteWebDriver mockedDriver = mock(RemoteWebDriver.class);
String mockedTitle = "Page Title";
when(mockedDriver.getTitle()).thenReturn(mockedTitle);
PagePlugin pagePlugin = new PagePlugin(mockedDriver);
String currentUrl = pagePlugin.getTitle();
verify(mockedDriver).getTitle();
assertThat(currentUrl).isEqualTo(mockedTitle);
}
use of org.openqa.selenium.remote.RemoteWebDriver in project flue2ent by DefinityLabs.
the class PagePluginTest method getUrl_returnsWebDriverCurrentUrl.
@Test
public void getUrl_returnsWebDriverCurrentUrl() {
RemoteWebDriver mockedDriver = mock(RemoteWebDriver.class);
String mockedCurrentUrl = "https://google.com/a/";
when(mockedDriver.getCurrentUrl()).thenReturn(mockedCurrentUrl);
PagePlugin pagePlugin = new PagePlugin(mockedDriver);
String currentUrl = pagePlugin.getUrl();
verify(mockedDriver).getCurrentUrl();
assertThat(currentUrl).isEqualTo(mockedCurrentUrl);
}
Aggregations