public void Initialize() { //Initialize the Runner for your test. runner = new VisualGridRunner(10); // Initialize the eyes SDK (IMPORTANT: make sure your API key is set in the APPLITOOLS_API_KEY env variable). _eyes = new Eyes(runner); // Initialize eyes Configuration config = new Configuration(); config.SetApiKey("TlTMI102RD5Kl0PGlP1SLRTb6x5Idiomwl5YuF79ibDBs110"); config.SetBatch(new BatchInfo("UFG Hackathon")); // Add browsers with different viewports config.AddBrowser(1200, 700, BrowserType.CHROME); config.AddBrowser(1200, 700, BrowserType.FIREFOX); config.AddBrowser(1200, 700, BrowserType.EDGE_CHROMIUM); config.AddBrowser(768, 700, BrowserType.CHROME); config.AddBrowser(768, 700, BrowserType.FIREFOX); config.AddBrowser(768, 700, BrowserType.EDGE_CHROMIUM); // Add mobile emulation devices in Portrait mode config.AddDeviceEmulation(DeviceName.iPhone_X, ScreenOrientation.Portrait); config.AddDeviceEmulation(DeviceName.Pixel_2, ScreenOrientation.Portrait); // Set the configuration object to eyes _eyes.SetConfiguration(config); }
private static void SetUp(Eyes eyes) { // Initialize the eyes configuration. Configuration config = new Configuration(); // Add this configuration if your tested page includes fixed elements. //config.setStitchMode(StitchMode.CSS); // You can get your api key from the Applitools dashboard //config.SetApiKey("APPLITOOLS_API_KEY"); // set new batch config.SetBatch(new BatchInfo("Demo batch")); // set the configuration to eyes eyes.SetConfiguration(config); }
public static void SetUp(Eyes eyes) { // Initialize eyes Configuration Configuration config = new Configuration(); config.SetApiKey("3xHYsqXjxBhhuNRDcDpQHcaMaUgYU111MBD0fXq5QNxMo110"); config.SetBatch(new BatchInfo("Holiday Shopping")); config.SetViewportSize(1200, 800); config.AddBrowser(1200, 800, BrowserType.CHROME); config.AddBrowser(1200, 800, BrowserType.FIREFOX); config.AddBrowser(1200, 800, BrowserType.EDGE_CHROMIUM); config.AddBrowser(1200, 800, BrowserType.SAFARI); config.AddDeviceEmulation(DeviceName.iPhone_X); eyes.SetConfiguration(config); eyes.ForceFullPageScreenshot = true; eyes.StitchMode = StitchModes.CSS; }
private void SetUp(Eyes eyes) { // Initialize the eyes configuration. Applitools.Selenium.Configuration config = new Applitools.Selenium.Configuration(); // Add this configuration if your tested page includes fixed elements. //config.setStitchMode(StitchMode.CSS); // You can get your api key from the Applitools dashboard //config.ApiKey = "APPLITOOLS_API_KEY"; config.ApiKey = "Mn5kDOQ104eSgP496VDEulT6gpQGWzykAdb9ZbtHMutuc110"; // set new batch config.SetBatch(new BatchInfo("Demo batch")); // set the configuration to eyes eyes.SetConfiguration(config); }
private void SetUp(Eyes eyes, string AppilToolServerUrl, string AppilToolsApiKey, eBrowserType BrowserType, string Environment) { Applitools.Selenium.Configuration config = new Applitools.Selenium.Configuration(); if (WorkSpace.Instance.RunsetExecutor.RunSetConfig != null && WorkSpace.Instance.RunsetExecutor.RunSetConfig.GingerRunners.Any() && ((GingerExecutionEngine)WorkSpace.Instance.RunsetExecutor.RunSetConfig.GingerRunners[0].Executor).ExecutedFrom == eExecutedFrom.Run) { BatchInfo batchInfo = new BatchInfo(WorkSpace.Instance.RunsetExecutor.RunSetConfig.ItemName); batchInfo.Id = WorkSpace.Instance.RunsetExecutor.RunSetConfig.ExecutionID.ToString(); config.SetBatch(batchInfo); } config.SetApiKey(AppilToolsApiKey); config.SetServerUrl(AppilToolServerUrl); OperatingSystem Os_info = System.Environment.OSVersion; config.SetHostOS(Os_info.VersionString); config.SetHostApp(BrowserType.ToString()); eyes.AddProperty("Environment ID", !String.IsNullOrEmpty(Environment) ? Environment : "Default"); eyes.SetConfiguration(config); }
public static void ClassInitializeMethod(TestContext testContext) { _testContext = testContext; suiteConfig = new Configuration(); suiteConfig.SetApiKey("xIWisbt6NECuLEfxj99i7tQD5MTm2fwXlK3X8Xwek578110"); suiteConfig.SetBatch(new BatchInfo(batchName)); // Visual Grid configurations suiteConfig.AddBrowser(1200, 700, BrowserType.CHROME); suiteConfig.AddBrowser(1200, 700, BrowserType.FIREFOX); suiteConfig.AddBrowser(1200, 700, BrowserType.EDGE_CHROMIUM); suiteConfig.AddBrowser(768, 700, BrowserType.CHROME); suiteConfig.AddBrowser(768, 700, BrowserType.FIREFOX); suiteConfig.AddBrowser(768, 700, BrowserType.EDGE_CHROMIUM); suiteConfig.AddDeviceEmulation(DeviceName.iPhone_X, Applitools.VisualGrid.ScreenOrientation.Portrait); string projectPath = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName; string eyesLogFile = Path.Combine(projectPath, "eyesLogFile.txt"); //eyes = new Eyes(runner); //eyes.SetConfiguration(suiteConfig); //eyes.SetLogHandler(new FileLogHandler(eyesLogFile, true, true)); }
public void Initialize() { //Initialize the Runner for your test. runner = new VisualGridRunner(10); // Initialize the eyes SDK _eyes = new Eyes(runner); // Initialize eyes Configuration config = new Configuration(); config.SetApiKey("AS876OwEVY3qDFEAlB4NERfld2wrXCbSDVxewhHgn5E110"); config.SetBatch(new BatchInfo("Holiday Shopping")); config.AddBrowser(1200, 800, BrowserType.CHROME); // Add browsers with different viewports //Uncomment these to run in multiple browsers //config.AddBrowser(1200, 800, BrowserType.FIREFOX); //config.AddBrowser(1200, 800, BrowserType.EDGE_CHROMIUM); //config.AddBrowser(1200, 800, BrowserType.SAFARI); //config.AddDeviceEmulation(DeviceName.iPhone_X); _eyes.SetConfiguration(config); }
public void Initialize() { //Initialize the Runner the test. runner = new VisualGridRunner(10); // Initialize the eyes SDK _eyes = new Eyes(runner); // Initialize eyes Configuration config = new Configuration(); config.SetApiKey("80t00102Dxj9FBzQ7UWU1031n4MRH109Vvc5JoceMwbA79Q110 "); config.SetBatch(new BatchInfo("Holiday Shopping")); config.AddBrowser(1200, 800, BrowserType.CHROME); //Adding configuration for cross-browsers testing //Uncomment the following to run across multiple browsers //config.AddBrowser(1200, 800, BrowserType.FIREFOX); //config.AddBrowser(1200, 800, BrowserType.EDGE_CHROMIUM); //config.AddBrowser(1200, 800, BrowserType.SAFARI); //config.AddDeviceEmulation(DeviceName.iPhone_X); _eyes.SetConfiguration(config); }
public void TestSetup() { driver = new ChromeDriver(); //Original App URL driver.Navigate().GoToUrl(originalAppURL); //New App URL //driver.Navigate().GoToUrl(newAppURL); eyes = new Eyes(runner); Configuration conf = eyes.GetConfiguration(); conf.SetStitchMode(StitchModes.CSS); conf.SetBatch(batchInfo); //conf.SetApiKey("SET_YOUR_API_KEY_HERE"); //conf.setServerUrl("SET_YOUR_DEDICATED_CLOUD_URL"); eyes.SetConfiguration(conf); eyes.SetLogHandler(new StdoutLogHandler(true)); eyes.Open(driver, "VisualTest", TestContext.CurrentContext.Test.Name, new RectangleSize(1000, 600)); }
public void TestMethod2() { String shouldBreakSiteStr = Environment.GetEnvironmentVariable("INJECT_BUG"); bool shouldBreakSite = false; if (shouldBreakSiteStr != null && shouldBreakSiteStr.Length > 0) { shouldBreakSite = bool.Parse(shouldBreakSiteStr); } String testName = "Functional VS Visual"; VisualGridRunner runner = new VisualGridRunner(10); Eyes eyes = new Eyes(runner); ChromeDriver driver = new ChromeDriver(); Configuration sconf = eyes.GetConfiguration(); sconf.SetAppName(testName); sconf.SetTestName(testName); eyes.ApiKey = Environment.GetEnvironmentVariable("APPLITOOLS_API_KEY"); var batchName = Environment.GetEnvironmentVariable("APPLITOOLS_BATCH_NAME"); var batchId = Environment.GetEnvironmentVariable("APPLITOOLS_BATCH_ID"); BatchInfo batchInfo = new Applitools.BatchInfo(batchName); batchInfo.Id = batchId; sconf.SetBatch(batchInfo); sconf.AddBrowser(1200, 800, BrowserType.CHROME); sconf.AddBrowser(1200, 800, BrowserType.FIREFOX); sconf.AddBrowser(1200, 800, BrowserType.SAFARI); sconf.AddBrowser(1200, 800, BrowserType.IE_11); sconf.AddBrowser(1200, 800, BrowserType.EDGE); //sconf.AddDeviceEmulation(DeviceName.iPad, ScreenOrientation.Portrait); //sconf.AddDeviceEmulation(DeviceName.iPad_Pro, ScreenOrientation.Portrait); //sconf.AddDeviceEmulation(DeviceName.iPhone_6_7_8_Plus, ScreenOrientation.Portrait); //sconf.AddDeviceEmulation(DeviceName.iPhone_X, ScreenOrientation.Portrait); //sconf.AddDeviceEmulation(DeviceName.Galaxy_Note_3, ScreenOrientation.Portrait); //sconf.AddDeviceEmulation(DeviceName.Nexus_10, ScreenOrientation.Portrait); eyes.SetLogHandler(new FileLogHandler(@"C:\Users\user\Desktop\appli.log", false, true)); sconf.SetViewportSize(1000, 600); eyes.SetConfiguration(sconf); Console.WriteLine("Open conection to Eyes"); eyes.Open(driver); driver.Url = "https://github.com/login"; Console.WriteLine("Visual Assertion #1"); eyes.Check(Target.Window().Fully().WithName("Login page")); Console.WriteLine("Click Login"); driver.FindElement(By.CssSelector("#login > form > div.auth-form-body.mt-3 > input.btn.btn-primary.btn-block")) .Click(); if (shouldBreakSite) { Console.WriteLine("Breaking Site"); BreakSite(driver); } Console.WriteLine("Begin Functional Assertions"); // validate sign in button String buttonText = driver .FindElement( By.CssSelector("#login > form > div.auth-form-body.mt-3 > input.btn.btn-primary.btn-block")) .GetAttribute("value"); Assert.IsTrue(buttonText.CompareTo("Sign in") == 0, "wrong button"); // validate error message String errorMessage = driver.FindElement(By.CssSelector("#js-flash-container > div > div")).Text; Assert.IsTrue(errorMessage.Contains("Incorrect username or password."), "wrong label"); String usernameTextbox = driver .FindElement(By.CssSelector("#login > form > div.auth-form-body.mt-3 > label:nth-child(1)")).Text; Assert.IsTrue(usernameTextbox.Contains("Username or email address"), "wrong label"); String passwordTextbox = driver .FindElement(By.CssSelector("#login > form > div.auth-form-body.mt-3 > label:nth-child(3)")).Text; Assert.IsTrue(passwordTextbox.Contains("Password"), "wrong label"); Console.WriteLine("Completed Functional Assertions"); Console.WriteLine("Visual Assertion #2"); eyes.Check(Target.Window().Fully().WithName("Error Message")); Console.WriteLine("Close connection to Eyes"); eyes.CloseAsync(); System.Diagnostics.Debug.WriteLine("Waiting for visual test to complete"); TestResultsSummary results = runner.GetAllTestResults(); System.Diagnostics.Debug.WriteLine(results); driver.Quit(); }