use of com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory in project seleniumRobot by bhecquet.
the class TestFirefoxCapabilitiesFactory method testCreateDefaultCapabilitiesWithJavascriptDisabled.
@Test(groups = { "ut" })
public void testCreateDefaultCapabilitiesWithJavascriptDisabled() {
Mockito.when(config.isEnableJavascript()).thenReturn(false);
Mockito.when(config.getProxy()).thenReturn(proxyConfig);
MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities();
Assert.assertFalse(capa.is(CapabilityType.SUPPORTS_JAVASCRIPT));
}
use of com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory 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.FirefoxCapabilitiesFactory in project seleniumRobot by bhecquet.
the class TestMarionetteCapabilitiesFactory method testCreateMarionetteCapabilitiesOverrideDriverPathLocal.
@Test(groups = { "ut" })
public void testCreateMarionetteCapabilitiesOverrideDriverPathLocal() {
System.clearProperty(GeckoDriverService.GECKO_DRIVER_EXE_PROPERTY);
try {
Mockito.when(config.getMode()).thenReturn(DriverMode.LOCAL);
Mockito.when(config.getGeckoDriverPath()).thenReturn("/opt/firefox/driver/geckodriver");
new FirefoxCapabilitiesFactory(config).createCapabilities();
Assert.assertEquals(System.getProperty(GeckoDriverService.GECKO_DRIVER_EXE_PROPERTY).replace(File.separator, "/"), "/opt/firefox/driver/geckodriver");
} finally {
System.clearProperty(GeckoDriverService.GECKO_DRIVER_EXE_PROPERTY);
}
}
use of com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory in project seleniumRobot by bhecquet.
the class TestMarionetteCapabilitiesFactory method testCreateDefaultCapabilitiesWithNodeTagsInGridMode.
/**
* Check default behaviour when node tags are defined in grid mode
* tags are transferred to driver
*/
@Test(groups = { "ut" })
public void testCreateDefaultCapabilitiesWithNodeTagsInGridMode() {
Mockito.when(config.isEnableJavascript()).thenReturn(true);
Mockito.when(config.getProxy()).thenReturn(proxyConfig);
Mockito.when(config.getNodeTags()).thenReturn(Arrays.asList("foo", "bar"));
Mockito.when(config.getMode()).thenReturn(DriverMode.GRID);
MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities();
Assert.assertEquals(capa.getCapability(SeleniumRobotCapabilityType.NODE_TAGS), Arrays.asList("foo", "bar"));
}
use of com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory in project seleniumRobot by bhecquet.
the class TestMarionetteCapabilitiesFactory method testCreateMarionetteCapabilitiesOverrideUserAgent.
@Test(groups = { "ut" })
public void testCreateMarionetteCapabilitiesOverrideUserAgent() {
Mockito.when(config.getUserAgentOverride()).thenReturn("FIREFOX 55");
Mockito.when(config.getMode()).thenReturn(DriverMode.LOCAL);
MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities();
FirefoxProfile profile = (FirefoxProfile) capa.getCapability(FirefoxDriver.PROFILE);
// check profile
Assert.assertEquals(profile.getStringPreference("general.useragent.override", ""), "FIREFOX 55");
}
Aggregations