allure-framework / allure-framework/allure3

[Feature Request]. Add diagrams(mermaid) attachment support

Open
#440 0 comments 6 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
401
Forks
58
Avg merge
2d 20h
Merged PRs (30d)
34

Description

**Is your feature request related to a problem? Please describe.**
The problem with big comprehensive test cases is that they have a lot of dependencies. Sometimes it's better to describe with diagrams, like [mermaid](https://mermaid.js.org/).

**Describe the solution you'd like**
based on [docs](https://allurereport.org/docs/attachments/#visual-comparisons) add a new application type for attachments: E.g. `application/vnd.allure.diagrams.mermaid`.

Or if we transform in code:
```ts
import { test } from '@playwright/test'
import { allure } from 'allure-playwright'

test('some test', async () => {
allure.attachment('some diagram name', `
graph TD
A[Client] -->|tcp_123| B
B(Load Balancer)
B -->|tcp_456| C[Server1]
B -->|tcp_456| D[Server2]
`, 'application/vnd.allure.diagrams.mermaid')
})
```

**Describe alternatives you've considered**
For now, you can create attachments by typing `text/html` with the following content
```html


            graph TD 

A[Client] --> B[Load Balancer]
B --> C[Server1]
B --> D[Server2]


import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
mermaid.initialize({ startOnLoad: true });

```

**Additional context**
1. Why mermaid? Since it provides a lot of kinds of diagrams - pie charts, mindmap, class diagrams, graphs.
2. `application/vnd.allure.diagrams.*` gives a flexible approach for other kind of diagram providers, like [plantUML](https://plantuml.com/)
3. Supporting mermaid will be a good point to support markdown style - like [github](https://github.blog/developer-skills/github/include-diagrams-markdown-files-mermaid/). More on [integrations page](https://mermaid.js.org/ecosystem/integrations-community.html). For now it's not supported in TestOps(screen below)
image

Contributor guide

Open the contributing guide

Research direction

Start with the attachment documentation linked in the request and trace how application types are registered. Confirm the implementation can render Mermaid attachments while preserving the proposed application/vnd.allure.diagrams.mermaid type, and add coverage for the example usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.