Esempio n. 1
0
 public static void SetBatch(string batchName, string batchId)
 {
     EyesWrapper.SetBatchName(batchName);
     if (!string.IsNullOrEmpty(batchId))
     {
         EyesWrapper.SetBatchId(batchId);
     }
 }
Esempio n. 2
0
        public static void VisualCheckpoint(string fileOrFolderPath)
        {
            // Handling of filename / folder
            fileOrFolderPath = fileOrFolderPath.Trim();
            if (!System.IO.File.Exists(fileOrFolderPath) && !System.IO.Directory.Exists(fileOrFolderPath))
            {
                fileOrFolderPath = System.IO.Directory.GetCurrentDirectory() + @"\" + fileOrFolderPath;
            }

            EyesWrapper.StartOrContinueTest(GetTestCaseName());
            EyesWrapper.CheckFolder(fileOrFolderPath);
        }
Esempio n. 3
0
        public static void VisualCheckpoint(Adapter adapter, string stepDescription)
        {
            if (adapter == null)
            {
                throw new ArgumentNullException("adapter");
            }

            EyesWrapper.StartOrContinueTest(GetTestCaseName());
            Report.Info(string.Format("Applitools 'CheckImage' called with screenshot from repository item '{0}'.", adapter));

            try
            {
                ProgressForm.SetOpacity(0);

                Bitmap image;
                if (adapter.Element.HasCapability("webdocument"))
                {
                    var webDocument = adapter.As <WebDocument>();
                    EyesWrapper.SetBrowserName(webDocument.BrowserName);
                    if (EyesWrapper.ViewPortWidth > 0 && EyesWrapper.ViewPortHeight > 0)
                    {
                        webDocument.Browser.Resize(EyesWrapper.ViewPortWidth, EyesWrapper.ViewPortHeight);
                    }

                    webDocument.WaitForDocumentLoaded();
                    image = webDocument.CaptureFullPageScreenshot(screenshotCaptureFlag);
                }
                else
                {
                    var browserName = string.Empty;
                    if (adapter.Element.HasCapability("webelement"))
                    {
                        var parent = adapter.Parent;
                        while (parent.As <WebDocument>() == null)
                        {
                            parent = parent.Parent;
                        }

                        browserName = parent.As <WebDocument>().BrowserName;
                    }

                    EyesWrapper.SetBrowserName(browserName);
                    image = Imaging.CaptureImage(adapter.Element);
                }

                EyesWrapper.CheckImage(image, stepDescription);
            }
            finally
            {
                ProgressForm.SetOpacity(100);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            int portHeight, portWidth;

            int.TryParse(ViewPortHeight, out portHeight);
            int.TryParse(ViewPortWidth, out portWidth);

            if (string.IsNullOrEmpty(AppName))
            {
                if (TestSuite.Current != null)
                {
                    AppName = TestSuite.Current.Name;
                }
            }

            EyesWrapper.Initialize(
                EyesApiKey, AppName, ServerURL, EyesBatchID, portWidth, portHeight, MatchLevel);
        }
Esempio n. 5
0
 /// <summary>
 /// Performs the playback of actions in this module.
 /// </summary>
 /// <remarks>You should not call this method directly, instead pass the module
 /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
 /// that will in turn invoke this method.</remarks>
 void ITestModule.Run()
 {
     Report.Info("Applitools: Closing Eyes.");
     EyesWrapper.CloseTest();
 }
Esempio n. 6
0
 public static void ChangeMatchLevel(string matchLevel)
 {
     EyesWrapper.SetMatchLevel(matchLevel);
 }
Esempio n. 7
0
 public static void ChangeAppName(string newAppName)
 {
     EyesWrapper.SetAppName(newAppName);
 }