Search in sources :

Example 16 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory method testCreateDefaultCapabilitiesWithJavascriptDisabled.

@Test(groups = { "ut" })
public void testCreateDefaultCapabilitiesWithJavascriptDisabled() {
    when(config.isEnableJavascript()).thenReturn(false);
    when(config.getProxy()).thenReturn(proxyConfig);
    MutableCapabilities capa = new EdgeCapabilitiesFactory(config).createCapabilities();
    Assert.assertFalse(capa.is(CapabilityType.SUPPORTS_JAVASCRIPT));
}
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 17 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory method testCreateDefaultEdgeCapabilitiesAttach.

/**
 * Check we set debugger address
 */
@Test(groups = { "ut" })
public void testCreateDefaultEdgeCapabilitiesAttach() {
    when(config.getAttachExistingDriverPort()).thenReturn(10);
    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");
    // no preference set when attaching to existing browser
    Assert.assertNull(((Map<?, ?>) (((EdgeOptions) capa).asMap().get(EdgeOptions.CAPABILITY))).get("prefs"));
    Assert.assertEquals(((Map<?, ?>) (((EdgeOptions) capa).asMap().get(EdgeOptions.CAPABILITY))).get("debuggerAddress"), "127.0.0.1:10");
}
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)

Example 18 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory method testCreateEdgeCapabilitiesStandardDriverPathLocal.

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

Example 19 with EdgeCapabilitiesFactory

use of com.seleniumtests.browserfactory.EdgeCapabilitiesFactory 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 20 with EdgeCapabilitiesFactory

use of com.seleniumtests.browserfactory.EdgeCapabilitiesFactory 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

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