Search in sources :

Example 11 with FirefoxCapabilitiesFactory

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

the class TestFirefoxCapabilitiesFactory method testCreateFirefoxCapabilitiesWithUserProfile.

@Test(groups = { "ut" })
public void testCreateFirefoxCapabilitiesWithUserProfile() {
    Mockito.when(config.getMode()).thenReturn(DriverMode.GRID);
    Mockito.when(config.getFirefoxProfilePath()).thenReturn("/home/user/profile");
    MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities();
    // check 'firefoxProfile' is set to 'default'
    Assert.assertEquals(capa.getCapability("firefoxProfile"), "/home/user/profile");
}
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 12 with FirefoxCapabilitiesFactory

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

the class TestFirefoxCapabilitiesFactory method testCreateFirefoxCapabilitiesWrongProfile.

@Test(groups = { "ut" })
public void testCreateFirefoxCapabilitiesWrongProfile() {
    Mockito.when(config.getMode()).thenReturn(DriverMode.GRID);
    Mockito.when(config.getFirefoxProfilePath()).thenReturn("foo");
    MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities();
    // check 'firefoxProfile' is set to 'default'
    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 13 with FirefoxCapabilitiesFactory

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

the class TestFirefoxCapabilitiesFactory method testCreateFirefoxCapabilitiesNoOverrideDownloadDirRemote.

/**
 * issue #365: Check DownloadDir is not set in remote
 */
@Test(groups = { "ut" })
public void testCreateFirefoxCapabilitiesNoOverrideDownloadDirRemote() {
    Mockito.when(config.getBrowserDownloadDir()).thenReturn("/home/download");
    Mockito.when(config.getMode()).thenReturn(DriverMode.GRID);
    MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities();
    FirefoxProfile profile = (FirefoxProfile) capa.getCapability(FirefoxDriver.PROFILE);
    // check profile
    Assert.assertEquals(profile.getStringPreference("browser.download.dir", ""), "");
    Assert.assertEquals(profile.getIntegerPreference("browser.download.folderList", 0), 0);
    Assert.assertEquals(profile.getStringPreference("browser.helperApps.neverAsk.saveToDisk", ""), "");
}
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 14 with FirefoxCapabilitiesFactory

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

the class TestFirefoxCapabilitiesFactory method testCreateDefaultCapabilitiesWithNodeTagsInLocalMode.

/**
 * Check default behaviour when node tags are defined in local mode
 * tags are not transferred to driver
 */
@Test(groups = { "ut" })
public void testCreateDefaultCapabilitiesWithNodeTagsInLocalMode() {
    Mockito.when(config.getNodeTags()).thenReturn(Arrays.asList("foo", "bar"));
    Mockito.when(config.getMode()).thenReturn(DriverMode.LOCAL);
    MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities();
    Assert.assertFalse(capa.is(SeleniumRobotCapabilityType.NODE_TAGS));
}
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 15 with FirefoxCapabilitiesFactory

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

the class TestFirefoxCapabilitiesFactory method testCreateDefaultCapabilitiesWithVersion.

@Test(groups = { "ut" })
public void testCreateDefaultCapabilitiesWithVersion() {
    Mockito.when(config.isEnableJavascript()).thenReturn(true);
    Mockito.when(config.getProxy()).thenReturn(proxyConfig);
    Mockito.when(config.getBrowserVersion()).thenReturn("60.0");
    MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities();
    Assert.assertEquals(capa.getVersion(), "60.0");
}
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)

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