Exemple #1
0
        public void TestConfiguration()
        {
            ChromeOptions options = new ChromeOptions();

            options.AddArgument("--headless");
            IWebDriver driver = new ChromeDriver(options);
            Eyes       eyes   = new Eyes();

            try
            {
                Configuration conf = new Configuration();
                conf.SetServerUrl("https://testeyes.applitools.com").SetApiKey("HSNghRv9zMtkhcmwj99injSggnd2a8zUY390OiyNRWoQ110");
                eyes.Open(driver, "test configuration", "test server url 1", new Size(800, 600));
                TestResults results1 = eyes.Close();
                eyes.SetConfiguration(conf);
                eyes.Open(driver, "test configuration", "test server url 2", new Size(800, 600));
                TestResults results2 = eyes.Close();

                StringAssert.DoesNotStartWith("https://testeyesapi.applitools.com", results1.ApiUrls.Session);
                StringAssert.StartsWith("https://testeyesapi.applitools.com", results2.ApiUrls.Session);
            }
            finally
            {
                driver.Quit();
            }
        }
        public void BrowserSizeTest()
        {
            IWebDriver webDriver = SeleniumUtils.CreateChromeDriver();
            //webDriver.Url = "https://applitools.github.io/demo/TestPages/DynamicResolution/mobile.html";
            Eyes eyes = new Eyes(new MockServerConnectorFactory());

            eyes.SendDom = false;
            TestUtils.SetupLogging(eyes);
            eyes.Batch = TestDataProvider.BatchInfo;
            try
            {
                eyes.Open(webDriver, "Browser Size Test", "Browser Size Test", new Size(640, 480));
                //eyes.Check("Test 1", Target.Window());
                TestResults results1 = eyes.Close(false);

                eyes.Open(webDriver, "Browser Size Test", "Browser Size Test", new Size(800, 600));
                //eyes.Check("Test 2", Target.Window());
                TestResults results2 = eyes.Close(false);

                eyes.Open(webDriver, "Browser Size Test", "Browser Size Test", new Size(1024, 768));
                //eyes.Check("Test 3", Target.Window());
                TestResults results3 = eyes.Close(false);
            }
            finally
            {
                webDriver.Quit();
            }

            try
            {
                ChromeOptions options = new ChromeOptions();
                options.EnableMobileEmulation("iPhone 5/SE");
                webDriver = SeleniumUtils.CreateChromeDriver(options);
                //webDriver.Url = "https://applitools.github.io/demo/TestPages/DynamicResolution/mobile.html";

                eyes.Open(webDriver, "Browser Size Test", "Browser Size Test");
                //eyes.Check("Test 4", Target.Window());
                TestResults results4 = eyes.Close(false);
            }
            finally
            {
                webDriver.Quit();
            }

            try
            {
                MockServerConnector server = (MockServerConnector)eyes.seleniumEyes_.ServerConnector;
                Assert.AreEqual(4, server.SessionIds.Count);
                Assert.AreEqual(new Size(640, 480), server.SessionsStartInfo[server.SessionIds[0]].Environment.DisplaySize.ToSize());
                Assert.AreEqual(new Size(800, 600), server.SessionsStartInfo[server.SessionIds[1]].Environment.DisplaySize.ToSize());
                Assert.AreEqual(new Size(1024, 768), server.SessionsStartInfo[server.SessionIds[2]].Environment.DisplaySize.ToSize());
                Assert.AreEqual(new Size(320, 568), server.SessionsStartInfo[server.SessionIds[3]].Environment.DisplaySize.ToSize());
            }
            finally
            {
                eyes.AbortIfNotClosed();
            }
        }
        public void TestHome()
        {
            //FirefoxOptions options = new FirefoxOptions();
            //if (TestSetup.RUN_HEADLESS)
            //{
            //    options.AddArgument("--headless");
            //}
            //IWebDriver webdriver = new FirefoxDriver(options);

            ChromeOptions options = new ChromeOptions();

            if (SeleniumUtils.RUN_HEADLESS)
            {
                options.AddArgument("headless");
            }
            IWebDriver webdriver = new ChromeDriver(options);

            var eyes = new Eyes();

            eyes.BranchName = "demo";
            eyes.StitchMode = StitchModes.CSS;
            SetupLogging(eyes, nameof(TestHome));
            try
            {
                IWebDriver driver = eyes.Open(webdriver, "www.applitools.com", "Home", new Size(1006, 677));

                driver.Url = "https://www.applitools.com";
                //eyes.Check("Home (window)", Target.Window().ScrollRootElement(By.CssSelector("div.horizontal-page")).Fully());
                eyes.Check("Home (region)", Target.Region(By.CssSelector("div.page")).Fully());
                //eyes.Check("Home", Target.Window().ScrollRootElement(By.CssSelector("div.page")).Fully());

                eyes.Close();

                driver.FindElement(By.LinkText("Features")).Click();
                eyes.Check("Features", Target.Window().ScrollRootElement(By.CssSelector("div.page")).Fully().Timeout(TimeSpan.FromSeconds(5)));

                CollectionAssert.AreEqual(
                    new[] { "Features", "CUSTOMERS" },
                    eyes.InRegion(By.TagName("h1")).And(By.LinkText("Customers")).GetText());

                driver.FindElement(By.LinkText("Free Trial")).Click();
                eyes.Check("Sign Up", Target.Window().Fully());

                eyes.Close();
                /**/
            }
            finally
            {
                eyes.Abort();
                webdriver.Quit();
            }
        }
