From 7c146926ac2db561ffc915171b971ff37718ae6c Mon Sep 17 00:00:00 2001 From: davidjgoss Date: Fri, 2 Aug 2024 15:18:19 -0400 Subject: [PATCH] Support text/uri-list attachments (#355) Special support for attachments with MIME type text/uri-list, to render as hyperlinks that open in a new tab. See cucumber/common#2191 --- CHANGELOG.md | 2 + README.md | 11 + package-lock.json | 299 +++++++++++------- package.json | 10 +- src/components/customise/customRendering.tsx | 2 +- .../gherkin/attachment/Attachment.module.scss | 18 ++ .../gherkin/attachment/Attachment.spec.tsx | 37 +++ .../gherkin/attachment/Attachment.stories.tsx | 20 ++ .../gherkin/attachment/Attachment.tsx | 3 + src/components/gherkin/attachment/Links.tsx | 31 ++ 10 files changed, 306 insertions(+), 127 deletions(-) create mode 100644 src/components/gherkin/attachment/Links.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index 97d390c2..66e9afbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Added +- Support text/uri-list attachments ([#355](https://github.com/cucumber/react-components/pull/355)) ## [22.2.0] - 2024-06-21 ### Added diff --git a/README.md b/README.md index 4760115b..4137e551 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,17 @@ This is fine for simple use cases where results are not important. To render a `` with results and highlighted [Cucumber Expression parameters](https://cucumber.io/docs/cucumber/cucumber-expressions/) parameters it must be nested inside a [``](src/components/app/Wrapper.tsx) component. +## Attachments + +Attachments from test runs are shown with their corresponding steps. The baseline behaviour for attachments is a download button. However, we have some special handling for very common MIME types to make them more useful without leaving the report: + +- `image/*` - images are rendered with an `` tag +- `video/*` - videos are rendered with a `