Ejemplo n.º 1
0
        private Report CreateReport(TestDescription test, CompareResultDescription compareResult)
        {
            var report = new Report
            {
                Result = compareResult,
                Test   = test
            };

            return(report);
        }
Ejemplo n.º 2
0
        private Report CompareActualPageVersusExpected(ArgsProcessor argProc, DirectoryManager dirManager,
                                                       TestDescription test, BrowserDriver driver)
        {
            string actualFilePath = dirManager.GetActualImageFilePath(test);

            driver.SaveDivImageToPath(test.DivSelector, actualFilePath, test.CropAdjustWidth, test.CropAdjustHeight, test.SleepTimespan);

            var comparer      = new CustomImageComparer(argProc);
            var compareResult = comparer.CompareImages(actualFilePath, dirManager.GetExpectedImageFilePath(test), test);

            var report = CreateReport(test, compareResult);

            return(report);
        }
Ejemplo n.º 3
0
        private static List <TestDescription> ReadTests(ArgsProcessor argProc)
        {
            List <TestDescription> testsToRun;
            List <TestDescription> tests;

            {
                var reader = new TestConfigReader();
                var path   = argProc.GetArg(ArgsProcessor.Args.CSV_FILE_PATH);
                tests = reader.ReadFromFilePath(path);
                Outputter.Output(string.Format("Read {0} tests from Test Suite: {1}", tests.Count, path));
            }

            testsToRun = TestDescription.GetTestsByName(tests, argProc.GetArg(ArgsProcessor.Args.TEST_NAME));
            return(testsToRun);
        }
Ejemplo n.º 4
0
        internal string GetExpectedImageFilename(TestDescription test)
        {
            string filename = CreateFilenameFromTest(test.Name + "__expected");

            return(filename);
        }
Ejemplo n.º 5
0
        internal string GetExpectedImageFilePath(TestDescription test)
        {
            string filename = GetExpectedImageFilename(test);

            return(Path.GetFullPath(Path.Combine(imagesDirPath, filename)));
        }
Ejemplo n.º 6
0
        internal string GetSideBySideFilename(TestDescription test)
        {
            string filename = CreateFilenameFromTestNoExtension(test.Name) + ".sideBySide.html";

            return(filename);
        }
Ejemplo n.º 7
0
 internal string GetActualImageFilePath(TestDescription test)
 {
     return(GetActualImageFilePath(test.Name));
 }
Ejemplo n.º 8
0
        private CompareResult RunTest(ArgsProcessor argProc, CompareResult overallResult, ReportSet reportSet, TestDescription test)
        {
            _driver.SetWindowSize(test.WindowSize);

            _driver.OpenUrl(test.Url, test.DivSelector, test.TitleContains);

            var dirManager = new DirectoryManager(argProc);

            if (argProc.IsOptionOn(ArgsProcessor.Options.Run))
            {
                var reportThisTest = CompareActualPageVersusExpected(argProc, dirManager, test, _driver);
                var resultThisTest = reportThisTest.Result.Result;
                if (resultThisTest != CompareResult.Similar)
                {
                    overallResult = resultThisTest;
                }
                reportSet.Reports.Add(reportThisTest);
            }
            else if (argProc.IsOptionOn(ArgsProcessor.Options.Save))
            {
                SaveExpectedPage(dirManager, test, _driver);
            }
            else
            {
                throw new InvalidOperationException("Not a supported set of options");
            }
            return(overallResult);
        }
Ejemplo n.º 9
0
 private void SaveExpectedPage(DirectoryManager dirManager, TestDescription test, BrowserDriver driver)
 {
     Outputter.Output("Saving expected page for test: " + test.Name);
     driver.SaveDivImageToPath(test.DivSelector, dirManager.GetExpectedImageFilePath(test), test.CropAdjustWidth, test.CropAdjustHeight, test.SleepTimespan);
 }