Search in sources :

Example 6 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory method testCreateDefaultCapabilitiesWithPlatform.

@Test(groups = { "ut" })
public void testCreateDefaultCapabilitiesWithPlatform() {
    when(config.isEnableJavascript()).thenReturn(true);
    when(config.getProxy()).thenReturn(proxyConfig);
    when(config.getWebPlatform()).thenReturn(Platform.WINDOWS);
    MutableCapabilities capa = new EdgeCapabilitiesFactory(config).createCapabilities();
    Assert.assertEquals(capa.getPlatform(), Platform.WINDOWS);
}
Also used : MutableCapabilities(org.openqa.selenium.MutableCapabilities) EdgeCapabilitiesFactory(com.seleniumtests.browserfactory.EdgeCapabilitiesFactory) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 7 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory method testCreateEdgeCapabilitiesWithUserProfileGrid.

@Test(groups = { "ut" })
public void testCreateEdgeCapabilitiesWithUserProfileGrid() {
    when(config.getMode()).thenReturn(DriverMode.GRID);
    when(config.getEdgeProfilePath()).thenReturn("/home/user/profile");
    MutableCapabilities capa = new EdgeCapabilitiesFactory(config).createCapabilities();
    // check option is added with user profile
    Assert.assertNull(capa.getCapability("edgeProfile"));
    Assert.assertTrue(((Map<String, List<String>>) (((EdgeOptions) capa).asMap().get(EdgeOptions.CAPABILITY))).get("args").contains("--user-data-dir=/home/user/profile"));
}
Also used : MutableCapabilities(org.openqa.selenium.MutableCapabilities) HashMap(java.util.HashMap) Map(java.util.Map) EdgeCapabilitiesFactory(com.seleniumtests.browserfactory.EdgeCapabilitiesFactory) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 8 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory method testBetaVersionBrowserAbsent.

/**
 * If beta is not requested, and non beta browser not installed, return null
 */
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class, expectedExceptionsMessageRegExp = "Browser EDGE beta is not available")
public void testBetaVersionBrowserAbsent() {
    when(config.getMode()).thenReturn(DriverMode.LOCAL);
    Map<BrowserType, List<BrowserInfo>> browserInfos = new HashMap<>();
    browserInfos.put(BrowserType.EDGE, Arrays.asList(new BrowserInfo(BrowserType.EDGE, "101.0", "", false, false)));
    PowerMockito.when(OSUtility.getInstalledBrowsersWithVersion(true)).thenReturn(browserInfos);
    when(config.getBetaBrowser()).thenReturn(true);
    EdgeCapabilitiesFactory capaFactory = new EdgeCapabilitiesFactory(config);
    capaFactory.createCapabilities();
}
Also used : BrowserType(com.seleniumtests.driver.BrowserType) HashMap(java.util.HashMap) BrowserInfo(com.seleniumtests.browserfactory.BrowserInfo) ArrayList(java.util.ArrayList) List(java.util.List) EdgeCapabilitiesFactory(com.seleniumtests.browserfactory.EdgeCapabilitiesFactory) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 9 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory method testCreateEdgeCapabilitiesWithOptions.

@Test(groups = { "ut" })
public void testCreateEdgeCapabilitiesWithOptions() {
    when(config.getEdgeOptions()).thenReturn("--key1=value1 --key2=value2");
    MutableCapabilities capa = new EdgeCapabilitiesFactory(config).createCapabilities();
    Assert.assertEquals(((Map<?, ?>) (((EdgeOptions) capa).asMap().get(EdgeOptions.CAPABILITY))).get("args").toString(), "[--disable-translate, --disable-web-security, --no-sandbox, --disable-site-isolation-trials, --disable-features=IsolateOrigins,site-per-process, --key1=value1, --key2=value2]");
}
Also used : MutableCapabilities(org.openqa.selenium.MutableCapabilities) HashMap(java.util.HashMap) Map(java.util.Map) EdgeCapabilitiesFactory(com.seleniumtests.browserfactory.EdgeCapabilitiesFactory) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 10 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory 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() {
    when(config.getNodeTags()).thenReturn(Arrays.asList("foo", "bar"));
    when(config.getMode()).thenReturn(DriverMode.LOCAL);
    MutableCapabilities capa = new EdgeCapabilitiesFactory(config).createCapabilities();
    Assert.assertFalse(capa.is(SeleniumRobotCapabilityType.NODE_TAGS));
}
Also used : MutableCapabilities(org.openqa.selenium.MutableCapabilities) EdgeCapabilitiesFactory(com.seleniumtests.browserfactory.EdgeCapabilitiesFactory) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Aggregations

MockitoTest (com.seleniumtests.MockitoTest)27 EdgeCapabilitiesFactory (com.seleniumtests.browserfactory.EdgeCapabilitiesFactory)27 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)27 Test (org.testng.annotations.Test)27 MutableCapabilities (org.openqa.selenium.MutableCapabilities)19 HashMap (java.util.HashMap)14 Map (java.util.Map)10 ArrayList (java.util.ArrayList)7 List (java.util.List)7 EdgeOptions (com.microsoft.edge.seleniumtools.EdgeOptions)5 BrowserInfo (com.seleniumtests.browserfactory.BrowserInfo)5 BrowserType (com.seleniumtests.driver.BrowserType)5