Search in sources :

Example 11 with DriverConfig

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

the class TestAndroidCapabilitiesFactory method testCreateDefaultAndroidBrowserCapabilities.

/**
 * Check default behaviour
 */
@Test(groups = { "ut" })
public void testCreateDefaultAndroidBrowserCapabilities() {
    SeleniumTestsContext context = new SeleniumTestsContext(SeleniumTestsContextManager.getThreadContext());
    context.setBrowser(BrowserType.BROWSER.toString());
    context.setMobilePlatformVersion("8.0");
    context.setPlatform("android");
    context.setDeviceName("Samsung Galasy S8");
    context.setApp("");
    DriverConfig config = new DriverConfig(context);
    AndroidCapabilitiesFactory capaFactory = new AndroidCapabilitiesFactory(config);
    MutableCapabilities capa = capaFactory.createCapabilities();
    Assert.assertEquals(capa.getCapability(CapabilityType.BROWSER_NAME), BrowserType.BROWSER.toString().toLowerCase());
    Assert.assertNull(capa.getCapability(ChromeOptions.CAPABILITY));
    Assert.assertEquals(capa.getCapability(MobileCapabilityType.AUTOMATION_NAME), "Appium");
    Assert.assertEquals(capa.getCapability(MobileCapabilityType.PLATFORM_NAME), "android");
    Assert.assertEquals(capa.getCapability(MobileCapabilityType.PLATFORM_VERSION), "8.0");
    Assert.assertEquals(capa.getCapability(MobileCapabilityType.DEVICE_NAME), "Samsung Galasy S8");
    // from exampleConfigGenericParams.xml when tu.xml is executed, else, null
    Assert.assertEquals(capa.getCapability(AndroidMobileCapabilityType.APP_PACKAGE), "com.infotel.mobile");
    // from exampleConfigGenericParams.xml when tu.xml is executed, else, null
    Assert.assertEquals(capa.getCapability(AndroidMobileCapabilityType.APP_ACTIVITY), "com.infotel.mobile.StartActivity");
    Assert.assertNull(capa.getCapability(MobileCapabilityType.FULL_RESET));
}
Also used : SeleniumTestsContext(com.seleniumtests.core.SeleniumTestsContext) MutableCapabilities(org.openqa.selenium.MutableCapabilities) DriverConfig(com.seleniumtests.driver.DriverConfig) AndroidCapabilitiesFactory(com.seleniumtests.browserfactory.AndroidCapabilitiesFactory) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 12 with DriverConfig

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

the class TestAndroidCapabilitiesFactory method testCreateCapabilitiesWithApplication.

/**
 * Check mobile test with app
 */
@Test(groups = { "ut" })
public void testCreateCapabilitiesWithApplication() {
    SeleniumTestsContext context = new SeleniumTestsContext(SeleniumTestsContextManager.getThreadContext());
    context.setMobilePlatformVersion("8.0");
    context.setPlatform("android");
    context.setDeviceName("Samsung Galasy S8");
    context.setAppPackage("appPackage");
    context.setAppActivity("appActivity");
    context.setApp("com.covea.mobileapp");
    DriverConfig config = new DriverConfig(context);
    AndroidCapabilitiesFactory capaFactory = new AndroidCapabilitiesFactory(config);
    MutableCapabilities capa = capaFactory.createCapabilities();
    Assert.assertEquals(capa.getCapability(CapabilityType.BROWSER_NAME), "");
    Assert.assertEquals(capa.getCapability("app"), "com.covea.mobileapp");
    Assert.assertEquals(capa.getCapability(MobileCapabilityType.AUTOMATION_NAME), "Appium");
    Assert.assertEquals(capa.getCapability(MobileCapabilityType.PLATFORM_NAME), "android");
    Assert.assertEquals(capa.getCapability(MobileCapabilityType.PLATFORM_VERSION), "8.0");
    Assert.assertEquals(capa.getCapability(MobileCapabilityType.DEVICE_NAME), "Samsung Galasy S8");
    Assert.assertEquals(capa.getCapability(MobileCapabilityType.FULL_RESET), true);
    Assert.assertEquals(capa.getCapability(AndroidMobileCapabilityType.APP_PACKAGE), "appPackage");
    Assert.assertEquals(capa.getCapability(AndroidMobileCapabilityType.APP_ACTIVITY), "appActivity");
}
Also used : SeleniumTestsContext(com.seleniumtests.core.SeleniumTestsContext) MutableCapabilities(org.openqa.selenium.MutableCapabilities) DriverConfig(com.seleniumtests.driver.DriverConfig) AndroidCapabilitiesFactory(com.seleniumtests.browserfactory.AndroidCapabilitiesFactory) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 13 with DriverConfig

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

the class TestAndroidCapabilitiesFactory method testCreateCapabilitiesWithApplicationOldAndroid2.

/**
 * Check automationName capability with android < 6
 */
