Search in sources :

Example 26 with BrowserType

use of com.seleniumtests.driver.BrowserType in project seleniumRobot by bhecquet.

the class TestChromeCapabilityFactory method testBetaVersionBrowserAbsent.

/**
 * If beta is not requested, and non beta browser not installed, return null
 */
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class, expectedExceptionsMessageRegExp = "Browser CHROME beta is not available")
public void testBetaVersionBrowserAbsent() {
    when(config.getMode()).thenReturn(DriverMode.LOCAL);
    Map<BrowserType, List<BrowserInfo>> browserInfos = new HashMap<>();
    browserInfos.put(BrowserType.CHROME, Arrays.asList(new BrowserInfo(BrowserType.CHROME, "96.0", "", false, false)));
    PowerMockito.when(OSUtility.getInstalledBrowsersWithVersion(true)).thenReturn(browserInfos);
    when(config.getBetaBrowser()).thenReturn(true);
    ChromeCapabilitiesFactory capaFactory = new ChromeCapabilitiesFactory(config);
    capaFactory.createCapabilities();
}
Also used : ChromeCapabilitiesFactory(com.seleniumtests.browserfactory.ChromeCapabilitiesFactory) BrowserType(com.seleniumtests.driver.BrowserType) HashMap(java.util.HashMap) BrowserInfo(com.seleniumtests.browserfactory.BrowserInfo) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 27 with BrowserType

use of com.seleniumtests.driver.BrowserType in project seleniumRobot by bhecquet.

the class TestChromeCapabilityFactory method testBetaVersionBrowserChoosen.

/**
 * If beta is requested, get the beta version even if both are present
 */
@Test(groups = { "ut" })
public void testBetaVersionBrowserChoosen() {
    when(config.getMode()).thenReturn(DriverMode.LOCAL);
    Map<BrowserType, List<BrowserInfo>> browserInfos = new HashMap<>();
    browserInfos.put(BrowserType.CHROME, Arrays.asList(new BrowserInfo(BrowserType.CHROME, "96.0", "", false, false), new BrowserInfo(BrowserType.CHROME, "97.0", "", false, true)));
    PowerMockito.when(OSUtility.getInstalledBrowsersWithVersion(true)).thenReturn(browserInfos);
    when(config.getBetaBrowser()).thenReturn(true);
    ChromeCapabilitiesFactory capaFactory = new ChromeCapabilitiesFactory(config);
    capaFactory.createCapabilities();
    Assert.assertTrue(capaFactory.getSelectedBrowserInfo().getBeta());
    Assert.assertEquals(capaFactory.getSelectedBrowserInfo().getVersion(), "97.0");
}
Also used : ChromeCapabilitiesFactory(com.seleniumtests.browserfactory.ChromeCapabilitiesFactory) BrowserType(com.seleniumtests.driver.BrowserType) HashMap(java.util.HashMap) BrowserInfo(com.seleniumtests.browserfactory.BrowserInfo) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 28 with BrowserType

use of com.seleniumtests.driver.BrowserType in project seleniumRobot by bhecquet.

the class TestChromeCapabilityFactory method testNonBetaVersionBrowserChoosen.

/**
 * If beta is not requested, get the non beta version even if both are present
 */
@Test(groups = { "ut" })
public void testNonBetaVersionBrowserChoosen() {
    when(config.getMode()).thenReturn(DriverMode.LOCAL);
    Map<BrowserType, List<BrowserInfo>> browserInfos = new HashMap<>();
    browserInfos.put(BrowserType.CHROME, Arrays.asList(new BrowserInfo(BrowserType.CHROME, "96.0", "", false, false), new BrowserInfo(BrowserType.CHROME, "97.0", "", false, true)));
    PowerMockito.when(OSUtility.getInstalledBrowsersWithVersion(false)).thenReturn(browserInfos);
    ChromeCapabilitiesFactory capaFactory = new ChromeCapabilitiesFactory(config);
    capaFactory.createCapabilities();
    Assert.assertFalse(capaFactory.getSelectedBrowserInfo().getBeta());
    Assert.assertEquals(capaFactory.getSelectedBrowserInfo().getVersion(), "96.0");
}
Also used : ChromeCapabilitiesFactory(com.seleniumtests.browserfactory.ChromeCapabilitiesFactory) BrowserType(com.seleniumtests.driver.BrowserType) HashMap(java.util.HashMap) BrowserInfo(com.seleniumtests.browserfactory.BrowserInfo) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 29 with BrowserType

