Beispiel #1
0
        private static IWebDriver InitOnSaucelabs(string deviceName, string platformVersion, ScreenOrientation deviceOrientation, string testName, string platformName, string browserName)
        {
            AppiumOptions options = new AppiumOptions();

            options.AddAdditionalCapability(MobileCapabilityType.PlatformName, platformName);
            options.AddAdditionalCapability(MobileCapabilityType.PlatformVersion, platformVersion);
            options.AddAdditionalCapability(MobileCapabilityType.DeviceName, deviceName);
            options.AddAdditionalCapability(MobileCapabilityType.BrowserName, browserName);
            options.AddAdditionalCapability("deviceOrientation", deviceOrientation.ToString().ToLower());

            options.AddAdditionalCapability("username", TestDataProvider.SAUCE_USERNAME);
            options.AddAdditionalCapability("accesskey", TestDataProvider.SAUCE_ACCESS_KEY);

            options.AddAdditionalCapability("name", testName);
            options.AddAdditionalCapability("idleTimeout", 360);

            options.PlatformName = platformName;

            IWebDriver webDriver = SeleniumUtils.RetryCreateWebDriver(() =>
            {
                IWebDriver driver = new RemoteWebDriver(new Uri(TestDataProvider.SAUCE_SELENIUM_URL), options.ToCapabilities(), TimeSpan.FromMinutes(4));
                return(driver);
            });

            return(webDriver);
        }
Beispiel #2
0
        private static void InitEyes_(string deviceName, string platformVersion, ScreenOrientation deviceOrientation, string platformName, string browserName, string page)
        {
            Eyes eyes = new Eyes();

            eyes.Batch        = TestDataProvider.BatchInfo;
            eyes.SaveNewTests = false;
            eyes.StitchMode   = StitchModes.CSS;

            eyes.AddProperty("Orientation", deviceOrientation.ToString());
            eyes.AddProperty("Page", page);

            string testName = GetTestName_(deviceName, platformVersion, deviceOrientation, page);

            TestUtils.SetupLogging(eyes, testName);

            eyes.Logger.Log(testName);
            IWebDriver driver = InitEyesSimulation_(deviceName, platformVersion, deviceOrientation, $"{testName} ({eyes.FullAgentId})", platformName, browserName);

            if (driver != null)
            {
                driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30);
                RunTest_(true, eyes, testName, driver, page);
            }
            else
            {
                eyes.Logger.Log("Error: failed to create webdriver.");
            }
        }