Exemplo n.º 1
0
        public void StartingAndroidAppWithCapabilitiesOnTheServerSideTest()
        {
            string app = Apps.get("androidApiDemos");

            DesiredCapabilities serverCapabilities = Env.isSauce() ?
                                                     Caps.getAndroid501Caps(Apps.get("androidApiDemos")) :
                                                     Caps.getAndroid19Caps(Apps.get("androidApiDemos"));

            DesiredCapabilities clientCapabilities = new DesiredCapabilities();

            clientCapabilities.SetCapability(AndroidMobileCapabilityType.AppPackage, "io.appium.android.apis");
            clientCapabilities.SetCapability(AndroidMobileCapabilityType.AppActivity, ".view.WebView1");

            OptionCollector      argCollector = new OptionCollector().AddCapabilities(serverCapabilities);
            AppiumServiceBuilder builder      = new AppiumServiceBuilder().WithArguments(argCollector);

            AndroidDriver <AppiumWebElement> driver = null;

            try
            {
                driver = new AndroidDriver <AppiumWebElement>(builder, clientCapabilities);
                driver.CloseApp();
            }
            finally
            {
                if (driver != null)
                {
                    driver.Quit();
                }
            }
        }
Exemplo n.º 2
0
        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();
                }
            }
        }
Exemplo n.º 3
0
        public void BeforeAll()
        {
            DesiredCapabilities capabilities =
                Caps.getAndroid19Caps(Apps.get("androidApiDemosLocal"));
            Uri serverUri = AppiumServers.localURI;

            driver = new AndroidDriver <AndroidElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
            driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
        }
 public void BeforeAll()
 {
     var capabilities = Env.isSauce()
         ? Caps.getAndroid501Caps(Apps.get("selendroidTestApp"))
         : Caps.getAndroid19Caps(Apps.get("selendroidTestApp"));
     if (Env.isSauce())
     {
         capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
         capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
         capabilities.SetCapability("name", "android - complex");
         capabilities.SetCapability("tags", new[] {"sample"});
     }
     Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.LocalServiceURIAndroid;
     driver = new AndroidDriver<IWebElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
     driver.Manage().Timeouts().ImplicitWait = Env.IMPLICIT_TIMEOUT_SEC;
 }
Exemplo n.º 5
0
        public void BeforeAll()
        {
            DesiredCapabilities capabilities = Env.isSauce() ?
                                               Caps.getAndroid18Caps(Apps.get("androidApiDemos")) :
                                               Caps.getAndroid19Caps(Apps.get("androidApiDemos"));

            if (Env.isSauce())
            {
                capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
                capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
                capabilities.SetCapability("name", "android - complex");
                capabilities.SetCapability("tags", new string[] { "sample" });
            }
            Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.localURI;

            driver = new AndroidDriver <AndroidElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
            driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
        }
Exemplo n.º 6
0
        public void BeforeAll()
        {
            AppiumOptions capabilities = Env.isSauce()
                ? Caps.getAndroid501Caps(Apps.get("androidApiDemos"))
                : Caps.getAndroid19Caps(Apps.get("androidApiDemos"));

            if (Env.isSauce())
            {
                capabilities.AddAdditionalCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
                capabilities.AddAdditionalCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
                capabilities.AddAdditionalCapability("name", "android - simple");
                capabilities.AddAdditionalCapability("tags", new string[] { "sample" });
            }
            Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.LocalServiceURIAndroid;

            driver = new AndroidDriver <AndroidElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
            driver.Manage().Timeouts().ImplicitWait = Env.IMPLICIT_TIMEOUT_SEC;
        }
