Search in sources :

Example 6 with IECapabilitiesFactory

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

the class TestIECapabilityFactory method testCreateDefaultIECapabilities.

@Test(groups = { "ut" })
public void testCreateDefaultIECapabilities() {
    // check we start on "about:blank"
    Mockito.when(config.getInitialUrl()).thenReturn("http://mysite");
    MutableCapabilities capa = new IECapabilitiesFactory(config).createCapabilities();
    Assert.assertEquals(capa.getCapability(CapabilityType.BROWSER_NAME), "internet explorer");
    Assert.assertTrue((Boolean) capa.getCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING));
    Assert.assertTrue((Boolean) capa.getCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS));
    Assert.assertTrue((Boolean) capa.getCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION));
    Assert.assertEquals((String) capa.getCapability(InternetExplorerDriver.INITIAL_BROWSER_URL), "about:blank");
}
Also used : MutableCapabilities(org.openqa.selenium.MutableCapabilities) IECapabilitiesFactory(com.seleniumtests.browserfactory.IECapabilitiesFactory) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 7 with IECapabilitiesFactory

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

the class TestIECapabilityFactory method testCreateDefaultEdgeIEModeCapabilities.

/**
 * Edge IE mode in local
 * Check ie.edgepath and ie.edgechromium capabilities are set
 */
@Test(groups = { "ut" })
public void testCreateDefaultEdgeIEModeCapabilities() {
    Mockito.when(config.getIeMode()).thenReturn(true);
    Mockito.when(config.getMode()).thenReturn(DriverMode.LOCAL);
    Mockito.when(config.getInitialUrl()).thenReturn("http://mysite");
    Map<BrowserType, List<BrowserInfo>> browserInfos = new HashMap<>();
    browserInfos.put(BrowserType.INTERNET_EXPLORER, Arrays.asList(new BrowserInfo(BrowserType.INTERNET_EXPLORER, "11", "", false)));
    browserInfos.put(BrowserType.EDGE, Arrays.asList(new BrowserInfo(BrowserType.EDGE, "97.0", "", false)));
    PowerMockito.when(OSUtility.getInstalledBrowsersWithVersion(false)).thenReturn(browserInfos);
    MutableCapabilities capa = new IECapabilitiesFactory(config).createCapabilities();
    Assert.assertEquals(capa.getCapability(CapabilityType.BROWSER_NAME), "internet explorer");
    Assert.assertTrue((Boolean) capa.getCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING));
    Assert.assertTrue((Boolean) capa.getCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS));
    Assert.assertTrue((Boolean) capa.getCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION));
    Assert.assertEquals((String) capa.getCapability(InternetExplorerDriver.INITIAL_BROWSER_URL), "http://mysite");
    Assert.assertTrue((Boolean) capa.getCapability("ie.edgechromium"));
    Assert.assertEquals((String) capa.getCapability("ie.edgepath"), "");
    Assert.assertEquals(((Map<String, Object>) capa.getCapability(IECapabilitiesFactory.SE_IE_OPTIONS)).get("ie.edgepath"), "");
    Assert.assertTrue((boolean) ((Map<String, Object>) capa.getCapability(IECapabilitiesFactory.SE_IE_OPTIONS)).get("ie.edgechromium"));
}
Also used : BrowserType(com.seleniumtests.driver.BrowserType) HashMap(java.util.HashMap) BrowserInfo(com.seleniumtests.browserfactory.BrowserInfo) MutableCapabilities(org.openqa.selenium.MutableCapabilities) ArrayList(java.util.ArrayList) List(java.util.List) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) HashMap(java.util.HashMap) Map(java.util.Map) IECapabilitiesFactory(com.seleniumtests.browserfactory.IECapabilitiesFactory) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 8 with IECapabilitiesFactory

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

the class TestIECapabilityFactory method testCreateDefaultCapabilitiesWithPlatform.

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

Example 9 with IECapabilitiesFactory

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

the class TestIECapabilityFactory method testCreateDefaultCapabilitiesWithJavascriptDisabled.

@Test(groups = { "ut" })
public void testCreateDefaultCapabilitiesWithJavascriptDisabled() {
    Mockito.when(config.isEnableJavascript()).thenReturn(false);
    Mockito.when(config.getProxy()).thenReturn(proxyConfig);
    MutableCapabilities capa = new IECapabilitiesFactory(config).createCapabilities();
    Assert.assertFalse(capa.is(CapabilityType.SUPPORTS_JAVASCRIPT));
}
Also used : MutableCapabilities(org.openqa.selenium.MutableCapabilities) IECapabilitiesFactory(com.seleniumtests.browserfactory.IECapabilitiesFactory) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 10 with IECapabilitiesFactory

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

the class TestIECapabilityFactory method testCreateDefaultCapabilities.

/**
 * Check default behaviour
 */
@Test(groups = { "ut" })
public void testCreateDefaultCapabilities() {
    Mockito.when(config.isEnableJavascript()).thenReturn(true);
    Mockito.when(config.getProxy()).thenReturn(proxyConfig);
    Mockito.when(config.getNodeTags()).thenReturn(new ArrayList<>());
    MutableCapabilities capa = new IECapabilitiesFactory(config).createCapabilities();
    Assert.assertTrue(capa.is(CapabilityType.SUPPORTS_JAVASCRIPT));
    Assert.assertTrue(capa.is(CapabilityType.TAKES_SCREENSHOT));
    Assert.assertTrue(capa.is(CapabilityType.ACCEPT_SSL_CERTS));
    Assert.assertFalse(capa.is(SeleniumRobotCapabilityType.NODE_TAGS));
    Assert.assertEquals(capa.getVersion(), "");
    Assert.assertEquals(capa.getCapability(CapabilityType.PROXY), proxyConfig);
}
Also used : MutableCapabilities(org.openqa.selenium.MutableCapabilities) IECapabilitiesFactory(com.seleniumtests.browserfactory.IECapabilitiesFactory) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Aggregations

MockitoTest (com.seleniumtests.MockitoTest)13 IECapabilitiesFactory (com.seleniumtests.browserfactory.IECapabilitiesFactory)13 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)13 Test (org.testng.annotations.Test)13 MutableCapabilities (org.openqa.selenium.MutableCapabilities)10 BrowserInfo (com.seleniumtests.browserfactory.BrowserInfo)2 BrowserType (com.seleniumtests.driver.BrowserType)2 HKEY (com.sun.jna.platform.win32.WinReg.HKEY)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 Map (java.util.Map)1