Beispiel #1
0
        private void Checkpoint()
        {
            if (mEyes == null)
            {
                mAct.Error  = "Applitools Eyes is not opened";
                mAct.ExInfo = "You require to add Eyes.Open Action on step before.";
                return;
            }

            SetEyesMatchLevel();
            AppImage response = mEyes.CheckImage(mDriver.GetScreenShot());

            mAct.AddOrUpdateReturnParamActual("ExactMatches", response.IsMatch.ToString());

            bool FailActionOnMistmach = Boolean.Parse(mAct.GetInputParamValue(ApplitoolsAnalyzer.FailActionOnMistmach));

            if (response.IsMatch == true || !FailActionOnMistmach)
            {
                mAct.Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed;
                if (!FailActionOnMistmach)
                {
                    mAct.ExInfo = "Created new baseline in Applitools or Mismatch between saved baseline and target checkpoint image";
                }
            }
            else if (response.IsMatch == false)
            {
                mAct.Error = "Created new baseline in Applitools or Mismatch between saved baseline and target checkpoint image";
            }
        }
Beispiel #2
0
        public void TakeScreenShotforBaseline(IVisualTestingDriver driver)
        {
            mDriver = driver;
            //TODO: verify we have driver
            // get updated screen shot
            baseImage = mDriver.GetScreenShot();

            //Verify we have screenshots folder
            string SAVING_PATH = System.IO.Path.Combine(SolutionFolder, @"Documents\ScreenShots\");

            if (!Directory.Exists(SAVING_PATH))
            {
                Directory.CreateDirectory(SAVING_PATH);
            }

            // Create default file name if not exist
            if (string.IsNullOrEmpty(BaseLineFileName))
            {
                BaseLineFileName = @"~\Documents\ScreenShots\" + Description + " - Baseline.png";
            }

            //string FullPath = BaseLineFileName.Replace(@"~\", SolutionFolder);
            string FullPath = amdocs.ginger.GingerCoreNET.WorkSpace.Instance.SolutionRepository.ConvertSolutionRelativePath(BaseLineFileName);

            // no need to ask user, + it might be at run time
            //TOOD: handle err
            if (File.Exists(FullPath))
            {
                File.Delete(FullPath);
            }

            baseImage.Save(FullPath);
        }
Beispiel #3
0
        private void Compare()
        {
            // All compares are done on: baseImage vs. targetImage - they are being set before calling engine comapre
            // compare image or results saved in object this.CompareResult - can be image or text or other

            // ----------------------------------------------------------------
            // set base image
            // ----------------------------------------------------------------

            //TODO: need to work with value for driver
            string baselinefilename = GetInputParamValue(Fields.SavedBaseImageFilenameString);
            string fullBaseFilePath = GetFullFilePath(baselinefilename);

            if (!File.Exists(fullBaseFilePath))
            {
                Error = "Baseline file not found - " + fullBaseFilePath;
                return;
            }

            baseImage = new Bitmap(fullBaseFilePath);

            // ----------------------------------------------------------------
            // set target image
            // ----------------------------------------------------------------

            // if the target file name is empty then we take screen shot, else we take the file
            if (string.IsNullOrEmpty(TargetFileName))
            {
                targetImage = mDriver.GetScreenShot();
            }
            else
            {
                // get it from the file
                string fullTargetFilePath = GetFullFilePath(TargetFileName);
                targetImage = new Bitmap(fullTargetFilePath);
            }

            //TODO: add code to validate we have valid base /target images, if not put err and info in ExInfo

            // TODO: check basic: size diff writye to output param, and other general params

            AddScreenShot(baseImage, "Baseline Image");
            AddScreenShot(targetImage, "Target Image");

            CheckSetVisualAnalyzer();

            // Here we call the actual analyzer after everything is prepared
            mVisualAnalyzer.SetAction(mDriver, this);
            mVisualAnalyzer.Compare();

            //Add other info to output params

            AddImageInfo("Baseline image", baseImage);
            AddImageInfo("Target image", targetImage);
        }
Beispiel #4
0
        private void Checkpoint()
        {
            if (mEyes == null)
            {
                mAct.Error  = "Applitools Eyes is not opened";
                mAct.ExInfo = "You require to add Eyes.Open Action on step before.";
                return;
            }

            SetEyesMatchLevel();
            AppImage response = mEyes.CheckImage(mDriver.GetScreenShot());

            mAct.Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed;
        }