Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text/plain attachments show \n instead of newlines in step view #98

Closed
dawn-minion opened this issue Aug 28, 2019 · 2 comments
Closed

Comments

@dawn-minion
Copy link

dawn-minion commented Aug 28, 2019

Environment (please complete the following information):

  • multiple-cucumber-html-reporter: 1.12.1
  • Node.js version: v12.9.1
  • Yarn version: 1.17.3
  • Platform name and version: Ubuntu 19.04
  • Cucucmber version: 5.1.0

Config of multiple-cucumber-html-reporter

    reporter.generate({
        jsonDir: args.report,
        reportPath: args.output,
        customMetadata: true,
        displayDuration: true
    })

Describe the bug
Plain text attachments show "\n" instead of actual newlines. Example:
demo

To Reproduce
report.json to reproduce the above image:

[
    {
        "keyword": "Feature",
        "name": "Demo Report.json for Bug",
        "line": 1,
        "id": "demo-report.json-for-bug",
        "tags": [],
        "uri": "features/myTest.feature",
        "elements": [
            {
                "id": "demo-report.json-for-bug;we-show-the-bug",
                "keyword": "Scenario",
                "line": 2,
                "name": "We show the bug",
                "type": "scenario",
                "steps": [{
                    "keyword": "Given ",
                    "line": 1,
                    "name": "we make an attachment with newlines",
                    "match": {
                        "location": "features/steps/myTest.js:1"
                    },
                    "result": {
                        "status": "passed"
                    },
                    "embeddings": [
                        {
                            "data": "Some text with newlines\nThe second line\nThe third line",
                            "mime_type": "text/plain"
                        }
                    ]
                }]
            }
        ]
    }
]

Expected behavior
I would expect actual newlines instead of \n - I'm using these attachments to debug steps that interact with files, so having all the file contents on a single line with \n makes it difficult to view them correctly.

Here's how I would expect it to look:
Schermafdruk van 2019-08-28 11-41-13

EDIT: Looking at the code that produces it, it seems this text box is just the result of a JSON.stringify(...) call on the embeddings array. Can we rework this so we show the actual text content instead of JSON data?

@wswebcreation
Copy link
Collaborator

@dawn-minion
Copy link
Author

Thank you @wswebcreation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants