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."); } }
private static string GetTestName_(string deviceName, string platformVersion, ScreenOrientation deviceOrientation, string page) { return($"{deviceName} {platformVersion} {deviceOrientation} {page} fully"); }
private static IWebDriver InitEyesSimulation_(string deviceName, string platformVersion, ScreenOrientation deviceOrientation, string testName, string platformName, string browserName) { if (chromeSimulationData_ == null) { lock (lockObject_) { if (chromeSimulationData_ == null) { InitChromeSimulationData_(); } } } ChromeMobileEmulationDeviceSettings mobileSettings = chromeSimulationData_[$"{deviceName};{platformVersion};{deviceOrientation}"]; IWebDriver driver = null; if (mobileSettings != null) { ChromeOptions options = new ChromeOptions(); options.EnableMobileEmulation(mobileSettings); driver = SeleniumUtils.CreateChromeDriver(options); } return(driver); }
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); }
public void TestAndroidStitch(string deviceName, string platformVersion, ScreenOrientation deviceOrientation) { InitEyes_(deviceName, platformVersion, deviceOrientation, "Android", "Chrome", page_); }
public void TestIOSSafariStitch(string deviceName, string platformVersion, ScreenOrientation deviceOrientation) { InitEyes_(deviceName, platformVersion, deviceOrientation, "iOS", "Safari", page_); }