Beispiel #1
0
        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 void Run()
        {
            // Create a new webdriver
            IWebDriver 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
            VisualGridRunner runner = new VisualGridRunner(10);

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

            // Create configuration object
            Configuration conf = new 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")   // 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);

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

            // check the login page
            eyes.Check(Target.Window().Fully().WithName("Login page"));
            webDriver.FindElement(By.Id("log-in")).Click();

            // Check the app page
            eyes.Check(Target.Window().Fully().WithName("App page"));

            // Close the browser
            webDriver.Quit();

            eyes.CloseAsync();

            //Wait and collect all test results
            TestResultSummary allTestResults = runner.GetAllTestResults();

            System.Console.WriteLine(allTestResults);
        }
Beispiel #3
0
        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;
        }
        public void BeforeTestSuite()
        {
            runner = new VisualGridRunner(concurrentSessions);
            // Create a configuration object, we will use this when setting up each test
            suiteConfig = new Configuration();
            IConfiguration newsuiteConfg = new Configuration();

            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);

            suiteConfig
            .SetApiKey(apiKey)
            .SetAppName(appName)
            .SetBatch(new BatchInfo(batchName))
            ;
        }
        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));
        }