Exemplo n.º 7
0
        public void BeforeAll()
        {
            AppiumOptions capabilities = Env.isSauce()
                ? Caps.getAndroid501Caps(Apps.get("selendroidTestApp"))
                : Caps.getAndroid19Caps(Apps.get("selendroidTestApp"));

            if (Env.isSauce())
            {
                capabilities.AddAdditionalCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
                capabilities.AddAdditionalCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
                capabilities.AddAdditionalCapability("tags", new string[] { "sample" });
            }
            Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.LocalServiceURIAndroid;

            driver     = new AndroidDriver <AppiumWebElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
            pageObject = new AndroidJavaScriptTestPageObject(driver);
            driver.StartActivity("io.selendroid.testapp", ".WebViewActivity");
        }
        public void BeforeAll()
        {
            DesiredCapabilities capabilities = Env.isSauce()
                ? Caps.getAndroid501Caps(Apps.get("androidApiDemos"))
                : Caps.getAndroid19Caps(Apps.get("androidApiDemos"));

            if (Env.isSauce())
            {
                capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
                capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
                capabilities.SetCapability("tags", new string[] { "sample" });
            }
            Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.LocalServiceURIAndroid;

            driver = new AndroidDriver <AppiumWebElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
            TimeOutDuration timeSpan = new TimeOutDuration(new TimeSpan(0, 0, 0, 5, 0));

            pageObject = new AndroidPageObjectThatChecksTouchActions();
            PageFactory.InitElements(driver, pageObject, new AppiumPageObjectMemberDecorator(timeSpan));
        }
Exemplo n.º 9
0
        public void BeforeAll()
        {
            DesiredCapabilities capabilities = Env.isSauce()
                ? Caps.getAndroid501Caps(Apps.get("selendroidTestApp"))
                : Caps.getAndroid19Caps(Apps.get("selendroidTestApp"));

            if (Env.isSauce())
            {
                capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
                capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
                capabilities.SetCapability("name", "android - webview");
                capabilities.SetCapability("tags", new string[] { "sample" });
            }
            capabilities.SetCapability(AndroidMobileCapabilityType.AppPackage, "io.selendroid.testapp");
            capabilities.SetCapability(AndroidMobileCapabilityType.AppActivity, ".WebViewActivity");
            Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.LocalServiceURIAndroid;

            driver = new AndroidDriver <IWebElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
            driver.Manage().Timeouts().ImplicitWait = Env.IMPLICIT_TIMEOUT_SEC;
        }
Exemplo n.º 10
0
        public void StartingAndroidAppWithCapabilitiesOnlyTest()
        {
            string app = Apps.get("androidApiDemos");
            DesiredCapabilities capabilities =
                Caps.getAndroid19Caps(app);

            AndroidDriver <AppiumWebElement> driver = null;

            try
            {
                driver = new AndroidDriver <AppiumWebElement>(capabilities);
                driver.CloseApp();
            }
            finally
            {
                if (driver != null)
                {
                    driver.Quit();
                }
            }
        }
Exemplo n.º 11
0
        public void BeforeAll()
        {
            DesiredCapabilities capabilities = Env.isSauce() ?
                                               Caps.getAndroid18Caps(Apps.get("selendroidTestApp")) :
                                               Caps.getAndroid19Caps(Apps.get("selendroidTestApp"));

            if (Env.isSauce())
            {
                capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
                capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
                capabilities.SetCapability("name", "android - webview");
                capabilities.SetCapability("tags", new string[] { "sample" });
            }
            Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.localURI;

            driver = new AndroidDriver <AppiumWebElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
            TimeOutDuration timeSpan = new TimeOutDuration(new TimeSpan(0, 0, 0, 5, 0));

            pageObject = new AndroidWebView();
            PageFactory.InitElements(driver, pageObject, new AppiumPageObjectMemberDecorator(timeSpan));
            driver.StartActivity("io.selendroid.testapp", ".WebViewActivity");
        }
Exemplo n.º 12
0
        public void CheckThatServiseIsNotRunWhenTheCreatingOfANewSessionIsFailed()
        {
            DesiredCapabilities capabilities = Env.isSauce()
                ? //it will be a cause of error
                                               Caps.getAndroid501Caps(Apps.get("androidApiDemos"))
                : Caps.getAndroid19Caps(Apps.get("androidApiDemos"));

            capabilities.SetCapability(MobileCapabilityType.DeviceName, "iPhone Simulator");
            capabilities.SetCapability(MobileCapabilityType.PlatformName, MobilePlatform.IOS);

            AppiumServiceBuilder builder = new AppiumServiceBuilder();
            AppiumLocalService   service = builder.Build();

            service.Start();

            IOSDriver <AppiumWebElement> driver = null;

            try
            {
                try
                {
                    driver = new IOSDriver <AppiumWebElement>(service, capabilities);
                }
                catch (Exception e)
                {
                    Assert.IsTrue(!service.IsRunning);
                    return;
                }
                throw new Exception("Any exception was expected");
            }
            finally
            {
                if (driver != null)
                {
                    driver.Quit();
                }
            }
        }