Exemple #4
0
        public void TestFailure()
        {
            VisualGridRunner visualGridRunner = new VisualGridRunner(10);

            visualGridRunner.SetLogHandler(TestUtils.InitLogHandler());

            Size[] ViewportList =
            {
                new Size(800,  600),
                new Size(700,  500),
                new Size(1200, 800),
                new Size(1600, 1200)
            };

            IWebDriver webDriver = SeleniumUtils.CreateChromeDriver();

            webDriver.Url = "https://applitools.com/helloworld";
            Eyes eyes = null;

            try
            {
                int resultsTotal = 0;
                foreach (Size viewport in ViewportList)
                {
                    eyes = InitEyes_(null, webDriver, viewport);
                    eyes.Check(Target.Window().Fully());
                    eyes.Close();

                    eyes = InitEyes_(visualGridRunner, webDriver, viewport);
                    eyes.Check(Target.Window().Fully());
                    eyes.Close();
                    TestResultsSummary results = visualGridRunner.GetAllTestResults();
                    resultsTotal += results.Count;
                }
                Assert.AreEqual(4, resultsTotal);
            }
            catch (InvalidOperationException e)
            {
                if (e.Message.Equals("Eyes not open"))
                {
                    Assert.Pass();
                }
            }
            finally
            {
                webDriver?.Quit();
                eyes?.Abort();
            }
        }
        public void TestDoubleOpenCheckCloseWithDifferentInstances(bool useVisualGrid)
        {
            IWebDriver driver = SeleniumUtils.CreateChromeDriver();

            driver.Url = "https://applitools.github.io/demo/TestPages/VisualGridTestPage/";

            EyesRunner runner = useVisualGrid ? (EyesRunner) new VisualGridRunner(10) : new ClassicRunner();

            runner.SetLogHandler(TestUtils.InitLogHandler());

            string suffix = useVisualGrid ? "_VG" : "";

            try
            {
                Eyes eyes1 = new Eyes(runner);
                eyes1.Batch = TestDataProvider.BatchInfo;
                eyes1.Open(driver, "Applitools Eyes SDK", nameof(TestDoubleOpenCheckCloseWithDifferentInstances) + suffix, new RectangleSize(1200, 800));
                eyes1.Check(Target.Window().Fully().IgnoreDisplacements(false).WithName("Step 1"));
                eyes1.Close(false);

                Eyes eyes2 = new Eyes(runner);
                eyes2.Batch = TestDataProvider.BatchInfo;
                eyes2.Open(driver, "Applitools Eyes SDK", nameof(TestDoubleOpenCheckCloseWithDifferentInstances) + suffix, new RectangleSize(1200, 800));
                eyes2.Check(Target.Window().Fully().IgnoreDisplacements(false).WithName("Step 2"));
                eyes2.Close(false);
            }
            finally
            {
                driver.Quit();
            }
            TestResultsSummary allTestResults = runner.GetAllTestResults(false);

            Assert.AreEqual(2, allTestResults.Count);
        }
