private void RenderExecutionLogAttachmentList(TestStepRun testStepRun) { writer.Write("<div class=\"logAttachmentList\">Attachments: "); for (int i = 0; i < testStepRun.TestLog.Attachments.Count; i++) { AttachmentData attachmentData = testStepRun.TestLog.Attachments[i]; string src = formatter.GetAttachmentFileInfo(testStepRun.Step.Id, attachmentData).FullName; writer.Write("<a href=\""); WriteHtmlEncoded(writer, src); writer.Write("\" class=\"attachmentLink\">"); WriteHtmlEncoded(writer, attachmentData.Name); writer.Write("</a>"); if (i < (testStepRun.TestLog.Attachments.Count - 1)) { writer.Write(", "); } } writer.Write("</div>"); }
public void VisitEmbedTag(EmbedTag tag) { AttachmentData attachment = testStepRun.TestLog.GetAttachment(tag.AttachmentName); if (attachment == null) { return; } string src = formatter.GetAttachmentFileInfo(testStepRun.Step.Id, attachment).FullName; writer.Write("<div class=\"logStreamEmbed\">"); if (attachment.ContentType.StartsWith("image/")) { writer.Write("<a href=\""); writer.Write(src); writer.Write("\" class=\"attachmentLink\">"); writer.Write("<img class=\"embeddedImage\" src=\""); WriteHtmlEncoded(writer, src); writer.Write("\" alt=\"Attachment: "); WriteHtmlEncoded(writer, attachment.Name); writer.Write("\" /></a>"); } else if ((attachment.ContentType.StartsWith("text/html") || attachment.ContentType.StartsWith("text/xhtml")) && attachment.IsText) { writer.Write(attachment.GetText()); } else if (attachment.ContentType.StartsWith("text/") && attachment.IsText) { writer.Write("<pre>"); WriteHtmlEncodedWithBreaks(writer, attachment.GetText()); writer.Write("</pre>"); } else if (flashEnabled && attachment.ContentType.StartsWith(MimeTypes.FlashVideo)) { string placeholderId = "video-" + Hash64.CreateUniqueHash(); writer.Write("<div id=\""); writer.Write(placeholderId); writer.Write("\">"); writer.Write("<script type=\"text/javascript\">"); writer.Write("swfobject.embedSWF('"); WriteHtmlEncoded(writer, new Uri(Path.Combine(formatter.jsDir, "player.swf")).ToString()); writer.Write("', '"); writer.Write(placeholderId); writer.Write("', '400', '300', '9.0.98', '"); WriteHtmlEncoded(writer, new Uri(Path.Combine(formatter.jsDir, "expressInstall.swf")).ToString()); writer.Write("', {file: '"); WriteHtmlEncoded(writer, new Uri(src).ToString()); writer.Write("'}, {allowfullscreen: 'true', allowscriptaccess: 'always'}, {id: '"); writer.Write(placeholderId); writer.Write("'})"); writer.Write("</script>"); writer.Write("</div>"); } else { writer.Write("Attachment: <a href=\""); WriteHtmlEncoded(writer, src); writer.Write("\" class=\"attachmentLink\">"); WriteHtmlEncoded(writer, attachment.Name); writer.Write("</a>"); } writer.Write("</div>"); }