예제 #1
0
        void NewEyesOpen()
        {
            List <int> mResolution = new List <int>();

            try
            {
                runner = new ClassicRunner();
                if (WorkSpace.Instance.RunsetExecutor.RunSetConfig != null && WorkSpace.Instance.RunsetExecutor.RunSetConfig.GingerRunners.Any() && ((GingerExecutionEngine)WorkSpace.Instance.RunsetExecutor.RunSetConfig.GingerRunners[0].Executor).ExecutedFrom == eExecutedFrom.Run)
                {
                    runner.DontCloseBatches = true;
                }
                newmEyes  = new Eyes(runner);
                mAppName  = mAct.GetInputParamCalculatedValue(ActVisualTesting.Fields.ApplitoolsParamApplicationName);
                mTestName = mAct.GetInputParamCalculatedValue(ActVisualTesting.Fields.ApplitoolsParamTestName);

                SetUp(newmEyes, mDriver.GetApplitoolServerURL(), mDriver.GetApplitoolKey(), eBrowserType.Chrome, mDriver.GetEnvironment());
                mAct.CheckSetAppWindowSize();
                mResolution = mAct.GetWindowResolution();
                newmEyes.Open(mDriver.GetWebDriver(), mAppName, mTestName, new System.Drawing.Size(mResolution[0], mResolution[1]));
            }
            catch (Exception ex)
            {
                if (mResolution != null && mResolution.Any() && mResolution[0] < 500)
                {
                    mAct.Error += "Eyes Open Failed. Set Resolution having width more than 500px, Error: " + ex.Message;
                }
                else
                {
                    mAct.Error += "Eyes Open Failed, Error: " + ex.Message;
                }
            }
        }
예제 #2
0
        internal static void InitEyes(bool useVisualGrid, out IWebDriver driver, out EyesRunner runner, out Eyes eyes, [CallerMemberName] string testName = null)
        {
            driver = CreateChromeDriver();
            string      logPath;
            ILogHandler logHandler;

            if (useVisualGrid)
            {
                testName  += "_VG";
                logPath    = TestUtils.InitLogPath(testName);
                logHandler = TestUtils.InitLogHandler(testName, logPath);
                VisualGridRunner visualGridRunner = new VisualGridRunner(10, logHandler);
                if (!TestUtils.RUNS_ON_CI)
                {
                    visualGridRunner.DebugResourceWriter = new FileDebugResourceWriter(logPath);
                }
                runner = visualGridRunner;
            }
            else
            {
                logPath    = TestUtils.InitLogPath(testName);
                logHandler = TestUtils.InitLogHandler(testName, logPath);
                runner     = new ClassicRunner(logHandler);
            }
            eyes       = new Eyes(runner);
            eyes.Batch = TestDataProvider.BatchInfo;
        }