Exemple #6
0
        public void Test_VG_RCA_Fluent()
        {
            EyesRunner runner = new VisualGridRunner(10);
            Eyes       eyes   = new Eyes(runner);

            eyes.Batch = batch_;
            IWebDriver driver = SeleniumUtils.CreateChromeDriver();

            try
            {
                driver.Url = "https://applitools.github.io/demo/TestPages/VisualGridTestPage";

                driver.SwitchTo().Frame("iframe");
                WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
                wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#p2")));
                driver.SwitchTo().DefaultContent();

                eyes.Open(driver, "Test Visual Grid", "Test RCA Fluent");
                eyes.SendDom = false;
                eyes.Check(Target.Window().SendDom(true));
                eyes.Close();
                runner.GetAllTestResults();
            }
            finally
            {
                driver.Quit();
            }
        }
        public void TestIsDisabled()
        {
            IWebDriver driver = SeleniumUtils.CreateChromeDriver();
            Eyes       eyes   = new Eyes();

            eyes.Batch = TestDataProvider.BatchInfo;
            TestUtils.SetupLogging(eyes);
            eyes.IsDisabled = true;
            try
            {
                eyes.Open(driver, "Demo C# app", "hello world", new Size(800, 600));

                driver.Url = "https://applitools.com/helloworld?diff1";
                eyes.Check(Target.Window().Fully());
                eyes.Check("Number test", Target.Region(By.ClassName("random-number")));
                eyes.Check(Target.Window().WithName("1"), Target.Region(By.Id("SomeId")).WithName("2"));
                eyes.CheckFrame(new string[] { "a", "b" }, TimeSpan.FromSeconds(1));

                eyes.Close();
            }
            finally
            {
                driver.Quit();
                eyes.AbortIfNotClosed();
            }
        }
        public void Teardown()
        {
            TestResults results = eyes_.Close(false);

            eyes_.Log("Mismatches: " + results.Mismatches);
            driver_.Quit();
        }
Exemple #9
0
        public void TestDoubleCheckDontGetAllResults(bool useVisualGrid)
        {
            IWebDriver driver = SeleniumUtils.CreateChromeDriver();

            driver.Url = "https://applitools.com/helloworld";

            string      suffix     = useVisualGrid ? "_VG" : "";
            ILogHandler logHandler = TestUtils.InitLogHandler(nameof(TestDoubleCheckDontGetAllResults) + suffix);
            EyesRunner  runner     = useVisualGrid ? (EyesRunner) new VisualGridRunner(10, logHandler) : new ClassicRunner(logHandler);

            try
            {
                Eyes eyes = new Eyes(runner);
                eyes.Batch = TestDataProvider.BatchInfo;
                eyes.Open(driver, "Applitools Eyes SDK", nameof(TestDoubleCheckDontGetAllResults) + suffix, new RectangleSize(1200, 800));
                eyes.Check(Target.Window().WithName("Step 1"));
                eyes.Check(Target.Window().WithName("Step 2"));
                eyes.Close(false);
            }
            finally
            {
                driver.Quit();
            }
            Assert.IsFalse(runner.GetAllTestResultsAlreadyCalled);
            (runner as VisualGridRunner)?.StopServiceRunner();
        }
        public void Trello_1661_Garmin_31839()
        {
            EyesRunner runner = new ClassicRunner();

            Eyes eyes = new Eyes(runner);

            TestUtils.SetupLogging(eyes);
            IWebDriver driver = SeleniumUtils.CreateChromeDriver();

            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);

            try
            {
                eyes.Open(driver, "Ticket31839", "Test", new Size(1200, 700));
                driver.Url = "https://www.garmin.com/en-US/account/create/";
                driver.FindElement(By.Id("emailMatch")).SendKeys("*****@*****.**");
                eyes.Check("TAG NAME", Target.Region(By.CssSelector("#content > section > div")).Fully()
                           //.ScrollRootElement(By.TagName("body"))
                           );
                eyes.Close();
            }
            finally
            {
                driver.Close();
                eyes.AbortIfNotClosed();
            }
        }
