public void Test4_CanvasChartTest() { Eyes eyes = new Eyes(); eyes.ApiKey = Environment.GetEnvironmentVariable("APPLITOOLS_HACKATHON_API_KEY"); BatchInfo batchInfo = new BatchInfo("Canvas Chart Test"); batchInfo.Id = "CanvasChartTest"; eyes.Batch = batchInfo; eyes.Open(driver, appName, "Canvas Chart Test"); landingPage.compareExpensesBtn.Click(); InduceDelay(1); eyes.CheckWindow(); eyes.CloseAsync(); eyes.Open(driver, appName, "Canvas Chart Test - Next Year"); landingPage.showNextYrDataBtn.Click(); InduceDelay(1); eyes.CheckWindow(); eyes.CloseAsync(); eyes.AbortIfNotClosed(); }
public void TestMultipleWindows() { var helpMenu = UIMap.UICalculatorWindow.UIApplicationMenuBar.UIHelpMenuItem; var eyes = new Eyes(); eyes.SetLogHandler(new TraceLogHandler(true)); eyes.BranchName = "demo"; try { eyes.Open(UIMap.UICalculatorWindow, "Calculator", "TestMultipleWindows"); eyes.CheckWindow("Standard"); Mouse.Click(helpMenu); eyes.CheckWindow("Standard + Help"); Mouse.Click(helpMenu.UIAboutCalculatorMenuItem); eyes.CheckWindow("About"); Mouse.Click(UIMap.UIAboutCalculatorWindow.UIOKWindow.UIOKButton); eyes.CheckWindow("Standard"); eyes.Close(); } finally { eyes.AbortIfNotClosed(); } }
public void LostPassword_EnterLoginSubmitItAndTakeForgotPasswordMailPutNewPassword_PasswordSuccessfullyChanged() { // driver.Maximize(); eyes.Open(driver, "Go To Lost Password Form Rest Password And Change Password To New", "Enter To Lost Password Form"); driver.Navigate().GoToUrl("https://wordpress.com/wp-login.php?action=lostpassword"); driver.ClickOnElement(By.CssSelector("#user_login")); driver.FindElement(By.CssSelector("#user_login")).SendKeys("testcommunicate"); eyes.CheckWindow("Filled name of user"); driver.ClickOnElement(By.CssSelector("#wp-submit")); eyes.CheckWindow("Send form with the name of user"); //there you need to put your mailosaur api key var client = new MailosaurClient("SFzsuS7cp5qHbom", "https://mailosaur.com"); //there put search criteria which emails we want to take var criteria = new SearchCriteria { SentTo = "*****@*****.**" }; var message = client.Messages.Get("wr7z7h7k", criteria); var takeUrlFromMessage = Regex.Matches(message.Text.Body, @"(http|ftp|https):\/\/([\w\-_]+(?:(?:\.[\w\-_]+)+))([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?"); var value = takeUrlFromMessage[0].Value; driver.Navigate().GoToUrl(value); driver.ClickOnElement(By.CssSelector("#pass1")); driver.FindElement(By.CssSelector("#pass1")).SendKeys("_new_password_"); driver.ClickOnElement(By.CssSelector("#wp-submit")); driver.WaitForClickable(By.CssSelector(".reset-pass")); var text = driver.FindElement(By.CssSelector(".reset-pass")).Text; Assert.AreEqual("Your password has been reset. Log in", text); }
public void GivenTest() { //Initialize the Runner for your test. runner = new ClassicRunner(); // Initialize the eyes SDK (IMPORTANT: make sure your API key is set in the APPLITOOLS_API_KEY env variable). eyes = new Eyes(runner); // Use Chrome browser driver = new ChromeDriver(); // Start the test by setting AUT's name, window or the page name that's being tested, viewport width and height eyes.Open(driver, "Demo App", "Smoke Test", new Size(800, 600)); // Navigate the browser to the "ACME" demo app. To see visual bugs after the first run, use the commented line below instead. driver.Url = "https://demo.applitools.com/"; //driver.Url = "https://demo.applitools.com/index_v2.html"; // Visual checkpoint #1 - Check the login page. eyes.CheckWindow("Login Page"); // This will create a test with two test steps. driver.FindElement(By.Id("log-in")).Click(); // Visual checkpoint #2 - Check the app page. eyes.CheckWindow("App Window"); // End the test. eyes.CloseAsync(); }
public static void IosTest() { //iOS Test Eyes eyes = new Eyes(); eyes.ApiKey = Environment.GetEnvironmentVariable("APPLITOOLS_API_KEY"); DesiredCapabilities dc = new DesiredCapabilities(); dc.SetCapability("platformName", "iOS"); dc.SetCapability("browserName", "Safari"); dc.SetCapability("deviceName", "iPhone XR"); dc.SetCapability("automationName", "XCUITest"); dc.SetCapability("platformVersion", "12.1"); RemoteWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4723/wd/hub"), dc); //Error in tutorial on this line, should be below driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(60); try { eyes.Open(driver, "Hello World!", "C# Appium Web"); driver.Url = "https://applitools.com/helloworld"; eyes.CheckWindow("Hello!"); driver.FindElement(By.TagName("button")).Click(); eyes.CheckWindow("Click!"); eyes.Close(); } finally { eyes.AbortIfNotClosed(); driver.Quit(); } }
public void BeatsByDre_HoverElement(bool bCheckHover) { string testName = "Hover Element (viewport)"; if (bCheckHover == true) { testName += " - On"; } else { testName += " - Off"; } Eyes eyes = new Eyes(); IWebDriver driver = SeleniumUtils.CreateChromeDriver(); string logPath = TestUtils.InitLogPath(); eyes.DebugScreenshotProvider = new FileDebugScreenshotProvider() { Path = logPath }; try { IWebDriver eyesDriver = eyes.Open(driver, testName, testName, new Size(1200, 600)); driver.Url = "https://www.beatsbydre.com/support/headphones/studio3-wireless"; ((ChromeDriver)driver).ExecuteScript("window.scrollBy(0,400)"); By selector = By.CssSelector( "#maincontent > div:nth-child(1) > div.supportContent.parbase.section > div > div > div.selector.topics > div.boxes > a:nth-child(1) > div > div.content"); eyes.CheckWindow("Window", false); //eyes.StitchMode = StitchModes.CSS; // Hover effect if (bCheckHover) { IWebElement we = eyesDriver.FindElement(selector); Actions action = new Actions(eyesDriver); action.MoveToElement(we).Perform(); } // End eyes.CheckWindow("Window 2", false); eyes.Check("Region", Target.Region(selector)); eyes.Close(); } finally { eyes.Abort(); driver.Quit(); } }
public void TestClicksAndText() { WinControl newItemDropDownButton = UIMap.UIExplorerTestsWindow .UIItemWindow1.UINewToolBar.UINewitemDropDownButton; WinMenuItem textDocumentMenuItem = UIMap.UIExplorerTestsWindow .UIItemWindow1.UINewitemClient.UIItemGroup.UITextDocumentMenuItem; WinMenuItem folderMenuItem = UIMap.UIExplorerTestsWindow.UIItemWindow1 .UINewitemClient1.UIItemGroup.UIFolderMenuItem; WinEdit fileEdit = UIMap.UIExplorerTestsWindow.UIItemWindow.UIItemEdit; WinEdit folderEdit = UIMap.UIExplorerTestsWindow.UIItemWindow2.UIItemEdit; WinEdit folder = UIMap.UIExplorerTestsWindow.UIItemWindow3 .UIWorldListItem.UINameEdit; var eyes = new Eyes(); eyes.SetLogHandler(new StdoutLogHandler(true)); eyes.BranchName = "demo"; eyes.Open(UIMap.UIExplorerTestsWindow, "Explorer", "TestClicksAndText", new Size(1000, 700)); try { eyes.CheckWindow("Empty folder"); Mouse.Click(newItemDropDownButton, new Point(60, 15)); eyes.CheckWindow("New Item"); Mouse.Click(textDocumentMenuItem); eyes.CheckWindow("New Text File"); fileEdit.Text = "Hello.txt"; Keyboard.SendKeys(fileEdit, "{Enter}", ModifierKeys.None); eyes.CheckWindow("File name set"); Mouse.Click(newItemDropDownButton, new Point(60, 15)); eyes.CheckWindow("New Item"); Mouse.Click(folderMenuItem); Mouse.Move(folderEdit, Point.Empty); eyes.CheckWindow("New Folder"); folderEdit.Text = "World"; Keyboard.SendKeys(folderEdit, "{Enter}", ModifierKeys.None); eyes.CheckWindow("Folder name set"); Mouse.Move(folder, new Point(47, 15)); eyes.CheckWindow("Folder tool-tip"); Mouse.Click(folder, MouseButtons.Right, ModifierKeys.None, new Point(47, 15)); eyes.CheckWindow("Folder context menu"); Mouse.DoubleClick(folder, new Point(47, 15)); eyes.CheckWindow("Empty World folder"); eyes.Close(); } finally { eyes.AbortIfNotClosed(); } }
public static void Main(string[] args) { // This is your api key, make sure you use it in all your tests. Eyes eyes = new Eyes(); // Set the desired capabilities. AppiumOptions dc = new AppiumOptions(); dc.AddAdditionalCapability(MobileCapabilityType.PlatformName, "Android"); dc.AddAdditionalCapability(MobileCapabilityType.PlatformVersion, "6.0.1"); dc.AddAdditionalCapability(MobileCapabilityType.DeviceName, "LGE Nexus 5"); dc.AddAdditionalCapability(MobileCapabilityType.BrowserName, "Chrome"); //dc.AddAdditionalCapability("chromedriverExecutable", @"C:\Users\USER\devel\Eyes.Sdk.DotNet\bin\deps\WebDriver\chromedriver.exe"); RemoteWebDriver driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4723/wd/hub"), dc); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(120); try { // Start visual testing. eyes.Open(driver, "Hello World!", "My first Appium C# test!"); // Navigate the browser to the "hello world!" web-site. driver.Url = "https://applitools.com/helloworld"; Console.WriteLine("11111111111111111111111"); // Visual checkpoint #1. eyes.CheckWindow("Hello!"); Console.WriteLine("22222222222222222222222"); // Click the "Click me!" button. driver.FindElement(By.TagName("button")).Click(); Console.WriteLine("333333333333333333333333333"); // Visual checkpoint #2. eyes.CheckWindow("Click!"); // End the test. eyes.Close(); } catch (Exception ex) { Console.WriteLine(ex); } finally { // Close the browser. driver.Quit(); // If the test was aborted before eyes.Close was called, ends the test as aborted. eyes.AbortIfNotClosed(); } }
public static TestResults CheckWebsite(RemoteWebDriver driver, Eyes eyes) { driver = eyes.Open(driver, ".NET SDK", "Mobile Chrome"); driver.Navigate().GoToUrl("https://applitools.com"); eyes.CheckWindow("Home"); driver.FindElement(By.ClassName("automated")).Click(); eyes.CheckWindow("Pricing"); return(eyes.Close(false)); }
public static void Main(string[] args) { // Init the LeanFT SDK SDK.Init(new SdkConfiguration()); // Open a Chrome browser IBrowser testBrowser = BrowserFactory.Launch(BrowserType.Chrome); // Initialize the eyes SDK and set your private API key. var eyes = new Eyes(); eyes.ServerUrl = "https://localhost.applitools.com"; try { // Start the test and set the browser's viewport size to 800x600 eyes.Open(testBrowser, "Hello World!", "My first LeanFT C# test", new Size(800, 600)); // Navigate the browser to the "hello world!" web-site. testBrowser.Navigate("https://www.applitools.com/helloworld"); // Visual checkpoint #1 eyes.CheckWindow("Hello!"); // Click the "Click me!" button IWebElement button = testBrowser.FindChildren <IWebElement>(new WebElementDescription { TagName = "button" })[0]; button.Click(); // Visual checkpoint #2 eyes.CheckWindow("Click!"); // End the test eyes.Close(); } catch (Exception ex) { Console.WriteLine(ex); } finally { // Close the browser. testBrowser.Close(); // If the test was aborted before eyes.Close was called, ends the test as aborted. eyes.AbortIfNotClosed(); // Close the LeanFT SDK SDK.Cleanup(); } }
public void Verify_Login_Page() { //Start the test by setting AUT's name, window or the page name that's being tested, viewport width and height _eyes.Open(_driver, "Hackathan App", "Login Page Verification", new RectangleSize(1366, 728)); //Navigate the browser to the "ACME" demo app. To see visual bugs after the first run, use the commented line below instead. //_driver.Url = CommonMethods.Config["url"]; //Url navigation for V2 app. _driver.Url = CommonMethods.Config["urlV2"]; //Visual checkpoint #1 - Check the login page. _eyes.CheckWindow("Login Page"); //End the test. _eyes.CloseAsync(); }
public void LoginPage1() { // Start the test by setting AUT's name, window or the page name that's being tested, viewport width and height eyes.Open(driver, "Acme app", "Login Page", new Size(1200, 700)); // Navigate the browser to the "ACME" demo app driver.Url = "https://demo.applitools.com/index.html"; // Visual checkpoint #1. eyes.CheckWindow("Login Page"); // End the test. eyes.CloseAsync(); }
/* * DOES NOT WORK, NEED TO INTEGRATE WITH SAUCE LABS */ public static void AndroidTest() { Eyes eyes = new Eyes(); eyes.ApiKey = Environment.GetEnvironmentVariable("APPLITOOLS_API_KEY"); DesiredCapabilities dc = new DesiredCapabilities(); dc.SetCapability("platformName", "Android"); dc.SetCapability("automationName", "UiAutomator2"); dc.SetCapability("app", "/Users/mattjasaitis/Downloads/test-apps/app-debug.apk"); dc.SetCapability("deviceName", "Pix3"); dc.SetCapability("platformVersion", "10"); RemoteWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4723/wd/hub"), dc); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(60); try { eyes.Open(driver, "Android test app", "Native"); eyes.CheckWindow("test"); eyes.Close(); } finally { eyes.AbortIfNotClosed(); driver.Quit(); } }
public void SetBaselineUsingViewportSize() { GoToPricingPage(); //all the parameters are the same, except we provided a new viewport size Eyes.Open(Driver, AppName, TestCaseName, Resolution720P); Eyes.CheckWindow(); }
public void SetBaselineUsingTestName() { GoToPricingPage(); //all the parameters are the same, except we provided a new test name Eyes.Open(Driver, AppName, "new test name", Resolution1080P); Eyes.CheckWindow(); }
public void IOSSimulatorUfgTest() { ILogHandler logHandler = TestUtils.InitLogHandler(); VisualGridRunner runner = new VisualGridRunner(10, logHandler); Eyes eyes = new Eyes(runner); IWebDriver driver = SeleniumUtils.CreateChromeDriver(); try { IConfiguration config = eyes.GetConfiguration(); config.SaveDiffs = false; config.Batch = TestDataProvider.BatchInfo; config.AddBrowser(new IosDeviceInfo(IosDeviceName.iPhone_XR, ScreenOrientation.Landscape)); eyes.SetConfiguration(config); driver.Url = "http://applitools.github.io/demo"; eyes.Open(driver, "Eyes SDK", "UFG Mobile Happy Flow", new Size(800, 600)); eyes.CheckWindow(); eyes.Close(); } finally { eyes.AbortIfNotClosed(); driver.Quit(); runner.GetAllTestResults(); } }
static void Main(string[] args) { var driver = new ChromeDriver(); var eyes = new Eyes(); eyes.ForceFullPageScreenshot = true; eyes.ApiKey = Environment.GetEnvironmentVariable("APPLITOOLS_API_KEY"); try { //Dictionary<string, string> testinfo = getTestInfoForPart(args); eyes.Open(driver, "C# Demo", "Login Window", new Size(600, 800)); driver.Url = "https://demo.applitools.com"; eyes.CheckWindow("Login window test"); eyes.Close(); } catch (Exception ex) { Console.WriteLine(ex); } finally { driver.Quit(); eyes.AbortIfNotClosed(); } }
public void Addition() { session.Manage().Window.Size = new Size(700, 700); //for responsive design testing... Eyes eyes = new Eyes(); eyes.ApiKey = "your_applitools_key"; try { eyes.Open(session, "Windows Calculator", "C# Test"); } catch (Exception ex) { Console.WriteLine("ahhhhhhh"); throw new ApplicationException("Exception: ", ex); } // Find the buttons by their names and click them in sequence to peform 1 + 7 = 8 session.FindElementByName("One").Click(); session.FindElementByName("Plus").Click(); session.FindElementByName("Seven").Click(); session.FindElementByName("Equals").Click(); eyes.CheckWindow("Equals 8"); eyes.Close(); Assert.AreEqual("8", GetCalculatorResultText()); }
public void Test2_DataDrivenTest(string username, string password, bool error, string errorText = null) { Eyes.Open(webDriver, AppName, TestContext.CurrentContext.Test.Name); webDriver.Navigate().GoToUrl("https://demo.applitools.com/hackathonV2.html"); LoginPage loginPage = new LoginPage(webDriver); loginPage.PerformLogin(username, password); if (error) { Eyes.CheckWindow("Login page UI check."); Assert.Multiple(() => { Assert.That(webDriver.IsElementDisplayed(loginPage.LoginError), Is.True, "A login error should be present."); Assert.That(webDriver.FindElement(loginPage.LoginError).Text, Is.EqualTo(errorText)); }); } else { Eyes.CheckWindow("Main page UI check."); MainPage mainPage = new MainPage(webDriver); Assert.That(mainPage.OnPage(), Is.True, "You should be taken to the main page."); } }
public void AndroidTest() { // Initialize the eyes SDK (IMPORTANT: make sure your API key is set in the APPLITOOLS_API_KEY env variable). eyes = new Eyes(); // Set the desired capabilities. AppiumOptions options = new AppiumOptions(); options.AddAdditionalCapability(MobileCapabilityType.DeviceName, "Samsung Galaxy S10"); options.AddAdditionalCapability(MobileCapabilityType.PlatformVersion, "9.0"); options.AddAdditionalCapability(MobileCapabilityType.PlatformName, "Android"); options.AddAdditionalCapability(MobileCapabilityType.BrowserName, "Chrome"); options.AddAdditionalCapability("deviceOrientation", "portrait"); // Initialize BrowserStack credentials. (IMPORTANT: make sure you have the below environment variables set). Dictionary <string, object> browserstackOptions = new Dictionary <string, object>(); browserstackOptions.Add("userName", Environment.GetEnvironmentVariable("BROWSERSTACK_USERNAME")); browserstackOptions.Add("accessKey", Environment.GetEnvironmentVariable("BROWSERSTACK_ACCESS_KEY")); options.AddAdditionalCapability("bstack:options", browserstackOptions); driver = new RemoteWebDriver(new Uri("http://hub-cloud.browserstack.com/wd/hub/"), options); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(60); driver.Url = $"https://applitools.com/helloworld"; // Start visual UI testing. eyes.Open(driver, "Hello, Applitools!", "My first Appium Web C# test!"); // Visual UI testing. eyes.CheckWindow("Hello, World!"); // End the test. eyes.Close(); }
public static void Main(string[] args) { var eyes = new Eyes(new Uri("https://testeyesapi.applitools.com")); // Note 1 eyes.ApiKey = Environment.GetEnvironmentVariable("APPLITOOLS_TESTAPI_KEY"); // Note 2 eyes.ApiKey = "qYQ6SVJh105wOsguQnXFzkuRHEndcUnYsIKvLqUxEVTho110"; var innerDriver = new ChromeDriver(); // Note 3 var viewportSize = new Size(1024, 768); var driver = eyes.Open(innerDriver, "Demos", "Domain Diff 16", viewportSize); // Note 4 eyes.SendDom = true; try { /*string website = "https://applitools.com/helloworld";*/ string diff = "?diff3"; string website = "C:/Users/User/Documents/eyes-knowledgebase-source/FlareProjects/Content/example-code/HelloWorldDomDiffs/helloworlddomdiffs.html"; website += diff; driver.Url = website; // Note 5 eyes.CheckWindow("initial screen"); // Note 6 Applitools.TestResults result = eyes.Close(false); // Note 7 } catch (Exception ex) { var i = 1; } finally { // If the test was aborted before eyes.Close was called, ends the test as aborted. eyes.AbortIfNotClosed(); // Note 8 } innerDriver.Quit(); // Note 9 }
public void ProductDetailsTest() { Eyes eyes = new Eyes(runner); eyes.SetConfiguration(suiteConfig); eyes.Open(webDriver, "Product Details test", "Task 3", new System.Drawing.Size(800, 600)); //Click on the filter menu webDriver.FindElement(By.XPath(HomePage.filtersAnchorInTabletMode)).Click(); InduceDelay(2); //Click the Black check box in filter panel webDriver.FindElement(By.XPath(HomePage.blackColorCheckBoxInTableMode)).Click(); InduceDelay(2); //Click on Filter button webDriver.FindElement(By.XPath(HomePage.filterButton)).Click(); InduceDelay(2); //Click on the first shoe image webDriver.FindElement(By.XPath(PLPage.appliAirNightShoeAnchorTagV2Locator)).Click(); InduceDelay(2); eyes.CheckWindow(); eyes.Close(); eyes.AbortIfNotClosed(); }
public static void IosTest() { Eyes eyes = new Eyes(); eyes.ApiKey = Environment.GetEnvironmentVariable("APPLITOOLS_API_KEY"); DesiredCapabilities dc = new DesiredCapabilities(); dc.SetCapability("platformName", "iOS"); dc.SetCapability("automationName", "XCUITest"); dc.SetCapability("app", "/Users/mattjasaitis/Downloads/test-apps/Applitools XCUI Demo.zip"); dc.SetCapability("deviceName", "iPhone XR"); dc.SetCapability("platformVersion", "12.1"); //Either of the drivers below work, so this is not an issue //IOSDriver<IWebElement> driver = new IOSDriver<IWebElement>(new Uri("http://localhost:4723/wd/hub"), dc); RemoteWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4723/wd/hub"), dc); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(60); try { eyes.Open(driver, "iOS test application", "test"); // Visual validation point #1 eyes.CheckWindow("Initial view"); // End visual UI testing. Validate visual correctness. eyes.Close(); } finally { eyes.AbortIfNotClosed(); driver.Quit(); } }
public void TestGithub() { var eyes = new Eyes(new Uri("https://demo.applitools.com")); Applitools.Tests.Utils.TestUtils.SetupLogging(eyes); eyes.ForceFullPageScreenshot = true; eyes.StitchMode = StitchModes.CSS; eyes.HideScrollbars = true; eyes.BaselineEnvName = "Desktop Web - LeanFT"; eyes.MatchLevel = MatchLevel.Layout; IBrowser testBrowser = BrowserFactory.Launch(HP.LFT.SDK.Web.BrowserType.Chrome); try { eyes.Open(testBrowser, "Github", "Github envs", new System.Drawing.Size(800, 600)); testBrowser.Navigate("https://www.github.com"); eyes.CheckWindow("Search"); eyes.Close(); } finally { eyes.AbortIfNotClosed(); testBrowser.Close(); } }
public void FullPageScreenshot() { Eyes.ForceFullPageScreenshot = true; GoToPricingPage(); Eyes.Open(Driver, AppName, TestCaseName, Resolution1080P); Eyes.CheckWindow("FullPageScreenshot"); }
public static void Main(string[] args) { var eyes = new Eyes(); // Note 1 eyes.ApiKey = Environment.GetEnvironmentVariable("MY_APPLITOOLS_API_KEY"); // Note 2 var innerDriver = new ChromeDriver(); // Note 3 var viewportSize = new Size(1024, 768); var driver = eyes.Open(innerDriver, "My Application Name", "My Test Name", viewportSize); // Note 4 try { string website = "https://applitools.com/helloworld"; driver.Url = website; // Note 5 eyes.CheckWindow("initial screen"); // Note 6 Applitools.TestResults result = eyes.Close(false); // Note 7 } catch (Exception ex) { } finally { // If the test was aborted before eyes.Close was called, ends the test as aborted. eyes.AbortIfNotClosed(); // Note 8 } innerDriver.Quit(); // Note 9 }
public void TestBaseline() { GoToPricingPage(); UpdateElements(); Eyes.Open(Driver, AppName, TestCaseName, ResolutionCustom1366); Eyes.CheckWindow(); }
public void Attentia() { // Open a Chrome browser. var driver = new ChromeDriver(); // Initialize the eyes SDK and set your private API key. var eyes = new Eyes(); eyes.SendDom = false; eyes.SetLogHandler(TestUtils.InitLogHandler()); //Navigate to the URL driver.Url = "https://uat-dots.attentia.be"; try { //Start the test var eyesDriver = eyes.Open(driver, "Attentia", "#29053", new Size(1200, 800)); WebDriverWait wait = new WebDriverWait(eyesDriver, TimeSpan.FromSeconds(30)); IWebElement userName = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#userNameInput"))); eyes.CheckWindow("step 1", true); userName.SendKeys("*****@*****.**"); eyes.CheckWindow("step 2", true); wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#passwordInput"))).SendKeys("Azerty_03"); eyes.CheckWindow("step 3", true); wait.Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("#submitButton"))).Click(); eyes.CheckWindow("step 4", true); //eyes.Check(Target.Frame("appFrame").Fully()); //Close the test eyes.Close(); } catch (Exception e) { eyes.Logger.Log("Error: " + e); } finally { // Close the browser. driver.Quit(); // If the test was aborted before eyes.Close was called, ends the test as aborted. eyes.Abort(); } }
public void VisualTestsSample( //[Values(Browser.Chrome, Browser.Firefox)] Browser browser, [Values(Browser.Chrome)] Browser browser) //[Values()] KeyValuePair<int, int> resolution) //[ValueSource("Resolutions")] KeyValuePair<int, int> resolution) { // This is your api key, make sure you use it in all your tests. var eyes = new Eyes { ApiKey = "6Lv5UFTHTXMCYambSxjAyD0UWzKK110YKR2Sjv103c105zuSs110" }; var session = StartUpSession(browser, "50.0", Platform.Windows, "7", TestSuiteSettings.ApplicationUnderTestSettings.Url); var driver = session.DriverSession.Driver; //var x = new KeyValuePair<int, int>[] { new KeyValuePair<int, int>(441, 326), new KeyValuePair<int, int>(800, 600) }; try { // Start visual testing with browser viewport set to 1024x768. // Make sure to use the returned driver from this point on. driver = eyes.Open(driver, "Beamly Agency Production Site", "Home page", new Size(414, 706)); eyes.MatchLevel = MatchLevel.Layout2; driver.Navigate().GoToUrl("http://www.beamly.com"); // Visual validation point #1 eyes.CheckWindow("Beamly home page"); ////driver.FindElement(By.CssSelector(".features>a")).Click(); //var associateHome = AssociateLogin.PerformAssociateLogin(RunSession, TestSettings.UserName, // TestSettings.Password); //// Visual validation point #2 //eyes.CheckWindow("Associate Home page soon after login"); //associateHome.EnterIidOrCompanyName("submission cpa") // .SelectSearchOption(SearchOption.CompanyName) // .ClickFilterList(); //// Visual validation point #3 //eyes.CheckWindow("Associate Home page after searching for 'submission cpa' company"); //var clientList = associateHome.ClickResult<IClientList>(SearchOption.Iid, "20063215"); //// Visual validation point #4 //eyes.CheckWindow("Client List page for CPA IID = 20063215"); // End visual testing. Validate visual correctness. eyes.Close(); } catch (Exception e) { Console.Write(e); throw; } finally { eyes.AbortIfNotClosed(); session.Quit(); } }
public void MonitizationTest() { var homePage = LoginPage.NavigateToPage(But, true).Login("jgomez", "password"); //If our goal is to validate only the existence of two Gif Ads the above validation is recommended //Adding Visual checks though allow us to confirm there are no unintended consequences in other portions of the UI when enabling Ads Eyes.CheckWindow("Homepage with Ads"); }