Search in sources :

Example 1 with FirefoxCapabilitiesFactory

use of com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory in project seleniumRobot by bhecquet.

the class TestMarionetteCapabilitiesFactory method testCreateFirefoxCapabilitiesWithDefaultProfile.

@Test(groups = { "ut" })
public void testCreateFirefoxCapabilitiesWithDefaultProfile() {
    Mockito.when(config.getMode()).thenReturn(DriverMode.GRID);
    Mockito.when(config.getFirefoxProfilePath()).thenReturn(BrowserInfo.DEFAULT_BROWSER_PRODFILE);
    MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities();
    // check 'firefoxProfile' is set to 'default'
    Assert.assertEquals(capa.getCapability("firefoxProfile"), BrowserInfo.DEFAULT_BROWSER_PRODFILE);
}
Also used : MutableCapabilities(org.openqa.selenium.MutableCapabilities) FirefoxCapabilitiesFactory(com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 2 with FirefoxCapabilitiesFactory

use of com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory in project seleniumRobot by bhecquet.

the class TestMarionetteCapabilitiesFactory method testCreateMarionetteCapabilitiesOverrideDownloadDir.

@Test(groups = { "ut" })
public void testCreateMarionetteCapabilitiesOverrideDownloadDir() {
    Mockito.when(config.getBrowserDownloadDir()).thenReturn("/home/download");
    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("browser.download.dir", ""), "/home/download");
    Assert.assertEquals(profile.getIntegerPreference("browser.download.folderList", 0), 2);
    Assert.assertEquals(profile.getBooleanPreference("browser.download.manager.showWhenStarting", true), false);
    Assert.assertEquals(profile.getStringPreference("browser.helperApps.neverAsk.saveToDisk", ""), "application/octet-stream,text/plain,application/pdf,application/zip,text/csv,text/html");
}
Also used : MutableCapabilities(org.openqa.selenium.MutableCapabilities) FirefoxCapabilitiesFactory(com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory) FirefoxProfile(org.openqa.selenium.firefox.FirefoxProfile) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 3 with FirefoxCapabilitiesFactory

use of com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory in project seleniumRobot by bhecquet.

the class TestMarionetteCapabilitiesFactory method testCreateFirefoxCapabilitiesWithoutDefaultProfile.

@Test(groups = { "ut" })
public void testCreateFirefoxCapabilitiesWithoutDefaultProfile() {
    Mockito.when(config.getMode()).thenReturn(DriverMode.GRID);
    MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities();
    // check 'firefoxProfile' is no set when not requested
    Assert.assertNull(capa.getCapability("firefoxProfile"));
}
Also used : MutableCapabilities(org.openqa.selenium.MutableCapabilities) FirefoxCapabilitiesFactory(com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 4 with FirefoxCapabilitiesFactory

use of com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory in project seleniumRobot by bhecquet.

the class TestMarionetteCapabilitiesFactory method testCreateDefaultMarionetteCapabilities.

@Test(groups = { "ut" })
public void testCreateDefaultMarionetteCapabilities() {
    Mockito.when(config.getMode()).thenReturn(DriverMode.LOCAL);
    Mockito.when(config.isSetAcceptUntrustedCertificates()).thenReturn(true);
    Mockito.when(config.isSetAssumeUntrustedCertificateIssuer()).thenReturn(true);
    MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities();
    Assert.assertEquals(capa.getCapability(CapabilityType.BROWSER_NAME), "firefox");
    Assert.assertEquals(capa.getCapability(FirefoxDriver.MARIONETTE), true);
    FirefoxProfile profile = (FirefoxProfile) capa.getCapability(FirefoxDriver.PROFILE);
    // check profile
    Assert.assertTrue(profile.getBooleanPreference("webdriver_accept_untrusted_certs", false));
    Assert.assertTrue(profile.getBooleanPreference("webdriver_assume_untrusted_issuer", false));
    Assert.assertEquals(profile.getStringPreference("capability.policy.default.Window.QueryInterface", ""), FirefoxCapabilitiesFactory.ALL_ACCESS);
    Assert.assertEquals(profile.getStringPreference("capability.policy.default.Window.frameElement.get", ""), FirefoxCapabilitiesFactory.ALL_ACCESS);
    Assert.assertEquals(profile.getStringPreference("capability.policy.default.HTMLDocument.compatMode.get", ""), FirefoxCapabilitiesFactory.ALL_ACCESS);
    Assert.assertEquals(profile.getStringPreference("capability.policy.default.Document.compatMode.get", ""), FirefoxCapabilitiesFactory.ALL_ACCESS);
    Assert.assertEquals(profile.getIntegerPreference("dom.max_chrome_script_run_time", 100), 0);
    Assert.assertEquals(profile.getIntegerPreference("dom.max_script_run_time", 100), 0);
}
Also used : MutableCapabilities(org.openqa.selenium.MutableCapabilities) FirefoxCapabilitiesFactory(com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory) FirefoxProfile(org.openqa.selenium.firefox.FirefoxProfile) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 5 with FirefoxCapabilitiesFactory

use of com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory in project seleniumRobot by bhecquet.

the class TestMarionetteCapabilitiesFactory method testCreateMarionetteCapabilitiesOverrideNtlmAuth.

@Test(groups = { "ut" })
public void testCreateMarionetteCapabilitiesOverrideNtlmAuth() {
    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");
}
Also used : MutableCapabilities(org.openqa.selenium.MutableCapabilities) FirefoxCapabilitiesFactory(com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory) FirefoxProfile(org.openqa.selenium.firefox.FirefoxProfile) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Aggregations

MockitoTest (com.seleniumtests.MockitoTest)38 FirefoxCapabilitiesFactory (com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory)38 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)38 Test (org.testng.annotations.Test)38 MutableCapabilities (org.openqa.selenium.MutableCapabilities)35 FirefoxProfile (org.openqa.selenium.firefox.FirefoxProfile)10 HashMap (java.util.HashMap)4 BrowserInfo (com.seleniumtests.browserfactory.BrowserInfo)2 BrowserType (com.seleniumtests.driver.BrowserType)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Map (java.util.Map)2