public void TestBase64()
        {
            Eyes eyes = Setup();

            eyes.Open("TestEyesImages", "CheckImage(base64)", new Size(1024, 768));

            eyes.CheckImage(Convert.ToBase64String(ReadResourceBytes_("gbg1.png")), "TestBase64 1");
            eyes.CheckImage(Convert.ToBase64String(ReadResourceBytes_("gbg2.png")), "TestBase64 2");
            Teardown(eyes);
        }
        public void TestBitmap()
        {
            Eyes eyes = Setup();

            eyes.Open("TestEyesImages", "CheckImage(Bitmap)");

            eyes.CheckImage(new Bitmap(CommonUtils.ReadResourceStream("Test.Eyes.Images.DotNet.Content.gbg1.png")), "TestBitmap1");
            eyes.CheckImage(new Bitmap(CommonUtils.ReadResourceStream("Test.Eyes.Images.DotNet.Content.gbg2.png")), "TestBitmap2");
            Teardown(eyes);
        }
        public void TestBytes()
        {
            Eyes eyes = Setup();

            eyes.Open("TestEyesImages", "CheckImage(byte[])", new Size(1024, 768));

            eyes.CheckImage(ReadResourceBytes_("gbg1.png"), "TestBytes1");
            eyes.CheckImage(ReadResourceBytes_("gbg2.png"), "TestBytes2");
            Teardown(eyes);
        }
Esempio n. 4
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 void TestBitmapWithDispose()
        {
            Eyes eyes = Setup();

            eyes.Open("TestEyesImages", "CheckImage(Bitmap) With Dispose");

            using (Bitmap bitmap1 = new Bitmap(CommonUtils.ReadResourceStream("Test.Eyes.Images.DotNet.Content.gbg1.png")))
            {
                eyes.CheckImage(bitmap1, "TestBitmap1");
            }

            using (Bitmap bitmap2 = new Bitmap(CommonUtils.ReadResourceStream("Test.Eyes.Images.DotNet.Content.gbg2.png")))
            {
                eyes.CheckImage(bitmap2, "TestBitmap2");
            }

            Teardown(eyes);
        }
Esempio n. 6
0
        public void TestMethod5()
        {
            var options = new AppiumOptions();

            options.AddAdditionalCapability("app", @"C:\Program Files (x86)\M4Solutions\M4Solutions.exe");

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

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

            var projectToOpen = @"E:\clients\mapcom\M4 Regression Test Automation\Test Project\Diversicom\ARVIG.prj";

            System.Windows.Forms.Clipboard.SetText(projectToOpen);

            var projectCenterWindow = driver.FindElementByAccessibilityId("ProjectCenter");
            var btnPickProject      = projectCenterWindow.FindElementByAccessibilityId("btnPickProject");

            btnPickProject.Click();

            var openDialog = projectCenterWindow.FindElementByClassName("#32770");

            var fileTextBox = openDialog.FindElementByAccessibilityId("1148");

            fileTextBox.SendKeys(projectToOpen);

            var openButton = openDialog.FindElementByAccessibilityId("1");

            openButton.Click();

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

            var mainWindow = driver.FindElementByAccessibilityId("MDIForm1");

            wait.Until(ExpectedConditions.TextToBePresentInElement(mainWindow, "M4 - ARVIG"));
            wait.Until(ExpectedConditions.ElementExists(By.Name("COUNTIES.msi")));

            var eyes = new Eyes();

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

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

                eyes.CheckImage(currentAppScreenshot.AsByteArray, "Project Finished Loading");

                eyes.Close();
            }
            finally
            {
                eyes?.AbortIfNotClosed();
                driver.Quit();
            }
        }
Esempio n. 7
0
        public void TestClose()
        {
            BatchInfo   batch      = new BatchInfo();
            ILogHandler logHandler = TestUtils.InitLogHandler();
            Logger      logger     = new Logger();

            logger.SetLogHandler(logHandler);
            Eyes eyes = new Eyes(logger);

            eyes.Batch = batch;

            eyes.Open(nameof(TestCloseMethod), nameof(TestClose));
            eyes.CheckImage(new Bitmap(TestEyesImages.ReadResourceStream_("gbg1.png")), "TestBitmap1");
            eyes.Close(false);

            eyes.Open(nameof(TestCloseMethod), nameof(TestClose));
            eyes.CheckImage(new Bitmap(TestEyesImages.ReadResourceStream_("twitter1d-s4.png")), "TestBitmap1");
            Assert.That(() => eyes.Close(true), Throws.InstanceOf <DiffsFoundException>());
        }
Esempio n. 8
0
        public override void Run(Eyes eyes)
        {
            var pdfDocument = PdfDocument.Load(this.file, pdfPassword);

            for (int i = 0; i < pagesList.Count; i++)
            {
                var bim = pdfDocument.Render(pagesList[i] - 1, this.dpi, this.dpi, false);
                eyes.CheckImage(new Bitmap(bim), string.Format("Page-{0}", pagesList[i]));
            }
        }
Esempio n. 9
0
 public override void Run(Eyes eyes)
 {
     try
     {
         eyes.CheckImage(GetImage(), Name());
     }
     catch (IOException e)
     {
         Console.WriteLine("Failed to process image file: {0} \\n Reason: {1} \\n", file.Name, e.Message);
         throw;
     }
 }
        public void TestPDF()
        {
            Eyes eyes = Setup();

            eyes.Open("CustomerImagesTests", "Check PDF");
            using (Document document = new Document(CommonUtils.ReadResourceStream("Customers.Test.Eyes.Selenium.Resources.gre_research_validity_data.pdf")))
            {
                for (int i = 0; i < document.Pages.Count; ++i)
                {
                    Page currentPage = document.Pages[i];
                    using (Bitmap pdfImage = new Bitmap(currentPage.Render(700, 700, new RenderingSettings())))
                    {
                        //pdfImage.Save(Path.Combine(FOLDER_PATH, $"temp_{fileName}_{i+1}.png"));
                        eyes.CheckImage(pdfImage, $"test page {i + 1}");
                    }
                }
            }
            Teardown(eyes);
        }
Esempio n. 11
0
        public void TestMethod11()
        {
            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);

            driver.Manage().Window.Maximize();

            var textEditor = driver.FindElementByAccessibilityId("15");

            textEditor.SendKeys("ABCDEF");

            var eyes = new Eyes();

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

            try
            {
                eyes.Open("AppiumPractice", "TestMethod11");
                Thread.Sleep(3000);
                var currentAppScreenshot = driver.GetScreenshot();
                var croppedScreenshot    = CropScreenshotWithRect(currentAppScreenshot, textEditor);
                var croppedScreenshot2   = CropScreenshotOf2(croppedScreenshot, new Rectangle(900, 0, textEditor.Size.Width - 900, textEditor.Size.Height));

                eyes.CheckImage(croppedScreenshot2, "Cropped Text Editor");

                eyes.Close();
            }
            finally
            {
                eyes?.AbortIfNotClosed();
                driver.Quit();
            }
        }