Search in sources :

Example 11 with IECapabilitiesFactory

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

the class TestIECapabilityFactory method testCreateDefaultEdgeIEModeCapabilitiesGridEdgeNotAvailable.

/**
 * If Edge is not available, throw an error when Edge in IE mode is requested
 */
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testCreateDefaultEdgeIEModeCapabilitiesGridEdgeNotAvailable() {
    Mockito.when(config.getIeMode()).thenReturn(true);
    Mockito.when(config.getMode()).thenReturn(DriverMode.LOCAL);
    Mockito.when(config.getInitialUrl()).thenReturn("http://mysite");
    MutableCapabilities capa = new IECapabilitiesFactory(config).createCapabilities();
}
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 12 with IECapabilitiesFactory

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

the class TestIECapabilityFactory method testCreateIECapabilitiesStandardDriverPathLocal.

@Test(groups = { "ut" })
public void testCreateIECapabilitiesStandardDriverPathLocal() {
    try {
        PowerMockito.mockStatic(Advapi32Util.class);
        PowerMockito.when(Advapi32Util.registryGetValue(any(HKEY.class), anyString(), anyString())).thenReturn("1");
        Mockito.when(config.getMode()).thenReturn(DriverMode.LOCAL);
        new IECapabilitiesFactory(config).createCapabilities();
        Assert.assertTrue(System.getProperty(InternetExplorerDriverService.IE_DRIVER_EXE_PROPERTY).replace(File.separator, "/").contains("/drivers/IEDriverServer_"));
    } finally {
        System.clearProperty(InternetExplorerDriverService.IE_DRIVER_EXE_PROPERTY);
    }
}
Also used : HKEY(com.sun.jna.platform.win32.WinReg.HKEY) IECapabilitiesFactory(com.seleniumtests.browserfactory.IECapabilitiesFactory) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 13 with IECapabilitiesFactory

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

the class TestIECapabilityFactory method testCreateDefaultCapabilitiesWithVersion.

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