Exemple #11
0
        public void Test_VG_RCA_Config()
        {
            ILogHandler      logHandler = TestUtils.InitLogHandler();
            VisualGridRunner runner     = new VisualGridRunner(10, logHandler);
            Eyes             eyes       = new Eyes(runner);

            eyes.Batch = batch_;
            IWebDriver driver = SeleniumUtils.CreateChromeDriver();

            try
            {
                driver.Url = "https://applitools.github.io/demo/TestPages/VisualGridTestPage";
                driver.SwitchTo().Frame("iframe");
                WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
                wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("svg")));
                driver.SwitchTo().ParentFrame();
                eyes.Open(driver, "Test Visual Grid", "Test RCA Config");
                eyes.SendDom = true;
                eyes.Check(Target.Window());
                eyes.Close();
                runner.GetAllTestResults();
            }
            finally
            {
                driver.Quit();
                eyes.AbortIfNotClosed();
                runner.StopServiceRunner();
            }
        }
Exemple #12
0
        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 TestAndroidStitching()
        {
            ChromeOptions options = new ChromeOptions();
            ChromeMobileEmulationDeviceSettings mobileSettings = new ChromeMobileEmulationDeviceSettings();

            mobileSettings.PixelRatio = 4;
            mobileSettings.Width      = 360;
            mobileSettings.Height     = 740;
            mobileSettings.UserAgent  = "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.137 Mobile Safari/537.36";
            options.EnableMobileEmulation(mobileSettings);
            IWebDriver driver = new ChromeDriver(options);

            driver.Url = "https://silko11dev.outsystems.net/TestApp_AUTO_OutSystemsUIMobile/Adaptive";
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));

            wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#Columns2")));
            Eyes eyes = new Eyes();

            try
            {
                eyes.Open(driver, nameof(CustomerMobileTests), nameof(TestAndroidStitching));

                IWebElement element = driver.FindElement(By.ClassName("content"));
                eyes.Check(Target.Region(element).Fully());


                eyes.Close();
            }
            finally
            {
                eyes.AbortIfNotClosed();
                driver.Quit();
            }
        }