use of com.seleniumtests.driver.BrowserType in project seleniumRobot by bhecquet.

the class TestEdgeCapabilityFactory method testNonBetaVersionBrowserChoosen.

/**
 * If beta is not requested, get the non beta version even if both are present
 */
@Test(groups = { "ut" })
public void testNonBetaVersionBrowserChoosen() {
    when(config.getMode()).thenReturn(DriverMode.LOCAL);
    Map<BrowserType, List<BrowserInfo>> browserInfos = new HashMap<>();
    browserInfos.put(BrowserType.EDGE, Arrays.asList(new BrowserInfo(BrowserType.EDGE, "101.0", "", false, false), new BrowserInfo(BrowserType.EDGE, "102.0", "", false, true)));
    PowerMockito.when(OSUtility.getInstalledBrowsersWithVersion(false)).thenReturn(browserInfos);
    EdgeCapabilitiesFactory capaFactory = new EdgeCapabilitiesFactory(config);
    capaFactory.createCapabilities();
    Assert.assertFalse(capaFactory.getSelectedBrowserInfo().getBeta());
    Assert.assertEquals(capaFactory.getSelectedBrowserInfo().getVersion(), "101.0");
}
Also used : BrowserType(com.seleniumtests.driver.BrowserType) HashMap(java.util.HashMap) BrowserInfo(com.seleniumtests.browserfactory.BrowserInfo) 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 30 with BrowserType

use of com.seleniumtests.driver.BrowserType in project seleniumRobot by bhecquet.

the class TestEdgeCapabilityFactory method testBetaVersionBrowserChoosen.

/**
 * If beta is requested, get the beta version even if both are present
 */
@Test(groups = { "ut" })
public void testBetaVersionBrowserChoosen() {
    when(config.getMode()).thenReturn(DriverMode.LOCAL);
    Map<BrowserType, List<BrowserInfo>> browserInfos = new HashMap<>();
    browserInfos.put(BrowserType.EDGE, Arrays.asList(new BrowserInfo(BrowserType.EDGE, "102.0", "", false, false), new BrowserInfo(BrowserType.EDGE, "103.0", "", false, true)));
    PowerMockito.when(OSUtility.getInstalledBrowsersWithVersion(true)).thenReturn(browserInfos);
    when(config.getBetaBrowser()).thenReturn(true);
    EdgeCapabilitiesFactory capaFactory = new EdgeCapabilitiesFactory(config);
    capaFactory.createCapabilities();
    Assert.assertTrue(capaFactory.getSelectedBrowserInfo().getBeta());
    Assert.assertEquals(capaFactory.getSelectedBrowserInfo().getVersion(), "103.0");
}
Also used : BrowserType(com.seleniumtests.driver.BrowserType) HashMap(java.util.HashMap) BrowserInfo(com.seleniumtests.browserfactory.BrowserInfo) 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)

Aggregations

BrowserType (com.seleniumtests.driver.BrowserType)32 List (java.util.List)28 Test (org.testng.annotations.Test)26 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)25 MockitoTest (com.seleniumtests.MockitoTest)22 ArrayList (java.util.ArrayList)20 BrowserInfo (com.seleniumtests.browserfactory.BrowserInfo)18 HashMap (java.util.HashMap)14 MutableCapabilities (org.openqa.selenium.MutableCapabilities)6 ChromeCapabilitiesFactory (com.seleniumtests.browserfactory.ChromeCapabilitiesFactory)5 EdgeCapabilitiesFactory (com.seleniumtests.browserfactory.EdgeCapabilitiesFactory)5 GenericDriverTest (com.seleniumtests.GenericDriverTest)4 OSUtilityUnix (com.seleniumtests.util.osutility.OSUtilityUnix)4 Path (java.nio.file.Path)4 CustomEventFiringWebDriver (com.seleniumtests.driver.CustomEventFiringWebDriver)3 ReporterTest (com.seleniumtests.it.reporter.ReporterTest)3 TextFieldElement (com.seleniumtests.uipage.htmlelements.TextFieldElement)3 EnumMap (java.util.EnumMap)3 Map (java.util.Map)3 WebDriver (org.openqa.selenium.WebDriver)3