use of org.openqa.selenium.ie.InternetExplorerDriverService in project jmeter-plugins by undera.
the class InternetExplorerDriverConfigTest method shouldQuitWebDriverAndStopServiceWhenQuitBrowserIsInvoked.
@Test
public void shouldQuitWebDriverAndStopServiceWhenQuitBrowserIsInvoked() throws Exception {
InternetExplorerDriver mockInternetExplorerDriver = mock(InternetExplorerDriver.class);
InternetExplorerDriverService mockService = mock(InternetExplorerDriverService.class);
when(mockService.isRunning()).thenReturn(true);
config.getServices().put(config.currentThreadName(), mockService);
config.quitBrowser(mockInternetExplorerDriver);
verify(mockInternetExplorerDriver).quit();
assertThat(config.getServices(), is(Collections.<String, InternetExplorerDriverService>emptyMap()));
verify(mockService, times(1)).stop();
}
use of org.openqa.selenium.ie.InternetExplorerDriverService in project jmeter-plugins by undera.
the class InternetExplorerDriverConfig method quitBrowser.
@Override
public void quitBrowser(final InternetExplorerDriver browser) {
super.quitBrowser(browser);
final InternetExplorerDriverService service = services.remove(currentThreadName());
if (service != null && service.isRunning()) {
service.stop();
}
}
use of org.openqa.selenium.ie.InternetExplorerDriverService in project jmeter-plugins by undera.
the class InternetExplorerDriverConfig method getThreadService.
private InternetExplorerDriverService getThreadService() {
InternetExplorerDriverService service = services.get(currentThreadName());
if (service != null) {
return service;
}
try {
service = new InternetExplorerDriverService.Builder().usingDriverExecutable(new File(getInternetExplorerDriverPath())).build();
service.start();
services.put(currentThreadName(), service);
} catch (IOException e) {
LOGGER.error("Failed to start chrome service");
service = null;
}
return service;
}
use of org.openqa.selenium.ie.InternetExplorerDriverService in project jmeter-plugins by undera.
the class InternetExplorerDriverConfigTest method shouldCreateInternetExplorerAndStartService.
@Test
public void shouldCreateInternetExplorerAndStartService() throws Exception {
InternetExplorerDriver mockInternetExplorerDriver = mock(InternetExplorerDriver.class);
whenNew(InternetExplorerDriver.class).withParameterTypes(InternetExplorerDriverService.class, Capabilities.class).withArguments(isA(InternetExplorerDriverService.class), isA(Capabilities.class)).thenReturn(mockInternetExplorerDriver);
InternetExplorerDriverService.Builder mockServiceBuilder = mock(InternetExplorerDriverService.Builder.class);
whenNew(InternetExplorerDriverService.Builder.class).withNoArguments().thenReturn(mockServiceBuilder);
when(mockServiceBuilder.usingDriverExecutable(isA(File.class))).thenReturn(mockServiceBuilder);
InternetExplorerDriverService mockService = mock(InternetExplorerDriverService.class);
when(mockServiceBuilder.build()).thenReturn(mockService);
final InternetExplorerDriver browser = config.createBrowser();
assertThat(browser, is(mockInternetExplorerDriver));
verifyNew(InternetExplorerDriver.class, times(1)).withArguments(isA(InternetExplorerDriverService.class), isA(Capabilities.class));
verify(mockServiceBuilder, times(1)).build();
assertThat(config.getServices().size(), is(1));
assertThat(config.getServices().values(), hasItem(mockService));
}
use of org.openqa.selenium.ie.InternetExplorerDriverService in project jmeter-plugins by undera.
the class InternetExplorerDriverConfigTest method shouldBeAbleToCallQuitBrowserMultipleTimes.
@Test
public void shouldBeAbleToCallQuitBrowserMultipleTimes() throws Exception {
InternetExplorerDriver mockInternetExplorerDriver = mock(InternetExplorerDriver.class);
InternetExplorerDriverService mockService = mock(InternetExplorerDriverService.class);
when(mockService.isRunning()).thenReturn(true);
config.getServices().put(config.currentThreadName(), mockService);
config.quitBrowser(mockInternetExplorerDriver);
config.quitBrowser(mockInternetExplorerDriver);
assertThat(config.getServices(), is(Collections.<String, InternetExplorerDriverService>emptyMap()));
verify(mockService, times(1)).stop();
}
Aggregations