Exemple #15
0
        private static void RunTest(Eyes eyes, Configuration sconf)
        {
            // Create a new webdriver
            IWebDriver webDriver = new ChromeDriver();

            // Navigate to the url we want to test
            webDriver.Url = "https://applitools.com/helloworld";

            // Set the configuration object to eyes
            eyes.Configuration = sconf;

            // Call Open on eyes to initialize a test session
            eyes.Open(webDriver);

            // Add 2 checks
            eyes.Check(Target.Window().WithName("Step 1 - Viewport").Ignore(By.CssSelector(".primary")));
            eyes.Check(Target.Window().Fully().WithName("Step 1 - Full Page").Floating(By.CssSelector(".primary"), 10, 20, 30, 40).Floating(By.TagName("button"), 1, 2, 3, 4));

            webDriver.FindElement(By.TagName("button")).Click();

            // Add 2 checks
            eyes.Check(Target.Window().WithName("Step 2 - Viewport"));
            eyes.Check(Target.Window().Fully().WithName("Step 2 - Full Page"));

            // Close the browser
            webDriver.Quit();

            // Close eyes and collect results
            TestResults results = eyes.Close();
        }
        public void IEDriverTest_SauceLabs()
        {
            var sauceOptions = new Dictionary <string, object>();

            sauceOptions.Add("iedriverVersion", "3.141.0");
            sauceOptions.Add("username", TestDataProvider.SAUCE_USERNAME);
            sauceOptions.Add("accesskey", TestDataProvider.SAUCE_ACCESS_KEY);
            sauceOptions.Add("name", nameof(IEDriverTest_SauceLabs));
            var options = new InternetExplorerOptions();

            options.PlatformName   = "Windows 10";
            options.BrowserVersion = "latest";
            options.AddAdditionalCapability("sauce:options", sauceOptions, true);

            RemoteWebDriver driver = new RemoteWebDriver(new Uri(TestDataProvider.SAUCE_SELENIUM_URL), options.ToCapabilities(), TimeSpan.FromMinutes(3));

            var eyes = new Eyes();

            TestUtils.SetupLogging(eyes);
            eyes.SendDom = false;
            try
            {
                eyes.Open(driver, "IE", "IEDriverServer version 3.141.0 (SauceLabs)");
                driver.Url = "https://applitools.com";
                eyes.Check(Target.Window());
                eyes.Close();
            }
            finally
            {
                driver.Quit();
                eyes.AbortIfNotClosed();
            }
        }
        public void Ticket31566_CVS_Mobile()
        {
            ChromeOptions options = new ChromeOptions();
            ChromeMobileEmulationDeviceSettings mobileSettings = new ChromeMobileEmulationDeviceSettings();

            mobileSettings.PixelRatio = 4;
            mobileSettings.Width      = 360;
            mobileSettings.Height     = 740;
            mobileSettings.UserAgent  = "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.137 Mobile Safari/537.36";
            options.EnableMobileEmulation(mobileSettings);
            IWebDriver driver = new ChromeDriver(options);

            var eyes = new Eyes();

            TestUtils.SetupLogging(eyes);

            try
            {
                eyes.Open(driver, "Demo C# app", "CVS Mobile");
                eyes.StitchMode = StitchModes.Scroll;
                driver.Url      = "https://www.cvs.com/mobile/mobile-cvs-pharmacy/";
                eyes.Check("CVS!", Target.Window().Fully());
                eyes.Close();
            }
            finally
            {
                driver.Quit();
                eyes.AbortIfNotClosed();
            }
        }
Exemple #18
0
        //[Test]
        public void TestSendDOM_Simple_HTML()
        {
            IWebDriver webDriver = SeleniumUtils.CreateChromeDriver();

            webDriver.Url = "https://applitools-dom-capture-origin-1.surge.sh/test.html";
            Eyes eyes = new Eyes();

            try
            {
                EyesWebDriver eyesWebDriver = (EyesWebDriver)eyes.Open(webDriver, "Test Send DOM", "Test DomCapture method", new Size(1200, 1000));
                Logger        logger        = new Logger();
                logger.SetLogHandler(TestUtils.InitLogHandler());
                DomCapture domCapture          = new DomCapture(logger, eyesWebDriver);
                string     actualDomJsonString = domCapture.GetFullWindowDom();
                string     actualDomJson       = JsonUtility.NormalizeJsonString(actualDomJsonString);
                string     expectedDomJson     = GetExpectedDomFromUrl_("https://applitools-dom-capture-origin-1.surge.sh/test.dom.json");

                eyes.Close(false);

                Assert.AreEqual(expectedDomJson, actualDomJson);
            }
            finally
            {
                eyes.Abort();
                webDriver.Quit();
            }
        }
        public void Trello_1091()
        {
            IWebDriver chromeDriver = new ChromeDriver();

            var eyes = new Eyes();

            TestUtils.SetupLogging(eyes);

            try
            {
                IWebDriver driver = eyes.Open(chromeDriver, "Datorama", "Dashboard", new Size(1300, 800));
                driver.Url = "https://ci-platform.datorama.com/1655137/visualize/401393/page/523292";
                WebDriverWait wait       = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
                IWebElement   loginField = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("dato-input[data-auto-id=login_email] input")));

                loginField.SendKeys("*****@*****.**");
                driver.FindElement(By.CssSelector("dato-input[data-auto-id=login_password] input")).SendKeys("Aa123456");
                driver.FindElement(By.CssSelector("dato-button[data-auto-id=login_button] button")).Click();

                IWebElement dashboardElement = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("da-dashboard-content > div")));

                eyes.WaitBeforeScreenshots = 3000;
                eyes.Check("Datorama Dashboard", Target.Region(By.TagName("da-grid-stack")).ScrollRootElement(dashboardElement).Fully());
                eyes.Close();
            }
            finally
            {
                chromeDriver.Quit();
                eyes.AbortIfNotClosed();
            }
        }
