public void Run(ConfigurationParameters config, List <SitecoreItem> sitecoreItems) { string screenShotsFolder = CreateScreenShotDirectory(); var checker = new WebDriverPageChecker(screenShotsFolder); FileStream outputFile = CreateOutputFile(OutputFilename); StreamWriter writer = new StreamWriter(outputFile); int index = 0; foreach (SitecoreItem sitecoreItem in sitecoreItems) { if (index == 0) { writer.WriteLine("Full URL,Success?,Item path"); } PageCheckResult result = checker.PageResponseValid(config.BaseUrl, sitecoreItem); writer.WriteLine($"{config.BaseUrl}{sitecoreItem.ExternalUrl},{result?.Success},{sitecoreItem.ItemPath}"); index++; } checker.Close(); writer.Flush(); writer.Close(); }
public void Return_Problem_When_One_Problem_Added() { var result = new PageCheckResult(); result.AddIssue(BadPostProblem); Target.AddPageCheckResult(result); Target.ProblemsToCsv().ShouldContain(BadPostProblem); }
public void Return_Url_Comma_Problem_Comma_Problem_When_Two_Problems_Are_Added_For_A_Url() { var result = new PageCheckResult(); result.AddIssue(BadPostProblem); result.AddIssue(OutdatedProblem); Target.AddPageCheckResult(result); Target.ProblemsToCsv().ShouldContain($"{BadPostProblem},{OutdatedProblem}"); }
public void Add_Quotations_To_The_Title_Fields_In_Case_Of_Commas() { const string title = "A Man, A Plan, A Canal, Panama"; const string url = "https://www.somesitem.com"; var result = new PageCheckResult() { PageUrl = url, PageTitle = title }; result.AddIssue("Oops!"); Target.AddPageCheckResult(result); Target.ProblemsToCsv().ShouldContain($"\"{title}\""); }
public void Add_A_New_Line_For_A_Second_Problem() { var firstResult = new PageCheckResult() { PageUrl = FirstUrl, PageTitle = "Some Page" }; firstResult.AddIssue(BadPostProblem); var secondResult = new PageCheckResult() { PageUrl = SecondUrl, PageTitle = "Another Page" }; secondResult.AddIssue(OutdatedProblem); Target.AddPageCheckResult(firstResult); Target.AddPageCheckResult(secondResult); Target.ProblemsToCsv().ShouldContain($"{Environment.NewLine}{SecondUrl}"); }
public PageCheckViewModel(PageCheckResult pr) { _pageCheckResult = pr; }