use of com.seleniumtests.browserfactory.BrowserInfo in project seleniumRobot by bhecquet.
the class TestPageObject2 method init.
@BeforeMethod(groups = { "ut" })
private void init() throws IOException {
SeleniumTestsContextManager.getGlobalContext().setCucumberImplementationPackage("com.seleniumtests.ut.core.runner.cucumber");
SeleniumTestsContextManager.getThreadContext().setBrowser("firefox");
SeleniumTestsContextManager.getThreadContext().setExplicitWaitTimeout(1);
SeleniumTestsContextManager.getThreadContext().setImplicitWaitTimeout(1);
SeleniumTestsContextManager.getThreadContext().setReplayTimeout(2);
eventDriver = spy(new CustomEventFiringWebDriver(driver));
when(eventDriver.switchTo()).thenReturn(target);
when(driver.findElement(By.id("el"))).thenReturn(element);
when(driver.navigate()).thenReturn(navigation);
when(driver.getCurrentUrl()).thenReturn("http://foo");
when(driver.manage()).thenReturn(driverOptions);
when(driverOptions.timeouts()).thenReturn(timeouts);
when(element.getSize()).thenReturn(new Dimension(10, 10));
when(element.getLocation()).thenReturn(new Point(5, 5));
when(targetLocator.alert()).thenReturn(alert);
when(alert.getText()).thenReturn("alert text");
when(driver.switchTo()).thenReturn(targetLocator);
PowerMockito.mockStatic(WebUIDriver.class);
when(WebUIDriver.getCurrentWebUiDriverName()).thenReturn("main");
when(WebUIDriver.getWebDriver(anyBoolean(), eq(BrowserType.FIREFOX), eq("main"), isNull())).thenReturn(eventDriver);
when(WebUIDriver.getWebDriver(anyBoolean())).thenReturn(eventDriver);
when(eventDriver.executeScript("if (document.readyState === \"complete\") { return \"ok\"; }")).thenReturn("ok");
when(eventDriver.getBrowserInfo()).thenReturn(new BrowserInfo(BrowserType.FIREFOX, "78.0"));
when(screenshotUtil.capture(any(SnapshotTarget.class), ArgumentMatchers.<Class<ScreenShot>>any())).thenReturn(screenshot);
when(screenshotUtil.capture(any(SnapshotTarget.class), ArgumentMatchers.<Class<ScreenShot>>any(), anyInt())).thenReturn(screenshot);
when(screenshot.getHtmlSourcePath()).thenReturn("foo");
when(screenshot.getImagePath()).thenReturn("image");
page = new PageForActions();
}
Aggregations