Search in sources :

Example 16 with BrowserInfo

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

the class TestBrowserInfo method testGetDefaultEdgeWindowsProfile.

@Test(groups = { "ut" })
public void testGetDefaultEdgeWindowsProfile() throws Exception {
    PowerMockito.mockStatic(OSUtility.class);
    when(OSUtility.getCurrentPlatorm()).thenReturn(Platform.WINDOWS);
    BrowserInfo bi = new BrowserInfo(BrowserType.EDGE, "90.0", null);
    Assert.assertTrue(bi.getDefaultProfilePath().replace("\\", "/").matches("C:/Users/.*?/AppData/Local/Microsoft/Edge/User Data"));
}
Also used : BrowserInfo(com.seleniumtests.browserfactory.BrowserInfo) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 17 with BrowserInfo

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

the class TestBrowserInfo method testGetDefaultChromeWindowsProfile.

@Test(groups = { "ut" })
public void testGetDefaultChromeWindowsProfile() throws Exception {
    PowerMockito.mockStatic(OSUtility.class);
    when(OSUtility.getCurrentPlatorm()).thenReturn(Platform.WINDOWS);
    BrowserInfo bi = new BrowserInfo(BrowserType.CHROME, "58.0", null);
    Assert.assertTrue(bi.getDefaultProfilePath().replace("\\", "/").matches("C:/Users/.*?/AppData/Local/Google/Chrome/User Data"));
}
Also used : BrowserInfo(com.seleniumtests.browserfactory.BrowserInfo) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 18 with BrowserInfo

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

the class TestBrowserInfo method testChromeVersionNoDriver.

/**
 * Error should be raised when no driver is found
 * @throws Exception
 */
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testChromeVersionNoDriver() throws Exception {
    List<String> driverList = Arrays.asList("chromedriver_2.20_android-6.0");
    BrowserInfo bInfo = PowerMockito.spy(new BrowserInfo(BrowserType.CHROME, "70.0", null));
    PowerMockito.when(bInfo, "getDriverFiles").thenReturn(driverList);
    PowerMockito.doNothing().when(bInfo, "checkResourceExists");
    bInfo.getDriverFileName();
}
Also used : BrowserInfo(com.seleniumtests.browserfactory.BrowserInfo) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 19 with BrowserInfo

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

the class TestBrowserInfo method testIE10Version.

@Test(groups = { "ut" })
public void testIE10Version() {
    if (SystemUtils.IS_OS_WINDOWS) {
        BrowserInfo bInfo = new BrowserInfo(BrowserType.INTERNET_EXPLORER, "10", null);
        Assert.assertEquals(bInfo.getDriverFileName(), "IEDriverServer_Win32");
    }
}
Also used : BrowserInfo(com.seleniumtests.browserfactory.BrowserInfo) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 20 with BrowserInfo

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

the class TestBrowserInfo method testGetDefaultEdgeLinuxProfile.

@Test(groups = { "ut" })
public void testGetDefaultEdgeLinuxProfile() throws Exception {
    PowerMockito.mockStatic(OSUtility.class);
    when(OSUtility.getCurrentPlatorm()).thenReturn(Platform.LINUX);
    BrowserInfo bi = new BrowserInfo(BrowserType.EDGE, "90.0", null);
    Assert.assertTrue(bi.getDefaultProfilePath().matches("/home/.*?/.config/edge/default"));
}
Also used : BrowserInfo(com.seleniumtests.browserfactory.BrowserInfo) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

BrowserInfo (com.seleniumtests.browserfactory.BrowserInfo)71 Test (org.testng.annotations.Test)59 MockitoTest (com.seleniumtests.MockitoTest)53 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)53 ArrayList (java.util.ArrayList)23 List (java.util.List)19 BrowserType (com.seleniumtests.driver.BrowserType)18 HashMap (java.util.HashMap)14 MutableCapabilities (org.openqa.selenium.MutableCapabilities)9 GenericDriverTest (com.seleniumtests.GenericDriverTest)6 ChromeCapabilitiesFactory (com.seleniumtests.browserfactory.ChromeCapabilitiesFactory)5 EdgeCapabilitiesFactory (com.seleniumtests.browserfactory.EdgeCapabilitiesFactory)5 CustomEventFiringWebDriver (com.seleniumtests.driver.CustomEventFiringWebDriver)4 BeforeMethod (org.testng.annotations.BeforeMethod)4 EnumMap (java.util.EnumMap)3 Map (java.util.Map)3 SkipException (org.testng.SkipException)3 FirefoxCapabilitiesFactory (com.seleniumtests.browserfactory.FirefoxCapabilitiesFactory)2 IECapabilitiesFactory (com.seleniumtests.browserfactory.IECapabilitiesFactory)2 MobileDevice (com.seleniumtests.browserfactory.mobile.MobileDevice)2