Search in sources :

Example 31 with FirefoxCapabilitiesFactory

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

the class TestMarionetteCapabilitiesFactory method testCreateDefaultCapabilitiesWithPlatform.

@Test(groups = { "ut" })
public void testCreateDefaultCapabilitiesWithPlatform() {
    Mockito.when(config.isEnableJavascript()).thenReturn(true);
    Mockito.when(config.getProxy()).thenReturn(proxyConfig);
    Mockito.when(config.getWebPlatform()).thenReturn(Platform.WINDOWS);
    MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities();
    Assert.assertEquals(capa.getPlatform(), Platform.WINDOWS);
}
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 32 with FirefoxCapabilitiesFactory

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

the class TestMarionetteCapabilitiesFactory 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 33 with FirefoxCapabilitiesFactory

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

the class TestMarionetteCapabilitiesFactory 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);
}
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 34 with FirefoxCapabilitiesFactory

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

the class TestMarionetteCapabilitiesFactory method testCreateMarionetteCapabilitiesStandardDriverPathLocal.

@Test(groups = { "ut" })
public void testCreateMarionetteCapabilitiesStandardDriverPathLocal() {
    System.clearProperty(GeckoDriverService.GECKO_DRIVER_EXE_PROPERTY);
    try {
        Mockito.when(config.getMode()).thenReturn(DriverMode.LOCAL);
        new FirefoxCapabilitiesFactory(config).createCapabilities();
        Assert.assertTrue(System.getProperty(GeckoDriverService.GECKO_DRIVER_EXE_PROPERTY).replace(File.separator, "/").contains("/drivers/geckodriver"));
    } finally {
        System.clearProperty(GeckoDriverService.GECKO_DRIVER_EXE_PROPERTY);
    }
}
Also used : FirefoxCapabilitiesFactory(com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 35 with FirefoxCapabilitiesFactory

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

the class TestMarionetteCapabilitiesFactory 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 not set if name is not valid
    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)

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