示例#1
0
        private static void ConfigureEyes(Eyes eyes)
        {
            Selenium.Configuration conf = eyes.GetConfiguration();

            //Set the batch
            conf.SetBatch(bi);

            eyes.SetConfiguration(conf);
        }
示例#2
0
        private static void ConfigureUltrafastGrid(Eyes eyes)
        {
            Selenium.Configuration conf = eyes.GetConfiguration();

            //Set browsers and devices for the UFG
            conf.AddBrowser(800, 600, BrowserType.CHROME);
            //conf.AddBrowser(1200, 800, BrowserType.FIREFOX);

            eyes.SetConfiguration(conf);
        }
示例#3
0
        private void Run()
        {
            // Create a new webdriver
            IWebDriver webDriver = new ChromeDriver();

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

            // Create a runner with concurrency of 10
            VisualGridRunner runner = new VisualGridRunner(10);

            runner.SetLogHandler(TestUtils.InitLogHandler(nameof(PNCDemo)));

            // Create Eyes object with the runner, meaning it'll be a Visual Grid eyes.
            Eyes eyes = new Eyes(runner);

            // Create SeleniumConfiguration.
            Selenium.Configuration sconf = new Selenium.Configuration();

            // Add browsers
            sconf.AddDeviceEmulation(DeviceName.Galaxy_S5);
            foreach (BrowserType b in Enum.GetValues(typeof(BrowserType)))
            {
                sconf.AddBrowser(700, 500, b);
                sconf.AddBrowser(800, 600, b);
                sconf.AddBrowser(900, 700, b);
                sconf.AddBrowser(1200, 800, b);
                sconf.AddBrowser(1600, 1200, b);
            }

            //sconf.AddDeviceEmulation(800, 640);

            // Set the configuration object to eyes
            eyes.SetConfiguration(sconf);

            // Call Open on eyes to initialize a test session
            eyes.Open(webDriver, "PNC Demo", "PNC Demo", new System.Drawing.Size(1000, 700));

            eyes.Check("PNC", Target.Window().Fully().SendDom()
                       .Layout(By.CssSelector("#main-header > div.highlighted-topics-tout-container-parsys.limited-parsys"))
                       .Layout(By.CssSelector("#main-header > div.promo-parsys.limited-parsys"))
                       .Ignore(By.CssSelector("#oo-feedback > img")));

            // Close the browser
            webDriver.Quit();

            // Close eyes and collect results
            TestResults        results        = eyes.Close();
            TestResultsSummary allTestResults = runner.GetAllTestResults();
        }
        internal void SetUp(Eyes eyes)
        {
            Selenium.Configuration config = new Selenium.Configuration();

            //Uncomment and add your Applitools key here if you prefer
            //to hard-code it vs adding it to your environment variables.
            //config.SetApiKey("");

            config.SetBatch(new BatchInfo("UFG Hackathon"));

            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);
            config.AddDeviceEmulation(DeviceName.iPhone_X, ScreenOrientation.Portrait);

            // Set the configuration object to eyes
            eyes.SetConfiguration(config);
        }
示例#5
0
        private void Init()
        {
            // Create a new webdriver
            webDriver = new ChromeDriver();

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

            // ⭐️ Note to see visual bugs, run the test using the above URL for the 1st run.
            //but then change the above URL to https://demo.applitools.com/index_v2.html (for the 2nd run)

            // Create a runner with concurrency of 10
            runner = new VisualGridRunner(10);

            // Set StdOut log handler with regular verbosity.
            runner.SetLogHandler(new StdoutLogHandler(false));

            // Create Eyes object with the runner, meaning it'll be a Visual Grid eyes.
            eyes = new Eyes(runner);

            // Create configuration object
            Selenium.Configuration conf = new Selenium.Configuration();

            //conf.SetApiKey("APPLITOOLS_API_KEY");    // Set the Applitools API KEY here or as an environment variable "APPLITOOLS_API_KEY"
            conf.SetTestName("C# VisualGrid demo 2") // Set test name
            .SetAppName("Demo app");                 // Set app name

            // Add browsers with different viewports
            conf.AddBrowser(800, 600, BrowserType.CHROME);
            conf.AddBrowser(700, 500, BrowserType.FIREFOX);
            conf.AddBrowser(1200, 800, BrowserType.IE_10);
            conf.AddBrowser(1600, 1200, BrowserType.IE_11);
            conf.AddBrowser(1024, 768, BrowserType.EDGE);

            // Add iPhone 4 device emulation in Portrait mode
            conf.AddDeviceEmulation(DeviceName.iPhone_4, ScreenOrientation.Portrait);

            // Set the configuration object to eyes
            eyes.SetConfiguration(conf);
        }
        private void Run()
        {
            // Create a new webdriver
            IWebDriver webDriver = new ChromeDriver();

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

            // Create a runner with concurrency of 10
            VisualGridRunner runner = new VisualGridRunner(10);

            runner.SetLogHandler(TestUtils.InitLogHandler(nameof(MinimalVisualGridDemo)));

            // Create Eyes object with the runner, meaning it'll be a Visual Grid eyes.
            Eyes eyes = new Eyes(runner);

            // Create SeleniumConfiguration.
            Selenium.Configuration sconf = new Selenium.Configuration();

            // Set test name
            sconf.SetTestName("Visual Grid Demo");

            // Set app name
            sconf.SetAppName("Visual Grid Demo");

            // Add browsers
            sconf.AddBrowser(800, 600, BrowserType.CHROME);
            sconf.AddBrowser(700, 500, BrowserType.FIREFOX);
            sconf.AddBrowser(1200, 800, BrowserType.IE_10);
            sconf.AddBrowser(1200, 800, BrowserType.IE_11);
            sconf.AddBrowser(1600, 1200, BrowserType.EDGE);

            //// Add iPhone 4 device emulation
            //ChromeEmulationInfo iphone4 = new ChromeEmulationInfo(DeviceName.iPhone_4, ScreenOrientation.Portrait);
            //sconf.AddDeviceEmulation(iphone4);

            // Add custom mobile device emulation
            //EmulationDevice customMobile = new EmulationDevice(width: 1024, height: 768, deviceScaleFactor: 2);
            //sconf.AddDeviceEmulation(customMobile);

            sconf.AddDeviceEmulation(DeviceName.iPhone_5SE, ScreenOrientation.Landscape);
            sconf.AddDeviceEmulation(DeviceName.Galaxy_S5);

            //sconf.AddDeviceEmulation(800, 640);

            // Set the configuration object to eyes
            eyes.SetConfiguration(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();
            TestResultsSummary allTestResults = runner.GetAllTestResults();
        }