use of com.seleniumtests.browserfactory.BrowserInfo in project seleniumRobot by bhecquet.
the class TestEdgeCapabilityFactory method testBetaVersionBrowserAbsent.
/**
* If beta is not requested, and non beta browser not installed, return null
*/
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class, expectedExceptionsMessageRegExp = "Browser EDGE beta is not available")
public void testBetaVersionBrowserAbsent() {
when(config.getMode()).thenReturn(DriverMode.LOCAL);
Map<BrowserType, List<BrowserInfo>> browserInfos = new HashMap<>();
browserInfos.put(BrowserType.EDGE, Arrays.asList(new BrowserInfo(BrowserType.EDGE, "101.0", "", false, false)));
PowerMockito.when(OSUtility.getInstalledBrowsersWithVersion(true)).thenReturn(browserInfos);
when(config.getBetaBrowser()).thenReturn(true);
EdgeCapabilitiesFactory capaFactory = new EdgeCapabilitiesFactory(config);
capaFactory.createCapabilities();
}
use of com.seleniumtests.browserfactory.BrowserInfo in project seleniumRobot by bhecquet.
the class TestMarionetteCapabilitiesFactory method testCreateMarionetteCapabilitiesOverrideBinPath.
@Test(groups = { "ut" })
public void testCreateMarionetteCapabilitiesOverrideBinPath() {
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, "57.0", "", false), new BrowserInfo(BrowserType.FIREFOX, "58.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.browserfactory.BrowserInfo in project seleniumRobot by bhecquet.
the class TestBrowserInfo method testEdgeVersion.
@Test(groups = { "ut" })
public void testEdgeVersion() {
if (SystemUtils.IS_OS_WINDOWS) {
BrowserInfo bInfo = new BrowserInfo(BrowserType.EDGE, "99.0", null);
Assert.assertEquals(bInfo.getDriverFileName(), "edgedriver_99.0_edge-99-100");
}
}
use of com.seleniumtests.browserfactory.BrowserInfo in project seleniumRobot by bhecquet.
the class TestBrowserInfo method testGetDefaultFirefoxMacProfile.
@Test(groups = { "ut" })
public void testGetDefaultFirefoxMacProfile() throws Exception {
PowerMockito.mockStatic(Files.class);
PowerMockito.mockStatic(OSUtility.class);
when(OSUtility.getCurrentPlatorm()).thenReturn(Platform.MAC);
when(Files.list(any(Path.class))).thenReturn(streamPaths);
when(streamPaths.filter(any(Predicate.class))).thenReturn(streamPaths);
when(streamPaths.collect(any())).thenReturn(Arrays.asList(Paths.get("/Users/user/Library/Application Support/Firefox/Profiles/")));
BrowserInfo bi = new BrowserInfo(BrowserType.FIREFOX, "58.0", null);
Assert.assertEquals(bi.getDefaultProfilePath().replace("\\", "/"), "/Users/user/Library/Application Support/Firefox/Profiles");
}
use of com.seleniumtests.browserfactory.BrowserInfo in project seleniumRobot by bhecquet.
the class TestBrowserInfo method testWrongVersion.
/**
* Test that if a wrong version format is provided (parsable as float), returned version is 0.0
* Else, version is not touched
*/
@Test(groups = { "ut" })
public void testWrongVersion() {
BrowserInfo bi = new BrowserInfo(BrowserType.CHROME, "58.alpha", null);
Assert.assertEquals(bi.getVersion(), "0.0");
}
Aggregations