예제 #3
0
        public void TestFullAgentId_VG_Match_Selenium()
        {
            string           vgAgentId;
            string           seleniumAgentId;
            VisualGridRunner vgRunner = new VisualGridRunner(10, TestUtils.InitLogHandler());

            try
            {
                Eyes eyes = new Eyes(vgRunner);
                vgAgentId = eyes.FullAgentId;
            }
            finally
            {
                vgRunner.StopServiceRunner();
            }

            ClassicRunner cRunner = new ClassicRunner();
            {
                Eyes eyes = new Eyes(cRunner);
                seleniumAgentId = eyes.FullAgentId;
            }
            string vgVersion  = vgAgentId.Split('/')[1];
            string selVersion = seleniumAgentId.Split('/')[1];

            Assert.AreEqual(vgVersion, selVersion);
        }
        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();
            }
        }
        public void Trello_1532()
        {
            IWebDriver    webDriver = new ChromeDriver();
            ClassicRunner runner    = new ClassicRunner();

            webDriver.Url = "https://www.humana.com/medicare/medicare-supplement-plans/plan-g";

            Eyes eyes = new Eyes(runner);

            eyes.SetLogHandler(new StdoutLogHandler(true));
            Configuration conf = new Configuration();

            conf.SetTestName("#31659")
            .SetAppName("Humana")
            .SetViewportSize(new Size(1200, 800));

            eyes.SetConfiguration(conf);

            eyes.StitchMode = StitchModes.CSS;
            //eyes.HideCaret = false;
            eyes.Open(webDriver);

            webDriver.Manage().Timeouts().ImplicitWait   = TimeSpan.FromSeconds(3);
            IReadOnlyCollection <IWebElement> TabsInPage = webDriver.FindElements(By.XPath("//button[@role='tab']"));

            if (TabsInPage.Count > 0)
            {
                By layout = By.CssSelector("#anchor-main-content > section:nth-child(2) > div > div > div.col-12.col-sm-12.col-md-4");
                By ignore = By.CssSelector("#searchbox");

                eyes.Check(Target.Window().Fully().WithName("Login page").Layout(layout).Ignore(ignore)); //This is fine

                TabsInPage.ElementAt(0).Click();
                eyes.Check(Target.Window().Fully().WithName("Login page").Layout(layout).Ignore(ignore)); //This is wrong

                TabsInPage.ElementAt(1).Click();
                eyes.Check(Target.Window().Fully().WithName("Login page").Layout(layout).Ignore(ignore));
            }

            webDriver.Quit();
            eyes.CloseAsync();

            TestResultsSummary allTestResults = runner.GetAllTestResults();

            TestContext.Progress.WriteLine(allTestResults);
        }
예제 #6
0
        public void TestCloseBatch(bool dontCloseBatch)
        {
            IWebDriver driver = SeleniumUtils.CreateChromeDriver();
            // Initialize the VisualGridEyes SDK and set your private API key.
            EyesRunner runner = new ClassicRunner();

            runner.DontCloseBatches = dontCloseBatch;
            Eyes eyes = new Eyes(runner);

            TestUtils.SetupLogging(eyes);

            eyes.SendDom    = false;
            eyes.StitchMode = StitchModes.CSS;

            BatchInfo batchInfo = new BatchInfo("Runner Testing");

            eyes.Batch = batchInfo;

            // Navigate the browser to the "hello world!" web-site.
            driver.Url = "https://applitools.com/helloworld";
            BatchInfo batch;

            try
            {
                eyes.Open(driver, "Applitools Eyes SDK", "Classic Runner Test", new Size(1200, 800));
                eyes.Check(Target.Window().WithName("Step 1"));
                eyes.Close();
            }
            finally
            {
                driver.Quit();
            }

            batch = TestUtils.GetBatchInfo(eyes);
            Assert.IsFalse(batch.IsCompleted);

            runner.GetAllTestResults(false);

            Thread.Sleep(10000);

            batch = TestUtils.GetBatchInfo(eyes);
            Assert.AreEqual(!dontCloseBatch, batch.IsCompleted);
        }
예제 #7
0
        public void GivenISeeTheText(string expectedHeaderText)
        {
            var runner                = new ClassicRunner();
            var eyes                  = new Eyes(runner);
            var configuration         = new Configuration();
            var driver                = Browser.Get();
            var navigationList        = new HomePage().NavigationLinksList;
            var navigationEnglishList = new HomePage().NavigationEnglishLists;

            eyes.ApiKey = "e1a30daWtG7TGDntETpQvN8WhA29muccCaXA6aFQMn8110";
            eyes.Open(driver, "Demo App", "Smoke Test");

            eyes.Check(" BBC Page", Target.Window().Ignore(navigationList).Ignore(navigationEnglishList));

            eyes.CloseAsync();

            //var currentText = new HomePage().Header.Text;
            //currentText.Should().NotBeEmpty( expectedHeaderText, "because the header text shoud be must be the same as expected" );
        }
        public void TestExceptionInGetAllTestResults()
        {
            EyesRunner runner = new ClassicRunner();
            Eyes       eyes   = new Eyes(runner);

            eyes.SaveNewTests = false;
            IWebDriver driver = SeleniumUtils.CreateChromeDriver();

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

            eyes.Open(driver,
                      nameof(TestClassicRunnerExceptions),
                      nameof(TestExceptionInGetAllTestResults),
                      new Size(800, 600));
            eyes.CheckWindow();
            eyes.CloseAsync();

            driver.Quit();
            Assert.That(() => { TestResultsSummary results = runner.GetAllTestResults(); }, Throws.Exception);
        }
