private Report CreateReport(TestDescription test, CompareResultDescription compareResult) { var report = new Report { Result = compareResult, Test = test }; return(report); }
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); }
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); }
internal string GetExpectedImageFilename(TestDescription test) { string filename = CreateFilenameFromTest(test.Name + "__expected"); return(filename); }
internal string GetExpectedImageFilePath(TestDescription test) { string filename = GetExpectedImageFilename(test); return(Path.GetFullPath(Path.Combine(imagesDirPath, filename))); }
internal string GetSideBySideFilename(TestDescription test) { string filename = CreateFilenameFromTestNoExtension(test.Name) + ".sideBySide.html"; return(filename); }
internal string GetActualImageFilePath(TestDescription test) { return(GetActualImageFilePath(test.Name)); }
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); }
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); }