From 732ba1eb1aa6a5155f58dd47f1135694c9df88c7 Mon Sep 17 00:00:00 2001 From: Marc Taipala Date: Sat, 7 Sep 2024 12:25:26 -0400 Subject: [PATCH] Create in report support for webm video in the report output (#369) A small PR to add video attachment support (webm) similar to the way image (png) is supported. This is change is primarily to support Playwright's video functionality. See documentation: https://playwright.dev/docs/videos Co-authored-by: MarcTaipala --- lib/generate-report.js | 9 +++++++++ templates/components/scenarios.tmpl | 18 ++++++++++++++++-- templates/style.css | 7 +++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/lib/generate-report.js b/lib/generate-report.js index 4c395ca9..f05fadfe 100755 --- a/lib/generate-report.js +++ b/lib/generate-report.js @@ -445,6 +445,14 @@ function generateReport(options) { 'data:image/png;base64,' + embedding.data, ]); step.embeddings[embeddingIndex] = {}; + } else if ( + embedding.mime_type === 'video/webm' || + (embedding.media && embedding.media.type === 'video/webm') + ) { + step.video = (step.video ? step.video : []).concat([ + 'data:video/webm;base64,' + embedding.data, + ]); + step.embeddings[embeddingIndex] = {}; } else { let embeddingType = 'text/plain'; if (embedding.mime_type) { @@ -479,6 +487,7 @@ function generateReport(options) { (step.hidden && !step.text && !step.image && + !step.video && _.size(step.attachments) === 0 && step.result.status !== RESULT_STATUS.failed) ) { diff --git a/templates/components/scenarios.tmpl b/templates/components/scenarios.tmpl index f5b8f709..aa8ad518 100755 --- a/templates/components/scenarios.tmpl +++ b/templates/components/scenarios.tmpl @@ -74,7 +74,7 @@