예제 #9
0
        public void Test_32176_Trello_1744()
        {
            ClassicRunner runner = new ClassicRunner();

            var driver = new ChromeDriver();

            var eyes = new Eyes(runner);

            eyes.StitchMode = StitchModes.CSS;
            //eyes.ForceFullPageScreenshot = true;
            eyes.SetLogHandler(new StdoutLogHandler(true));

            try
            {
                eyes.Open(driver, "GovIL", "#32176", new Size(1600, 600));

                driver.Url = "https://govforms.gov.il/mw/forms/[email protected]";

                driver.ExecuteScript("document.documentElement.style.overflow='hidden'; document.documentElement.style.transform='translate(0px, 0px)';document.body.style.overflow='visible';");

                eyes.Check("Tab 1", Target.Region(By.CssSelector("#user")).Fully());

                driver.FindElement(By.CssSelector("#Tab2")).Click();
                eyes.Check("Tab 2", Target.Region(By.CssSelector("#user")).Fully());

                //driver.FindElement(By.CssSelector("#Tab3")).Click();
                //eyes.Check("Tab 3", Target.Region(By.CssSelector("#user")));

                //driver.FindElement(By.CssSelector("#Tab4")).Click();
                //eyes.Check("Tab 4", Target.Region(By.CssSelector("#user")));

                eyes.CloseAsync();
            }
            finally
            {
                driver.Quit();

                runner.GetAllTestResults();
            }
        }
        public static void Main(String[] args)
        {
            // Use Chrome browser
            IWebDriver driver = new ChromeDriver();

            // Initialize the Runner for your test.
            EyesRunner runner = new ClassicRunner();

            // Initialize the eyes SDK
            Eyes eyes = new Eyes(runner);

            SetUp(eyes);

            try
            {
                TestDemoApp(driver, eyes);
            }
            finally
            {
                TearDown(driver, runner);
            }
        }
        public void IEDriverTest(string driverVersion)
        {
            var runner = new ClassicRunner();
            var driver = new InternetExplorerDriver(@"C:\Users\USER\Downloads\IEDrivers\" + driverVersion);

            var eyes = new Eyes(runner);

            TestUtils.SetupLogging(eyes);

            try
            {
                eyes.Open(driver, "IE", "IEDriverServer version " + driverVersion);
                driver.Url = "https://applitools.com";
                eyes.Check(Target.Window());
                eyes.Close();
            }
            finally
            {
                runner.GetAllTestResults();
                driver.Quit();
                eyes.AbortIfNotClosed();
            }
        }
예제 #12
0
        public void Demo_Applitool()
        {
            EyesRunner runner = new ClassicRunner();
            Eyes       eye    = new Eyes(runner);

            var suiteConfig = new Applitools.Selenium.Configuration();

            suiteConfig
            // Test suite configurations
            .SetApiKey("KgPPOMrJBHbsgzaZ1oJ5A18sNMPiZEXpiRSGqOv6qmk110")
            .SetBatch(new BatchInfo("Demo Regression 001"));

            eye.SetConfiguration(suiteConfig);

            DriverProperty property = new DriverProperty();

            property.DriverType = DriverType.Chrome;
            WebDriver.InitDriverManager(property);
            WebDriver.AddNewDriver(property);
            eye.Open(WebDriver.Driver, "DEMO", "Demo Test 001");
            WebDriver.GoToUrl("http://google.com.vn");

            WebDriver.Sleep(5);

            eye.CheckWindow("Google home page 1");
            eye.Check(Target.Window().Layout(By.XPath("")).Region(By.XPath("")));

            WebDriver.Sleep(5);

            eye.CheckWindow("Google home page 2");

            eye.CloseAsync();

            WebDriver.QuitAllDriver();

            runner.GetAllTestResults(true);
        }
예제 #13
0
        public void Trello_1544()
        {
            //EyesRunner runner = new VisualGridRunner(10);
            EyesRunner runner = new ClassicRunner();

            Eyes eyes = new Eyes(runner);

            Configuration configuration = eyes.GetConfiguration();

            configuration.AddBrowser(800, 600, BrowserType.CHROME);
            configuration.AddBrowser(1600, 1200, BrowserType.CHROME);
            eyes.SetConfiguration(configuration);

            eyes.SetLogHandler(new NunitLogHandler(true));
            eyes.MatchTimeout = TimeSpan.FromSeconds(0);
            IWebDriver driver = new ChromeDriver();

            try
            {
                eyes.Open(driver, "Trello 1544 PNC", "Intermittent Coded Regions", new Size(800, 600));
                driver.Url = "https://www.pnc.com/en/personal-banking.html";

                WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
                wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#container > div.hero-login-wrapper")));

                eyes.Check(Target.Window().Fully()
                           .Layout(By.CssSelector("#container > div.hero-login-wrapper"))
                           .Layout(By.CssSelector("#main-header > div.header-wrapper"))
                           );
                eyes.Close(false);
            }
            finally
            {
                driver.Quit();
                runner.GetAllTestResults();
            }
        }
        public void TestEyesExceptions()
        {
            IWebDriver driver = SeleniumUtils.CreateChromeDriver();
            EyesRunner runner = new ClassicRunner();
            Eyes       eyes   = new Eyes(runner);

            try
            {
                eyes.ApiKey = "";
                Assert.That(() => { eyes.Open(driver); }, Throws.Exception.With.InstanceOf <EyesException>().With.Property("Message").EqualTo("API key not set! Log in to https://applitools.com to obtain your API key and use the 'Eyes.ApiKey' property to set it."));
                eyes.ApiKey = "someAPIkey";
                Assert.That(() => { eyes.Open(driver); }, Throws.ArgumentNullException.With.Property("ParamName").EqualTo("appIdOrName"));
                Configuration conf = new Configuration();
                conf.SetAppName("");
                eyes.SetConfiguration(conf);
                Assert.That(() => { eyes.Open(driver); }, Throws.ArgumentException.With.Property("ParamName").EqualTo("appIdOrName"));
                conf.SetAppName("app");
                eyes.SetConfiguration(conf);
                Assert.That(() => { eyes.Open(driver); }, Throws.ArgumentNullException.With.Property("ParamName").EqualTo("scenarioIdOrName"));
                conf.SetTestName("");
                eyes.SetConfiguration(conf);
                Assert.That(() => { eyes.Open(driver); }, Throws.ArgumentException.With.Property("ParamName").EqualTo("scenarioIdOrName"));
                conf.SetTestName("test");
                eyes.SetConfiguration(conf);
                eyes.Open(driver);

                TestResults results = eyes.Close();
                results?.Delete();
                runner.GetAllTestResults();
            }
            finally
            {
                eyes.Abort();
                driver.Quit();
            }
        }
        public void Ticket_1586_GovIL()
        {
            ClassicRunner runner = new ClassicRunner();
            var           driver = new ChromeDriver();
            var           eyes   = new Eyes(runner);

            eyes.SetLogHandler(new StdoutLogHandler(true));
            try
            {
                eyes.Open(driver, "GovIL", "Full page test", new Size(1000, 600));

                driver.Url          = "https://govforms.gov.il/mw/forms/CommitteesReport%40health.gov.il";
                eyes.HideScrollbars = false;
                driver.ExecuteScript("document.documentElement.style.overflow='hidden'; document.documentElement.style.transform='translate(0px, 0px)';document.body.style.overflow='visible';");
                eyes.Check("step name", Target.Window().Fully());

                eyes.CloseAsync();
            }
            finally
            {
                driver.Quit();
                runner.GetAllTestResults();
            }
        }
예제 #16
0
 static void Main(string[] args)
 {
     ClassicRunner.Run();
     DiRunner.Run();
 }
예제 #17
0
 static void Main(string[] args)
 {
     ClassicRunner.Run();
     Console.WriteLine("==========");
     ConcreteFluentRunner.Run();
 }