use of com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory in project seleniumRobot by bhecquet.
the class TestFirefoxCapabilitiesFactory method testCreateFirefoxCapabilitiesOverrideUserAgent.
@Test(groups = { "ut" })
public void testCreateFirefoxCapabilitiesOverrideUserAgent() {
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");
}
use of com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory in project seleniumRobot by bhecquet.
the class TestFirefoxCapabilitiesFactory method testCreateFirefoxCapabilitiesOverrideNtlmAuth.
@Test(groups = { "ut" })
public void testCreateFirefoxCapabilitiesOverrideNtlmAuth() {
Mockito.when(config.getNtlmAuthTrustedUris()).thenReturn("uri://uri.ntlm");
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("network.automatic-ntlm-auth.trusted-uris", ""), "uri://uri.ntlm");
}
use of com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory 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.browserfactory.FirefoxCapabilitiesFactory in project seleniumRobot by bhecquet.
the class TestFirefoxCapabilitiesFactory method testCreateDefaultCapabilitiesWithHeadless.
@Test(groups = { "ut" })
public void testCreateDefaultCapabilitiesWithHeadless() {
Mockito.when(config.isEnableJavascript()).thenReturn(false);
Mockito.when(config.isHeadlessBrowser()).thenReturn(true);
MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities();
Assert.assertEquals(((Map<?, ?>) (((FirefoxOptions) capa).asMap().get(FirefoxOptions.FIREFOX_OPTIONS))).get("args").toString(), "[-headless, --window-size=1280,1024, --width=1280, --height=1024]");
}
use of com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory in project seleniumRobot by bhecquet.
the class TestFirefoxCapabilitiesFactory method testCreateDefaultCapabilities.
/**
* Check default behaviour
*/
@Test(groups = { "ut" })
public void testCreateDefaultCapabilities() {
Mockito.when(config.isEnableJavascript()).thenReturn(true);
Mockito.when(config.getProxy()).thenReturn(proxyConfig);
Mockito.when(config.getNodeTags()).thenReturn(new ArrayList<>());
MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities();
Assert.assertTrue(capa.is(CapabilityType.SUPPORTS_JAVASCRIPT));
Assert.assertTrue(capa.is(CapabilityType.TAKES_SCREENSHOT));
Assert.assertTrue(capa.is(CapabilityType.ACCEPT_SSL_CERTS));
Assert.assertFalse(capa.is(SeleniumRobotCapabilityType.NODE_TAGS));
Assert.assertEquals(capa.getVersion(), "");
Assert.assertEquals(capa.getCapability(CapabilityType.PROXY), proxyConfig);
Assert.assertEquals(((Map<?, ?>) (((FirefoxOptions) capa).asMap().get(FirefoxOptions.FIREFOX_OPTIONS))).get("args").toString(), "[]");
}
Aggregations