Search in sources :

Example 16 with SeleniumTestsContext

use of com.seleniumtests.core.SeleniumTestsContext in project seleniumRobot by bhecquet.

the class TestSeleniumTestContext method testPlatformParsingForIOS.

@Test(groups = { "ut context" })
public void testPlatformParsingForIOS(final ITestContext testNGCtx, final XmlTest xmlTest) {
    try {
        System.setProperty("platform", "iOS 9.01");
        System.setProperty("deviceName", "");
        initThreadContext(testNGCtx);
        SeleniumTestsContext seleniumTestsCtx = SeleniumTestsContextManager.getThreadContext();
        Assert.assertEquals(seleniumTestsCtx.getPlatform(), "iOS");
        Assert.assertEquals(seleniumTestsCtx.getMobilePlatformVersion(), "9.01");
    } finally {
        System.clearProperty("platform");
        System.clearProperty("deviceName");
    }
}
Also used : SeleniumTestsContext(com.seleniumtests.core.SeleniumTestsContext) Test(org.testng.annotations.Test) XmlTest(org.testng.xml.XmlTest) GenericTest(com.seleniumtests.GenericTest)

Example 17 with SeleniumTestsContext

use of com.seleniumtests.core.SeleniumTestsContext in project seleniumRobot by bhecquet.

the class TestSeleniumTestContext method testUserDefinedParam.

/**
 * If parameter is defined in test and as JVM parameter (user defined), the user defined parameter must be used
 */
@Test(groups = { "ut context" })
public void testUserDefinedParam(final ITestContext testNGCtx, final XmlTest xmlTest) {
    try {
        System.setProperty("dpTagsInclude", "anOtherTag");
        initThreadContext(testNGCtx);
        SeleniumTestsContext seleniumTestsCtx = SeleniumTestsContextManager.getThreadContext();
        Assert.assertEquals(seleniumTestsCtx.getDPTagsInclude(), "anOtherTag");
    } finally {
        System.clearProperty("dpTagsInclude");
    }
}
Also used : SeleniumTestsContext(com.seleniumtests.core.SeleniumTestsContext) Test(org.testng.annotations.Test) XmlTest(org.testng.xml.XmlTest) GenericTest(com.seleniumtests.GenericTest)

Example 18 with SeleniumTestsContext

use of com.seleniumtests.core.SeleniumTestsContext in project seleniumRobot by bhecquet.

the class TestSeleniumTestContext method testSuiteLevelParam.

/**
 * If parameter is only defined in test suite, it's correctly read
 */
@Test(groups = { "ut context" })
public void testSuiteLevelParam(final ITestContext testNGCtx, final XmlTest xmlTest) {
    initThreadContext(testNGCtx);
    SeleniumTestsContext seleniumTestsCtx = SeleniumTestsContextManager.getThreadContext();
    Assert.assertEquals(seleniumTestsCtx.getImplicitWaitTimeout(), 2);
}
Also used : SeleniumTestsContext(com.seleniumtests.core.SeleniumTestsContext) Test(org.testng.annotations.Test) XmlTest(org.testng.xml.XmlTest) GenericTest(com.seleniumtests.GenericTest)

Example 19 with SeleniumTestsContext

use of com.seleniumtests.core.SeleniumTestsContext in project seleniumRobot by bhecquet.

the class TestSeleniumTestContext method testProxyPresetCaptureNetworkWithManual.

@Test(groups = "ut context")
public void testProxyPresetCaptureNetworkWithManual(final ITestContext testNGCtx, final XmlTest xmlTest) {
    SeleniumTestsContextManager.generateApplicationPath(testNGCtx.getCurrentXmlTest().getSuite());
    SeleniumTestsContext seleniumContext = new SeleniumTestsContext();
    seleniumContext.setCaptureNetwork(true);
    seleniumContext.setWebProxyType("MANUAL");
    seleniumContext.setConfiguration(new HashMap<>());
    seleniumContext.setTestConfiguration();
    seleniumContext.updateProxyConfig();
    Assert.assertEquals(seleniumContext.getWebProxyType(), ProxyType.MANUAL);
}
Also used : SeleniumTestsContext(com.seleniumtests.core.SeleniumTestsContext) Test(org.testng.annotations.Test) XmlTest(org.testng.xml.XmlTest) GenericTest(com.seleniumtests.GenericTest)

Example 20 with SeleniumTestsContext

use of com.seleniumtests.core.SeleniumTestsContext in project seleniumRobot by bhecquet.

the class TestSeleniumTestContext method testTestLevelParam.

/**
 * If parameter is defined in test suite and test, the test parameter must override suite parameter
 */
@Test(groups = { "ut context" })
public void testTestLevelParam(final ITestContext testNGCtx, final XmlTest xmlTest) {
    initThreadContext(testNGCtx);
    SeleniumTestsContext seleniumTestsCtx = SeleniumTestsContextManager.getThreadContext();
    Assert.assertEquals(seleniumTestsCtx.getApp(), "https://www.google.fr");
}
Also used : SeleniumTestsContext(com.seleniumtests.core.SeleniumTestsContext) Test(org.testng.annotations.Test) XmlTest(org.testng.xml.XmlTest) GenericTest(com.seleniumtests.GenericTest)

Aggregations

SeleniumTestsContext (com.seleniumtests.core.SeleniumTestsContext)54 Test (org.testng.annotations.Test)44 GenericTest (com.seleniumtests.GenericTest)43 XmlTest (org.testng.xml.XmlTest)32 ITestResult (org.testng.ITestResult)12 AndroidCapabilitiesFactory (com.seleniumtests.browserfactory.AndroidCapabilitiesFactory)11 DriverConfig (com.seleniumtests.driver.DriverConfig)11 MutableCapabilities (org.openqa.selenium.MutableCapabilities)11 HashMap (java.util.HashMap)9 TestVariable (com.seleniumtests.core.TestVariable)7 ConnectorsTest (com.seleniumtests.ConnectorsTest)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)6 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)6 TestStep (com.seleniumtests.reporter.logger.TestStep)5 File (java.io.File)4 ArrayList (java.util.ArrayList)4 Set (java.util.Set)4 ITestContext (org.testng.ITestContext)4 IOException (java.io.IOException)3 Map (java.util.Map)3