Search in sources :

Example 1 with DriverConfig

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

the class TestAndroidCapabilitiesFactory method testCreateDefaultCapabilitiesWithAutomationName.

/**
 * issue #367: check automationName is set in capabilities when overriden
 */
@Test(groups = { "ut" })
public void testCreateDefaultCapabilitiesWithAutomationName() {
    SeleniumTestsContext context = new SeleniumTestsContext(SeleniumTestsContextManager.getThreadContext());
    context.setBrowser(BrowserType.CHROME.toString());
    context.setMobilePlatformVersion("8.0");
    context.setPlatform("android");
    context.setDeviceName("Samsung Galasy S8");
    context.setAutomationName("UiAutomator1");
    context.setApp("");
    DriverConfig config = new DriverConfig(context);
    AndroidCapabilitiesFactory capaFactory = new AndroidCapabilitiesFactory(config);
    MutableCapabilities capa = capaFactory.createCapabilities();
    Assert.assertEquals(capa.getCapability(CapabilityType.BROWSER_NAME), BrowserType.CHROME.toString().toLowerCase());
    Assert.assertEquals(capa.getCapability(MobileCapabilityType.AUTOMATION_NAME), "UiAutomator1");
    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 2 with DriverConfig

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

the class TestAndroidCapabilitiesFactory method testCreateDefaultCapabilitiesWithNodeTagsInGridMode.

/**
 * Check default behaviour when node tags are defined in grid mode
 * tags are transferred to driver
 */
@Test(groups = { "ut" })
public void testCreateDefaultCapabilitiesWithNodeTagsInGridMode() {
    SeleniumTestsContext context = new SeleniumTestsContext(SeleniumTestsContextManager.getThreadContext());
    context.setBrowser(BrowserType.CHROME.toString());
    context.setNodeTags("foo,bar");
    context.setRunMode("grid");
    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(SeleniumRobotCapabilityType.NODE_TAGS), Arrays.asList("foo", "bar"));
}
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 3 with DriverConfig

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

the class TestAndroidCapabilitiesFactory method testCreateCapabilitiesWithRelativeApplicationPath.

/**
 * Check mobile test with app relative path => check absolute path is set in capabilities
 */
@Test(groups = { "ut" })
public void testCreateCapabilitiesWithRelativeApplicationPath() {
    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("data/core/app.apk");
    DriverConfig config = new DriverConfig(context);
    AndroidCapabilitiesFactory capaFactory = new AndroidCapabilitiesFactory(config);
    MutableCapabilities capa = capaFactory.createCapabilities();
    Assert.assertEquals(capa.getCapability(CapabilityType.BROWSER_NAME), "");
    logger.info("app path: " + capa.getCapability("app"));
    Assert.assertTrue(capa.getCapability("app").toString().contains("/data/core/app.apk"));
}
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 4 with DriverConfig

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

the class TestAndroidCapabilitiesFactory method testCreateCapabilitiesWithAbsoluteApplicationPath.

/**
 * Check mobile test with app relative path => check absolute path is set in capabilities
 */
@Test(groups = { "ut" })
public void testCreateCapabilitiesWithAbsoluteApplicationPath() {
    SeleniumTestsContext context = new SeleniumTestsContext(SeleniumTestsContextManager.getThreadContext());
    context.setMobilePlatformVersion("8.0");
    context.setPlatform("android");
    context.setDeviceName("Samsung Galasy S8");
    context.setAppPackage("appPackage");
    context.setAppActivity("appActivity");
    String path = new File("data/core/app.apk").getAbsolutePath();
    context.setApp(path);
    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"), path.replace("\\", "/"));
}
Also used : SeleniumTestsContext(com.seleniumtests.core.SeleniumTestsContext) MutableCapabilities(org.openqa.selenium.MutableCapabilities) DriverConfig(com.seleniumtests.driver.DriverConfig) File(java.io.File) AndroidCapabilitiesFactory(com.seleniumtests.browserfactory.AndroidCapabilitiesFactory) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 5 with DriverConfig

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

the class TestAndroidCapabilitiesFactory method testCreateCapabilitiesWithApplicationOldAndroid.

/**
 * Check automationName capability with android < 4
 */
@Test(groups = { "ut" })
public void testCreateCapabilitiesWithApplicationOldAndroid() {
    SeleniumTestsContext context = new SeleniumTestsContext(SeleniumTestsContextManager.getThreadContext());
    context.setMobilePlatformVersion("2.3");
    context.setPlatform("android");
    context.setDeviceName("Samsung Galasy S1");
    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), "Selendroid");
}
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)

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