Search in sources :

Example 6 with EdgeOptions

use of com.microsoft.edge.seleniumtools.EdgeOptions in project seleniumRobot by bhecquet.

the class TestEdgeCapabilityFactory method testCreateEdgeCapabilitiesWrongProfileGrid.

@Test(groups = { "ut" })
public void testCreateEdgeCapabilitiesWrongProfileGrid() {
    when(config.getMode()).thenReturn(DriverMode.GRID);
    when(config.getEdgeProfilePath()).thenReturn("foo");
    MutableCapabilities capa = new EdgeCapabilitiesFactory(config).createCapabilities();
    // check 'edgeProfile' is not set as it's wrong profile path, and no option added
    Assert.assertNull(capa.getCapability("edgeProfile"));
    Assert.assertFalse(((Map<String, List<String>>) (((EdgeOptions) capa).asMap().get(EdgeOptions.CAPABILITY))).get("args").toString().contains("--user-data-dir=/home/user/profile"));
}
Also used : EdgeOptions(com.microsoft.edge.seleniumtools.EdgeOptions) MutableCapabilities(org.openqa.selenium.MutableCapabilities) 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 7 with EdgeOptions

use of com.microsoft.edge.seleniumtools.EdgeOptions in project seleniumRobot by bhecquet.

the class TestEdgeCapabilityFactory method testCreateDefaultEdgeCapabilities.

@Test(groups = { "ut" })
public void testCreateDefaultEdgeCapabilities() {
    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]");
    Assert.assertEquals(capa.getCapability(CapabilityType.BROWSER_NAME), "MicrosoftEdge");
    Assert.assertEquals(((Map<?, ?>) (((EdgeOptions) capa).asMap().get(EdgeOptions.CAPABILITY))).get("prefs").toString(), "{profile.exit_type=Normal}");
    // no debuger address set as we do not attach an existing browser
    Assert.assertNull(((Map<?, ?>) (((EdgeOptions) capa).asMap().get(EdgeOptions.CAPABILITY))).get("debuggerAddress"));
}
Also used : EdgeOptions(com.microsoft.edge.seleniumtools.EdgeOptions) 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)

Aggregations

EdgeOptions (com.microsoft.edge.seleniumtools.EdgeOptions)7 MockitoTest (com.seleniumtests.MockitoTest)5 EdgeCapabilitiesFactory (com.seleniumtests.browserfactory.EdgeCapabilitiesFactory)5 MutableCapabilities (org.openqa.selenium.MutableCapabilities)5 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 Test (org.testng.annotations.Test)5 HashMap (java.util.HashMap)4 Map (java.util.Map)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 EdgeDriver (com.microsoft.edge.seleniumtools.EdgeDriver)1 WebDriver (org.openqa.selenium.WebDriver)1