Example #1
0
        /// <summary>
        /// Sets capabilities for testing the Windows application driver creation
        /// </summary>
        /// <returns>Windows application driver instance of the Appium Driver</returns>
        protected override AppiumDriver GetMobileDevice()
        {
            AppiumOptions options = new AppiumOptions();

            options.App = $"{Environment.SystemDirectory}\\notepad.exe";
            return(AppiumDriverFactory.GetWindowsDriver(new Uri("http://127.0.0.1:4723/wd/hub"), options, TimeSpan.FromSeconds(30)));
        }
Example #2
0
        public void LaunchWebBrowser()
        {
            var runOnRemote = Config.Settings.RuntimeSettings.RunOnRemoteMachine;

            if (runOnRemote == "SeleniumGrid")
            {
                Driver = new RemoteDriverFactory().CreateWebDriver();
            }

            else if (runOnRemote == "Appium")
            {
                Driver = AppiumDriverFactory.CreateAppiumDriver();
            }

            else
            {
                Logger.Debug("Creating Web Driver...");
                Driver = new LocalDriverFactory().CreateWebDriver();
                //try
                //{
                //    Driver = new LocalDriverFactory().CreateWebDriver();
                //}
                //catch (WebDriverException)
                //{
                //    CloseWebBrowser();
                //}
            }
        }
Example #3
0
        public void OverrideDriverFuncRespected()
        {
            var driver = AppiumDriverFactory.GetDefaultMobileDriver();

            this.TestObject.OverrideWebDriver(() => driver);

            Assert.AreEqual(driver, this.AppiumDriver);
        }
Example #4
0
        public void SetMobileOptionsWithNullDictionary()
        {
            var options       = AppiumDriverFactory.GetDefaultMobileOptions();
            var beforeOptions = options.ToDictionary();

            // Add null
            options.SetMobileOptions(null);

            // Makes sure we didn't add or remove options
            Assert.AreEqual(beforeOptions.Count, options.ToDictionary().Count);
        }
Example #5
0
        public void SeparateLazyElementInteractions()
        {
            MobileDriverManager newDriver = new MobileDriverManager(() => AppiumDriverFactory.GetDefaultMobileDriver(), this.TestObject);

            newDriver.GetMobileDriver().Navigate().GoToUrl("https://magenicautomation.azurewebsites.net/");
            this.ManagerStore.Add("test", newDriver);

            this.TestObject.AppiumDriver.Navigate().GoToUrl("https://magenicautomation.azurewebsites.net/Automation");

            LazyMobileElement topNew     = new LazyMobileElement(this.TestObject, newDriver.GetMobileDriver(), By.CssSelector("*"));
            LazyMobileElement topDefault = new LazyMobileElement(this.TestObject, By.CssSelector("*"));

            Assert.AreNotEqual(topNew.Text, topDefault.Text);
        }
Example #6
0
        public void GetAndCloseDriverTest()
        {
            AppiumDriver <IWebElement> driver = AppiumDriverFactory.GetDefaultMobileDriver();

            try
            {
                Assert.IsNotNull(driver);
            }
            finally
            {
                driver.Quit();
                driver.Dispose();
            }
        }
Example #7
0
        public void MobileDeviceTest()
        {
            AppiumDriver driver = AppiumDriverFactory.GetDefaultMobileDriver();

            try
            {
                Assert.IsNotNull(driver);
            }
            finally
            {
                driver.Quit();
                driver.Dispose();
            }
        }
Example #8
0
        public void GetWaitDriverTest()
        {
            AppiumDriver <IWebElement> driver = AppiumDriverFactory.GetDefaultMobileDriver();
            WebDriverWait wait = AppiumUtilities.GetDefaultWaitDriver(driver);

            try
            {
                Assert.IsNotNull(wait);
            }
            finally
            {
                driver.Quit();
                driver.Dispose();
            }
        }
Example #9
0
        public void MobileDeviceTest()
        {
            #region MobileDevice
            AppiumDriver <IWebElement> driver = AppiumDriverFactory.GetDefaultMobileDriver();
            #endregion

            try
            {
                Assert.IsNotNull(driver);
            }
            finally
            {
                driver.Quit();
                driver.Dispose();
            }
        }
Example #10
0
        /// <summary>
        /// Sets capabilities for testing the iOS Driver creation
        /// </summary>
        /// <returns>iOS instance of the Appium Driver</returns>
        protected override AppiumDriver GetMobileDevice()
        {
            AppiumOptions options = new AppiumOptions
            {
                DeviceName      = "iPhone 13 Simulator",
                PlatformName    = "iOS",
                PlatformVersion = "15.0",
                BrowserName     = "Safari"
            };

            var sauceOptions = AppiumConfig.GetCapabilitiesAsObjects();

            // Use Appium 1.22 for running iOS tests
            (sauceOptions["sauce:options"] as Dictionary <string, object>)["appiumVersion"] = "1.22.0";
            options.SetMobileOptions(sauceOptions);

            return(AppiumDriverFactory.GetIOSDriver(AppiumConfig.GetMobileHubUrl(), options, AppiumConfig.GetMobileCommandTimeout()));
        }
Example #11
0
        public void OverrideDriverRespected()
        {
            var driver = AppiumDriverFactory.GetDefaultMobileDriver();

            this.TestObject.OverrideAppiumDriver(driver);
        }