@Test(groups = { "ut" })
public void testCreateCapabilitiesWithApplicationOldAndroid2() {
    SeleniumTestsContext context = new SeleniumTestsContext(SeleniumTestsContextManager.getThreadContext());
    context.setMobilePlatformVersion("5.0");
    context.setPlatform("android");
    context.setDeviceName("Samsung Galasy S5");
    context.setAppPackage("appPackage");
    context.setAppActivity("appActivity");
    context.setFullReset(true);
    context.setApp("com.covea.mobileapp");
    DriverConfig config = new DriverConfig(context);
    AndroidCapabilitiesFactory capaFactory = new AndroidCapabilitiesFactory(config);
    MutableCapabilities capa = capaFactory.createCapabilities();
    Assert.assertEquals(capa.getCapability(MobileCapabilityType.AUTOMATION_NAME), "UiAutomator1");
}
Also used : SeleniumTestsContext(com.seleniumtests.core.SeleniumTestsContext) MutableCapabilities(org.openqa.selenium.MutableCapabilities) DriverConfig(com.seleniumtests.driver.DriverConfig) AndroidCapabilitiesFactory(com.seleniumtests.browserfactory.AndroidCapabilitiesFactory) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 14 with DriverConfig

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

the class TestAndroidCapabilitiesFactory method testCreateCapabilitiesWithApplicationOverrideFullReset.

/**
 * Check mobile test with app
 */
@Test(groups = { "ut" })
public void testCreateCapabilitiesWithApplicationOverrideFullReset() {
    SeleniumTestsContext context = new SeleniumTestsContext(SeleniumTestsContextManager.getThreadContext());
    context.setMobilePlatformVersion("8.0");
    context.setPlatform("android");
    context.setDeviceName("Samsung Galasy S8");
    context.setAppPackage("appPackage");
    context.setAppActivity("appActivity");
    context.setFullReset(false);
    context.setApp("com.covea.mobileapp");
    DriverConfig config = new DriverConfig(context);
    AndroidCapabilitiesFactory capaFactory = new AndroidCapabilitiesFactory(config);
    MutableCapabilities capa = capaFactory.createCapabilities();
    Assert.assertEquals(capa.getCapability(MobileCapabilityType.FULL_RESET), false);
}
Also used : SeleniumTestsContext(com.seleniumtests.core.SeleniumTestsContext) MutableCapabilities(org.openqa.selenium.MutableCapabilities) DriverConfig(com.seleniumtests.driver.DriverConfig) AndroidCapabilitiesFactory(com.seleniumtests.browserfactory.AndroidCapabilitiesFactory) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 15 with DriverConfig

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

the class TestDriverConfig method isNeoloadActive.

/**
 * Test Neoload is active when proxy mode is set and path is given
 */
@Test(groups = { "ut" })
public void isNeoloadActive() {
    try {
        SeleniumTestsContextManager.getThreadContext().setNeoloadUserPath("path");
        System.setProperty("nl.selenium.proxy.mode", "Design");
        DriverConfig config = new DriverConfig(SeleniumTestsContextManager.getThreadContext());
        Assert.assertTrue(config.isNeoloadActive());
    } finally {
        System.clearProperty("nl.selenium.proxy.mode");
    }
}
Also used : DriverConfig(com.seleniumtests.driver.DriverConfig) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Aggregations

DriverConfig (com.seleniumtests.driver.DriverConfig)18 Test (org.testng.annotations.Test)15 GenericTest (com.seleniumtests.GenericTest)14 AndroidCapabilitiesFactory (com.seleniumtests.browserfactory.AndroidCapabilitiesFactory)11 SeleniumTestsContext (com.seleniumtests.core.SeleniumTestsContext)11 MutableCapabilities (org.openqa.selenium.MutableCapabilities)11 ReplayOnError (com.seleniumtests.uipage.ReplayOnError)3 CustomEventFiringWebDriver (com.seleniumtests.driver.CustomEventFiringWebDriver)2 MockitoTest (com.seleniumtests.MockitoTest)1 SeleniumTestsContextManager (com.seleniumtests.core.SeleniumTestsContextManager)1 TestStepManager (com.seleniumtests.core.TestStepManager)1 ScenarioException (com.seleniumtests.customexception.ScenarioException)1 BrowserType (com.seleniumtests.driver.BrowserType)1 DriverExceptionListener (com.seleniumtests.driver.DriverExceptionListener)1 TestType (com.seleniumtests.driver.TestType)1 WebUIDriver (com.seleniumtests.driver.WebUIDriver)1 TestStep (com.seleniumtests.reporter.logger.TestStep)1 StepStatus (com.seleniumtests.reporter.logger.TestStep.StepStatus)1 FrameElement (com.seleniumtests.uipage.htmlelements.FrameElement)1 HtmlElement (com.seleniumtests.uipage.htmlelements.HtmlElement)1