Exemple #20
0
        public void TestMethod8()
        {
            var notepad = @"C:\Windows\System32\notepad.exe";

            var options = new AppiumOptions();

            options.AddAdditionalCapability("app", notepad);

            var driver = new WindowsDriver <WindowsElement>(new Uri(" http://127.0.0.1:4723/"), options);

            var eyes = new Eyes();

            eyes.ApiKey = "lFMnO9e1nbFQEdhebrDmhEBOqB7jXUXJGogj103lRWAzM110";
            eyes.SetAppEnvironment("Windows 10", null);

            try
            {
                eyes.Open("AppiumPractice", "TestMethod8");
                Thread.Sleep(3000);
                var currentAppScreenshot = driver.GetScreenshot();
                var croppedScreenshot    = CropScreenshot(currentAppScreenshot);

                eyes.CheckImage(croppedScreenshot, "Notepad Just Opened");

                eyes.Close();
            }
            finally
            {
                eyes?.AbortIfNotClosed();
                driver.Quit();
            }
        }
        public static void TearDown()
        {
            var testName   = TestContext.CurrentContext.Test.Name;
            var test       = extentReport.CreateTest(testName);
            var testResult = TestContext.CurrentContext.Result.Outcome;

            if (testResult == ResultState.Failure | testResult == ResultState.Error)
            {
                string path = @"C:\reports\UIreport\" + testName + ".jpeg";
                Driver.TakeScreenshot().SaveAsFile(path);
                test.Fail(TestContext.CurrentContext.Result.Message).AddScreenCaptureFromPath(path);
            }
            else if (testResult == ResultState.Skipped)
            {
                test.Skip("Skipped");
            }
            else if (testResult == ResultState.Success)
            {
                test.Pass("Passed");
            }
            Driver.Close();
            Driver.Quit();
            extentReport.Flush();
            if (Eyes.IsOpen is true)
            {
                Eyes.Close();
            }
            ;
        }
        public void Ticket31566()
        {
            var driver = new ChromeDriver();

            var eyes = new Eyes();

            TestUtils.SetupLogging(eyes);

            try
            {
                eyes.Open(driver, "Demo C# app", "Login Window", new Size(1300, 800));
                driver.Url = "https://cvi-ui-demo.coxautoinventory-np.com/inventory";
                WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));

                wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#login input[name='username']")));
                driver.FindElement(By.CssSelector("#login input[name='username']")).SendKeys("uiauto");
                driver.FindElement(By.CssSelector("#login input[name='password']")).SendKeys("password3");
                driver.FindElement(By.CssSelector("#login input[name='login']")).Click();

                wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#root > div > ul > li:nth-child(1) > a"))).Click();
                wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#Add-Vehicle"))).Click();

                eyes.Check("TAG NAME", Target.Region(By.CssSelector(".modal-content")).ScrollRootElement(By.CssSelector(".modal-dialog")));
                eyes.Close();
            }
            finally
            {
                driver.Quit();
                eyes.AbortIfNotClosed();
            }
        }
        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 void Trello_1723_Humana_medicare_on_IE11()
        {
            IWebDriver driver = new InternetExplorerDriver();
            // Initialize the eyes SDK and set your private API key.
            var eyes = new Eyes();

            TestUtils.SetupLogging(eyes);
            eyes.MatchTimeout = TimeSpan.FromSeconds(0);
            try
            {
                eyes.Open(driver, "Humana", "medicare", new Size(1200, 800));
                eyes.StitchMode = StitchModes.CSS;
                driver.Url      = "https://www.humana.com/medicare";
                //                driver.ExecuteScript(@"var e = document.querySelector('.phone-widget-wrapper.phone-widget-expanded');
                //e.parentElement.removeChild(e);
                //document.querySelector('div.copy-container > div > ol > li:nth-child(3) > a').style.overflowWrap = 'break-word';");
                eyes.Check(Target.Window().Fully());

                eyes.Close();
            }
            finally
            {
                driver.Quit();
                eyes.AbortIfNotClosed();
            }
        }
