public string PersistErrorScreenshot(byte[] image, string screenshotName) { base.Persist(image, screenshotName); var screenshotPath = GetScreenshotPath(screenshotName); if (ciAdapter.IsAvailable()) { return(ciAdapter.UploadFileAsArtifact(screenshotPath)); } return(screenshotPath); }
private void AppendEntryToReport(Exception exception, string url, StackTrace reportingStacktrace, string imagePath = "") { CreateReportIfNotExists(); var reportContent = File.ReadAllText(ReportFilePath); var exceptionDescription = GetFullExceptionDescription(exception, reportingStacktrace); var newEntry = $"<figure><image src=\"{imagePath}\"/><figcaption><p>Error or page <a href=\"{url}\">{url}</a><br/>Reported on <b>{DateTime.Now:G}</b></p><pre>{exceptionDescription}</pre></figcaption></figure>"; var newReportContent = reportContent.Replace(ImagePlaceholder, newEntry + ImagePlaceholder); File.WriteAllText(ReportFilePath, newReportContent); if (ciAdapter.IsAvailable()) { ciAdapter.UploadFileAsArtifact(ReportFilePath); } }
private void AppendImageToReport(string imagePath, string description) { CreateReportIfNotExists(); var reportContent = File.ReadAllText(ReportFilePath); var newEntry = $"<figure><image src=\"{imagePath}\"/><figcaption><pre>{description}</pre></figcaption></figure>"; var newReportContent = reportContent.Replace(ImagePlaceholder, newEntry + ImagePlaceholder); File.WriteAllText(ReportFilePath, newReportContent); if (ciAdapter.IsAvailable()) { ciAdapter.UploadFileAsArtifact(ReportFilePath); } }