public void StartingAndroidAppWithCapabilitiesAndServiceTest()
        {
            DesiredCapabilities capabilities = Env.isSauce() ?
                                               Caps.getAndroid501Caps(Apps.get("androidApiDemos")) :
                                               Caps.getAndroid19Caps(Apps.get("androidApiDemos"));


            OptionCollector argCollector = new OptionCollector()
                                           .AddArguments(GeneralOptionList.OverrideSession()).AddArguments(GeneralOptionList.StrictCaps());
            AppiumServiceBuilder builder = new AppiumServiceBuilder().WithArguments(argCollector);

            AndroidDriver <AppiumWebElement> driver = null;

            try
            {
                driver = new AndroidDriver <AppiumWebElement>(builder, capabilities);
                driver.CloseApp();
            }
            finally
            {
                if (driver != null)
                {
                    driver.Quit();
                }
            }
        }
        public void CheckAbilityToStartServiceUsingCapabilitiesAndFlags()
        {
            DesiredCapabilities capabilities = new DesiredCapabilities();

            capabilities.SetCapability(MobileCapabilityType.PlatformName, "Android");
            capabilities.SetCapability(MobileCapabilityType.FullReset, true);
            capabilities.SetCapability(MobileCapabilityType.NewCommandTimeout, 60);
            capabilities.SetCapability(AndroidMobileCapabilityType.AppPackage, "io.appium.android.apis");
            capabilities.SetCapability(AndroidMobileCapabilityType.AppActivity, ".view.WebView1");

            OptionCollector args = new OptionCollector().AddCapabilities(capabilities)
                                   .AddArguments(GeneralOptionList.CallbackAddress(testIP))
                                   .AddArguments(GeneralOptionList.OverrideSession());
            AppiumLocalService service = null;

            try
            {
                service = new AppiumServiceBuilder().WithArguments(args).Build();
                service.Start();
                Assert.IsTrue(service.IsRunning);
            }
            finally
            {
                if (service != null)
                {
                    service.Dispose();
                }
            }
        }
        public void CheckAbilityToBuildServiceWithDefinedParametersAndExternallyDefinedNode()
        {
            OptionCollector args = new OptionCollector().AddArguments(GeneralOptionList.OverrideSession());

            new AppiumServiceBuilder().WithAppiumJS(new FileInfo(PathToCustomizedAppiumJS)).
            UsingPort(4000).WithArguments(args).Build();
        }
        public void StartingIOSAppWithCapabilitiesAndServiseTest()
        {
            string app = Apps.get("iosTestApp");
            DesiredCapabilities capabilities =
                Caps.getIos92Caps(app);

            OptionCollector argCollector = new OptionCollector()
                                           .AddArguments(GeneralOptionList.OverrideSession()).AddArguments(GeneralOptionList.StrictCaps());

            AppiumServiceBuilder         builder = new AppiumServiceBuilder().WithArguments(argCollector);
            IOSDriver <AppiumWebElement> driver  = null;

            try
            {
                driver = new IOSDriver <AppiumWebElement>(builder, capabilities, Env.INIT_TIMEOUT_SEC);
                driver.CloseApp();
            }
            finally
            {
                if (driver != null)
                {
                    driver.Quit();
                }
            }
        }
 public void CheckAbilityToBuildServiceWithDefinedParametersAndNodeSetInProperties()
 {
     try
     {
         string definedNode = PathToCustomizedAppiumJS;
         Environment.SetEnvironmentVariable(AppiumServiceConstants.AppiumBinaryPath, definedNode);
         OptionCollector args = new OptionCollector().AddArguments(GeneralOptionList.OverrideSession());
         new AppiumServiceBuilder().UsingPort(4000).WithArguments(args).Build();
     }
     finally
     {
         Environment.SetEnvironmentVariable(AppiumServiceConstants.AppiumBinaryPath, string.Empty);
     }
 }
Example #6
0
 public void AppiumServerRun(int pThreadIndex)
 {
     try
     {
         OptionCollector args = new OptionCollector().AddArguments(GeneralOptionList.OverrideSession());
         args.AddArguments(AndroidOptionList.BootstrapPort((bootstrapPort + pThreadIndex * 2).ToString()));
         args.AddArguments(AndroidOptionList.SelendroidPort((selendroidPort + pThreadIndex * 2).ToString()));
         service = new AppiumServiceBuilder().UsingPort(appiumServerPort + pThreadIndex * 2).WithArguments(args).Build();
         service.Start();
     }
     catch (Exception e)
     {
         _Log.PrintTaskStatus(pThreadIndex, "\tCreate the Appium Server Exception : " + e.Message);
     }
 }
        public void CheckAbilityToStartServiceUsingFlags()
        {
            AppiumLocalService service = null;
            var args = new OptionCollector().AddArguments(GeneralOptionList.CallbackAddress(_testIp))
                       .AddArguments(GeneralOptionList.OverrideSession());

            try
            {
                service = new AppiumServiceBuilder().WithArguments(args).Build();
                service.Start();
                Assert.IsTrue(service.IsRunning);
            }
            finally
            {
                service?.Dispose();
            }
        }
Example #8
0
        public void StartingIosAppWithCapabilitiesAndServiseTest()
        {
            var app          = Apps.Get("iosTestApp");
            var capabilities =
                Caps.GetIosCaps(app);

            var argCollector = new OptionCollector()
                               .AddArguments(GeneralOptionList.OverrideSession()).AddArguments(GeneralOptionList.StrictCaps());

            var builder = new AppiumServiceBuilder().WithArguments(argCollector);
            IOSDriver <AppiumWebElement> driver = null;

            try
            {
                driver = new IOSDriver <AppiumWebElement>(builder, capabilities, Env.InitTimeoutSec);
                driver.CloseApp();
            }
            finally
            {
                driver?.Quit();
            }
        }
Example #9
0
        public void StartingAndroidAppWithCapabilitiesAndServiceTest()
        {
            var capabilities = Env.ServerIsRemote()
                ? Caps.GetAndroidUIAutomatorCaps(Apps.Get("androidApiDemos"))
                : Caps.GetAndroidUIAutomatorCaps(Apps.Get("androidApiDemos"));


            var argCollector = new OptionCollector()
                               .AddArguments(GeneralOptionList.OverrideSession()).AddArguments(GeneralOptionList.StrictCaps());
            var builder = new AppiumServiceBuilder().WithArguments(argCollector);

            AndroidDriver <AppiumWebElement> driver = null;

            try
            {
                driver = new AndroidDriver <AppiumWebElement>(builder, capabilities);
                driver.CloseApp();
            }
            finally
            {
                driver?.Quit();
            }
        }