Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<div>
<div class="attachment-row" data-uid="{{uid}}">
<span class="attachment-row__arrow block__arrow">{{angle}}</span>
<div class="attachment-row" data-uid="{{uid}}" data-type="{{type}}">
{{#unless (eq type "application/vnd.allure.playwright-trace")}}
<span class="attachment-row__arrow block__arrow">{{angle}}</span>
{{/unless}}
<div class="attachment-row__icon">
<span class="{{fileicon type}}" data-tooltip="{{type}}"></span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@
</p>
{{/each}}
</div>
{{else if (eq type "playwright-trace")}}
<div class="{{b 'attachment__trace-container' fullscreen=fullScreen}}">
<iframe
id="pw-trace-iframe"
width="100%"
height="100%"
src="https://trace.playwright.dev/next/"
></iframe>
</div>
{{else if (eq type "html")}}
<iframe class="{{b 'attachment__iframe' fullscreen=fullScreen}}" frameborder="0" src="{{sourceUrl}}"></iframe>
{{else}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AttachmentView extends View {
}

onRender() {
if (!this.sourceUrl) {
if (!this.sourceUrl && this.attachmentInfo.type !== "playwright-trace") {
reportDataUrl(`data/attachments/${this.attachment.source}`, this.attachment.type)
.then((sourceUrl) => {
this.sourceUrl = sourceUrl;
Expand All @@ -35,6 +35,29 @@ class AttachmentView extends View {
})
.then(this.render);
}
if (this.attachmentInfo.type === "playwright-trace" && !this.content) {
reportDataUrl(`data/attachments/${this.attachment.source}`, this.attachment.type)
.then((url) => fetch(url))
.then((res) => res.blob())
.then((blob) => {
this.content = blob;
this.sourceUrl = URL.createObjectURL(blob);
})
.then(this.render);
return
}

if (this.attachmentInfo.type === "playwright-trace" && this.content instanceof Blob) {
const iframe = document.getElementById("pw-trace-iframe");
if (iframe && this.content instanceof Blob) {
iframe.onload = () => {
iframe.contentWindow?.postMessage(
{method: "load", params: {trace: this.content}},
"https://trace.playwright.dev/next"
);
};
}
}

if (this.attachmentInfo.type === "custom") {
this.showChildView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,8 @@
height: 85vh;
}
}
&__trace-container {
overflow: hidden;
height: calc(100vh - 96px); //48px header, 48px footer space
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ class TestResultExecutionView extends View {

@on("click .attachment-row")
onAttachmentClick(e) {
if (e.currentTarget.attributes["data-type"].nodeValue=== "application/vnd.allure.playwright-trace") {
return
}
const attachmentUid = $(e.currentTarget).data("uid");
const name = `attachment__${attachmentUid}`;

Expand Down
5 changes: 5 additions & 0 deletions allure-generator/src/main/javascript/utils/attachmentType.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ export default function typeByMime(type) {
type: "archive",
icon: "fa fa-file-archive-o",
};
case "application/vnd.allure.playwright-trace":
return {
type: "playwright-trace",
icon: "fa fa-file-code-o",
};
default:
return {
type: null,
Expand Down
Loading