Exemple #25
0
        public void TestNoReplaceMatchedStep()
        {
            WebDriverProvider webdriverProvider = new WebDriverProvider();
            Eyes eyes = new Eyes(new MockServerConnectorFactory(webdriverProvider));

            TestUtils.SetupLogging(eyes);
            eyes.Batch = TestDataProvider.BatchInfo;
            IWebDriver driver = SeleniumUtils.CreateChromeDriver();

            webdriverProvider.SetDriver(driver);
            MockServerConnector mockServerConnector = (MockServerConnector)eyes.seleniumEyes_.ServerConnector;

            mockServerConnector.AsExpected = false;
            try
            {
                driver.Url = "https://applitools.github.io/demo/TestPages/SpecialCases/neverchanging.html";
                eyes.Open(driver, "Applitools Eyes SDK", "Test No Replace Matched Step", new Size(700, 460));
                eyes.Check("Step 1", Target.Window().SendDom(false));
                eyes.Close();
            }
            finally
            {
                driver.Quit();
                eyes.AbortIfNotClosed();
            }
            Assert.AreEqual(1, mockServerConnector.MatchWindowCalls.Count, "Matches");
            Assert.AreEqual(0, mockServerConnector.ReplaceMatchedStepCalls.Count, "Replacements");
        }
        public void Taxcom()
        {
            ChromeOptions options = new ChromeOptions();

            options.EnableMobileEmulation("iPhone 6");
            var driver = new ChromeDriver(options);

            var eyes = new Eyes();

            eyes.SetLogHandler(new StdoutLogHandler(true));
            //eyes.StitchMode = StitchModes.CSS;
            eyes.MatchTimeout = TimeSpan.FromSeconds(0);
            eyes.StitchMode   = StitchModes.Scroll;
            //eyes.SendDom = false;

            driver.Url = "https://taxcom.ru/centr/";

            try
            {
                eyes.WaitBeforeScreenshots = 600;
                var eyesDriver = eyes.Open(driver, "Taxcom", "#29531");
                driver.ExecuteScript("document.querySelector('a.scrollToTop').style.visibility='hidden'");
                eyes.Check(Target.Window().Fully());
                eyes.Close();
            }
            finally
            {
                driver.Quit();
                eyes.AbortIfNotClosed();
            }
        }
        public void TestDoubleCheckDontGetAllResults(bool useVisualGrid)
        {
            IWebDriver driver = SeleniumUtils.CreateChromeDriver();

            driver.Url = "https://applitools.com/helloworld";

            EyesRunner runner = useVisualGrid ? (EyesRunner) new VisualGridRunner(10) : new ClassicRunner();

            runner.SetLogHandler(TestUtils.InitLogHandler());

            string suffix = useVisualGrid ? "_VG" : "";

            try
            {
                Eyes eyes1 = new Eyes(runner);
                eyes1.Batch = TestDataProvider.BatchInfo;
                eyes1.Open(driver, "Applitools Eyes SDK", nameof(TestDoubleCheckDontGetAllResults) + suffix, new RectangleSize(1200, 800));
                eyes1.Check(Target.Window().WithName("Step 1"));
                eyes1.Check(Target.Window().WithName("Step 2"));
                eyes1.Close(false);
            }
            finally
            {
                driver.Quit();
            }
        }
        public void Trello_1668_Humana(StitchModes stitchMode)
        {
            var driver = new ChromeDriver();
            var eyes   = new Eyes();

            TestUtils.SetupLogging(eyes, nameof(Trello_1668_Humana) + $" ({stitchMode})");
            driver.Url = "file:///C:/Users/USER/Websites/Humana/PaymentDetails/humana_payment_details.html";
            //driver.Url = "https://billing.humana.com/PayNow";
            try
            {
                eyes.StitchMode = stitchMode;
                eyes.Batch      = new BatchInfo();
                eyes.Open(driver, "humana", $"pay now ({stitchMode})", new Size(1300, 600));
                driver.FindElement(By.Id("accountNumber")).SendKeys("41221821");
                eyes.AddProperty("Stitch Mode", eyes.StitchMode.ToString());
                eyes.Check(Target.Window().Fully()
                           //.ScrollRootElement(By.TagName("body"))
                           );

                eyes.Close();
            }
            finally
            {
                driver.Quit();
                eyes.AbortIfNotClosed();
            }
        }
        public void TestEyesDifferentRunners(string testedUrl, MatchLevel matchLevel)
        {
            IWebDriver webDriver = SeleniumUtils.CreateChromeDriver();
            Logger     logger    = null;
            Eyes       eyes      = null;

            try
            {
                webDriver.Url     = testedUrl;
                eyes              = InitEyes(webDriver, testedUrl);
                eyes.SaveNewTests = false;
                logger            = eyes.Logger;
                logger.Log("running check for url " + testedUrl);
                ICheckSettings checkSettings = GetCheckSettings();
                eyes.MatchLevel = matchLevel;
                eyes.Check(checkSettings.WithName("Step1 - " + testedUrl));
                eyes.Check(checkSettings.Fully().WithName("Step2 - " + testedUrl));
                logger.Verbose("calling eyes_.Close() (test: {0})", testedUrl);
                TestResults results = eyes.Close(false);
                ValidateResults(eyes, results);
            }
            finally
            {
                eyes?.Abort();
                webDriver.Quit();
            }
        }
        public void Trello_1676_LoopNet_32073()
        {
            var driver = new ChromeDriver();
            var eyes   = new Eyes();

            TestUtils.SetupLogging(eyes);
            try
            {
                eyes.Open(driver, "Ticket32073", "region", new Size(1200, 500));
                driver.Url = "https://www.loopnet.com";

                WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60));

                wait.Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("#top > section > header > nav > ul > li:nth-child(1) > a"))).Click();
                wait.Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("#login > section > div > div.column-06.divide-east > div.field-group.margin-top-lg > input"))).SendKeys("*****@*****.**");
                driver.FindElement(By.CssSelector("#login > section > div > div.column-06.divide-east > div:nth-child(5) > input")).SendKeys("Loopnet123");
                driver.FindElement(By.CssSelector("#login > section > div > div.column-06.divide-east > div:nth-child(7) > div > button")).Click();
                wait.Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("#top > section > header > nav > ul > li:nth-child(1) > div > button")));
                wait.Until(ExpectedConditions.ElementToBeClickable(By.CssSelector(".master > .main-header #csgp-menu-icon"))).Click();
                //wait.Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("#ListingManager_LN_Lister_enUS > a"))).Click();
                //menuIcon.Click();

                //eyes.Check(Target.Region(By.ClassName("top-menu")));
                eyes.Check(Target.Region(By.Id("csgp-nav-menu-options")).Fully().WithName("side menu"));
                eyes.Close(false);
            }
            finally
            {
                driver.Quit();
                eyes.Abort();
            }
        }