Search in sources :

Example 21 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory method testCreateDefaultCapabilitiesWithNodeTagsInGridMode.

/**
 * Check default behaviour when node tags are defined in grid mode
 * tags are transferred to driver
 */
@Test(groups = { "ut" })
public void testCreateDefaultCapabilitiesWithNodeTagsInGridMode() {
    when(config.isEnableJavascript()).thenReturn(true);
    when(config.getProxy()).thenReturn(proxyConfig);
    when(config.getNodeTags()).thenReturn(Arrays.asList("foo", "bar"));
    when(config.getMode()).thenReturn(DriverMode.GRID);
    MutableCapabilities capa = new EdgeCapabilitiesFactory(config).createCapabilities();
    Assert.assertEquals(capa.getCapability(SeleniumRobotCapabilityType.NODE_TAGS), Arrays.asList("foo", "bar"));
}
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 22 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory method testCreateEdgeCapabilitiesHeadless.

@Test(groups = { "ut" })
public void testCreateEdgeCapabilitiesHeadless() {
    when(config.isHeadlessBrowser()).thenReturn(true);
    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, --headless, --window-size=1280,1024, --disable-gpu]");
}
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 23 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory method testCreateEdgeCapabilitiesWrongProfile.

@Test(groups = { "ut" })
public void testCreateEdgeCapabilitiesWrongProfile() {
    when(config.getEdgeProfilePath()).thenReturn("wrongName");
    when(config.getMode()).thenReturn(DriverMode.LOCAL);
    MutableCapabilities capa = new EdgeCapabilitiesFactory(config).createCapabilities();
    // a user data dir is configured
    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]");
}
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 24 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory method testCreateEdgeCapabilitiesWithLogging.

@Test(groups = { "ut" })
public void testCreateEdgeCapabilitiesWithLogging() {
    try {
        when(config.getDebug()).thenReturn(Arrays.asList(DebugMode.DRIVER));
        when(config.getMode()).thenReturn(DriverMode.LOCAL);
        new EdgeCapabilitiesFactory(config).createCapabilities();
        Assert.assertEquals(System.getProperty(EdgeDriverService.EDGE_DRIVER_VERBOSE_LOG_PROPERTY), "true");
        Assert.assertTrue(System.getProperty(EdgeDriverService.EDGE_DRIVER_LOG_PROPERTY).endsWith("edgedriver.log"));
    } finally {
        System.clearProperty(EdgeDriverService.EDGE_DRIVER_VERBOSE_LOG_PROPERTY);
        System.clearProperty(EdgeDriverService.EDGE_DRIVER_LOG_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 25 with EdgeCapabilitiesFactory

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

the class TestEdgeCapabilityFactory method testCreateEdgeCapabilitiesWithDefaultProfileGrid.

@Test(groups = { "ut" })
public void testCreateEdgeCapabilitiesWithDefaultProfileGrid() {
    when(config.getMode()).thenReturn(DriverMode.GRID);
    when(config.getEdgeProfilePath()).thenReturn(BrowserInfo.DEFAULT_BROWSER_PRODFILE);
    MutableCapabilities capa = new EdgeCapabilitiesFactory(config).createCapabilities();
    // check 'edgeProfile' is set to 'default'
    Assert.assertEquals(capa.getCapability("edgeProfile"), BrowserInfo.DEFAULT_BROWSER_PRODFILE);
}
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