use of com.seleniumtests.driver.BrowserType in project seleniumRobot by bhecquet.
the class TestFirefoxCapabilitiesFactory method testCreateFirefoxCapabilitiesOverrideBinPath.
@Test(groups = { "ut" })
public void testCreateFirefoxCapabilitiesOverrideBinPath() {
Mockito.when(config.getMode()).thenReturn(DriverMode.LOCAL);
Mockito.when(config.getFirefoxBinPath()).thenReturn("/opt/firefox/bin/firefox");
// SeleniumTestsContext class adds a browserInfo when binary path is set
Map<BrowserType, List<BrowserInfo>> updatedBrowserInfos = new HashMap<>();
updatedBrowserInfos.put(BrowserType.FIREFOX, Arrays.asList(new BrowserInfo(BrowserType.FIREFOX, "47.0", "", false), new BrowserInfo(BrowserType.FIREFOX, "44.0", "/opt/firefox/bin/firefox", false)));
PowerMockito.when(OSUtility.getInstalledBrowsersWithVersion(false)).thenReturn(updatedBrowserInfos);
MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities();
Assert.assertEquals(capa.getCapability(FirefoxDriver.BINARY), "/opt/firefox/bin/firefox");
}
use of com.seleniumtests.driver.BrowserType in project seleniumRobot by bhecquet.
the class TestIECapabilityFactory method testCreateDefaultEdgeIEModeCapabilities.
/**
* Edge IE mode in local
* Check ie.edgepath and ie.edgechromium capabilities are set
*/
@Test(groups = { "ut" })
public void testCreateDefaultEdgeIEModeCapabilities() {
Mockito.when(config.getIeMode()).thenReturn(true);
Mockito.when(config.getMode()).thenReturn(DriverMode.LOCAL);
Mockito.when(config.getInitialUrl()).thenReturn("http://mysite");
Map<BrowserType, List<BrowserInfo>> browserInfos = new HashMap<>();
browserInfos.put(BrowserType.INTERNET_EXPLORER, Arrays.asList(new BrowserInfo(BrowserType.INTERNET_EXPLORER, "11", "", false)));
browserInfos.put(BrowserType.EDGE, Arrays.asList(new BrowserInfo(BrowserType.EDGE, "97.0", "", false)));
PowerMockito.when(OSUtility.getInstalledBrowsersWithVersion(false)).thenReturn(browserInfos);
MutableCapabilities capa = new IECapabilitiesFactory(config).createCapabilities();
Assert.assertEquals(capa.getCapability(CapabilityType.BROWSER_NAME), "internet explorer");
Assert.assertTrue((Boolean) capa.getCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING));
Assert.assertTrue((Boolean) capa.getCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS));
Assert.assertTrue((Boolean) capa.getCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION));
Assert.assertEquals((String) capa.getCapability(InternetExplorerDriver.INITIAL_BROWSER_URL), "http://mysite");
Assert.assertTrue((Boolean) capa.getCapability("ie.edgechromium"));
Assert.assertEquals((String) capa.getCapability("ie.edgepath"), "");
Assert.assertEquals(((Map<String, Object>) capa.getCapability(IECapabilitiesFactory.SE_IE_OPTIONS)).get("ie.edgepath"), "");
Assert.assertTrue((boolean) ((Map<String, Object>) capa.getCapability(IECapabilitiesFactory.SE_IE_OPTIONS)).get("ie.edgechromium"));
}
Aggregations