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

            return(report);
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio n. 4
0
        internal string GetExpectedImageFilename(TestDescription test)
        {
            string filename = CreateFilenameFromTest(test.Name + "__expected");

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

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

            return(filename);
        }
Esempio n. 7
0
 internal string GetActualImageFilePath(TestDescription test)
 {
     return(GetActualImageFilePath(test.Name));
 }
Esempio 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);
        }
Esempio 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);
 }