public void CreateLocalIOSDriver()
        {
            driverConfig = new LocalDriverConfig
            {
                PlatformName      = MobilePlatform.IOS,
                PlatformVersion   = "10.1",
                BrowserName       = MobileBrowserType.Safari,
                DeviceName        = "device name",
                ServerUrl         = serverUrl,
                NewCommandTimeout = 90001,
                ImplicitWait      = 90002,
                PageLoad          = 90003
            };
            var testSettings = new TestSettingsConfig();

            testSettings.LocalDriver = driverConfig;

            var webTestContext = new WebTestContext(mockDriverFactory.Object, testSettings);

            webTestContext.StartDriver();
            mockDriverFactory.Verify(IDriverFactory => IDriverFactory.Create(It.IsAny <Uri>(), It.IsAny <DriverOptions>(), It.IsAny <TimeSpan>(), It.IsAny <Action <IWebDriver> >()), Times.Once);
            Assert.AreEqual(driverConfig.BrowserName, receivedCapabilities.GetCapability(MobileCapabilityType.BrowserName), "BrowserName is not equal");
            Assert.AreEqual(driverConfig.PlatformVersion, receivedCapabilities.GetCapability(MobileCapabilityType.PlatformVersion), "PlatformVersion is not equal");
            Assert.AreEqual(driverConfig.PlatformName, receivedCapabilities.GetCapability(MobileCapabilityType.PlatformName), "PlatformVersion is not equal");
            Assert.AreEqual(driverConfig.DeviceName, receivedCapabilities.GetCapability(MobileCapabilityType.DeviceName), "DeviceName is not equal");
            Assert.AreEqual(ProviderType.Default, webTestContext.ProviderType);
        }
コード例 #2
0
        public void StartLocalChromeDriver()
        {
            string serverUrl = "http://localhost:4444/wd/hub";

            driverConfig = new LocalDriverConfig
            {
                BrowserName       = MobileBrowserType.Chrome,
                ServerUrl         = serverUrl,
                NewCommandTimeout = 90001,
                ImplicitWait      = 90002,
                PageLoad          = 90003
            };
            var testSettings = new TestSettingsConfig();

            testSettings.LocalDriver = driverConfig;

            webTestContext = new WebTestContext(new DriverFactory(), testSettings);
            webTestContext.StartDriver();
            Assert.IsInstanceOf <RemoteWebDriver>(webTestContext.Driver());
        }
        public void CreateLocalRemoteWebDriver()
        {
            driverConfig = new LocalDriverConfig
            {
                PlatformName      = "",
                BrowserName       = "Chrome",
                ServerUrl         = serverUrl,
                NewCommandTimeout = 90001,
                ImplicitWait      = 90002,
                PageLoad          = 90003
            };
            var testSettings = new TestSettingsConfig();

            testSettings.LocalDriver = driverConfig;

            var webTestContext = new WebTestContext(mockDriverFactory.Object, testSettings);

            webTestContext.StartDriver();
            mockDriverFactory.Verify(IDriverFactory => IDriverFactory.Create(It.IsAny <Uri>(), It.IsAny <DriverOptions>(), It.IsAny <TimeSpan>(), It.IsAny <Action <IWebDriver> >()), Times.Once);
            Assert.AreEqual(ProviderType.Default, webTestContext.ProviderType);
        }
コード例 #4
0
        public void StartLocalAndroidDriver()
        {
            string serverUrl = "http://localhost:4723/wd/hub";

            driverConfig = new LocalDriverConfig
            {
                PlatformName      = MobilePlatform.Android,
                BrowserName       = MobileBrowserType.Chrome,
                DeviceName        = "Android Emulator",
                ServerUrl         = serverUrl,
                NewCommandTimeout = 90001,
                ImplicitWait      = 90002,
                PageLoad          = 90003
            };
            var testSettings = new TestSettingsConfig();

            testSettings.LocalDriver = driverConfig;

            webTestContext = new WebTestContext(new DriverFactory(), testSettings);
            webTestContext.StartDriver();
            Assert.IsInstanceOf <AndroidDriver <IWebElement> >(webTestContext.Driver());
        }