Search in sources :

Example 11 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory method testCreateEdgeCapabilitiesWithoutDefaultProfileGrid.

@Test(groups = { "ut" })
public void testCreateEdgeCapabilitiesWithoutDefaultProfileGrid() {
    when(config.getMode()).thenReturn(DriverMode.GRID);
    MutableCapabilities capa = new EdgeCapabilitiesFactory(config).createCapabilities();
    // check 'edgeProfile' is not set as not requested, 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 12 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory method testCreateEdgeCapabilitiesDefaultProfile.

@Test(groups = { "ut" })
public void testCreateEdgeCapabilitiesDefaultProfile() {
    when(config.getEdgeProfilePath()).thenReturn("default");
    when(config.getMode()).thenReturn(DriverMode.LOCAL);
    MutableCapabilities capa = new EdgeCapabilitiesFactory(config).createCapabilities();
    // a user data dir is configured
    Assert.assertNotEquals(((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, --user-data-dir=/home/foo/edge]");
    Assert.assertTrue(((Map<?, ?>) (((EdgeOptions) capa).asMap().get(EdgeOptions.CAPABILITY))).get("args").toString().startsWith("[--disable-translate, --disable-web-security, --no-sandbox, --disable-site-isolation-trials, --disable-features=IsolateOrigins,site-per-process, --user-data-dir="));
}
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 13 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory method testCreateDefaultCapabilitiesWithVersion.

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

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

the class TestEdgeCapabilityFactory method testCreateEdgeCapabilitiesUserDefinedProfile.

@Test(groups = { "ut" })
public void testCreateEdgeCapabilitiesUserDefinedProfile() {
    when(config.getEdgeProfilePath()).thenReturn("/home/foo/edge");
    when(config.getMode()).thenReturn(DriverMode.LOCAL);
    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, --user-data-dir=/home/foo/edge]");
}
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 15 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory method testCreateEdgeCapabilitiesOverrideDriverPathLocal.

@Test(groups = { "ut" })
public void testCreateEdgeCapabilitiesOverrideDriverPathLocal() {
    try {
        when(config.getMode()).thenReturn(DriverMode.LOCAL);
        when(config.getEdgeDriverPath()).thenReturn("/opt/edge/driver/edgedriver");
        new EdgeCapabilitiesFactory(config).createCapabilities();
        Assert.assertEquals(System.getProperty(EdgeDriverService.EDGE_DRIVER_EXE_PROPERTY).replace(File.separator, "/"), "/opt/edge/driver/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)

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