-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
Decode base64-encoded Text Attachments #308
Conversation
Hi @mschluer , Thanks for opening the PR. Kindly look into the test failure, once that's fixed, we are good to merge. |
It should work now, yet I would recommend to adjust the test data sooner or later |
@mschluer hi, with the latest update I see the issue when there is an embeddings with "text/plain" mime type, in the cucumber html report there is base64 mess. Is there a way to fix that e.g. through configuration |
Hey, With Cucumber 10 they decided to base64 encode text as well - unlike what they themselves state in their specification. Frankly, I did not yet fully understand their decision. Reference: "Ensure attached string literals are base64-encoded in JSON reports (cucumber/cucumber-js#2260)" https://github.com/cucumber/cucumber-js/releases/tag/v10.0.0 |
@mschluer I use latest "wdio-cucumberjs-json-reporter" seems like this lib has no support of the change. So i need to convert any attach to base64 I assume and\or wait for the lib to support this. I've tested this and seems everything works fine now |
@WasiqB Sorry for being annoying. Seems like there is an issue when attaching "application/json" data type. I notice that this statement is never be true so the JSON will not be parsed and that's why the result is not JSON: If to revert this statement or remove, then the JSON is properly parsed: Am i doing something wrong or there is an issue and the statement must be removed\reverted |
@WasiqB Hello. Any suggestion on the topic above? Appreciate it. |
Since Cucumber 10, all Text Attachments are as well Base64 encoded, which currently makes them unreadable in the HTML-Reports.
This fix was created by @lerhum and @WasiqB.
As my customer needs this piece of code, I fixed the findings as described.
All Credits go the the creators, I just want to help speeden up things :)
Original Text
linked to #298
Describe the bug
In the JSON formatter output of multiple-cucumber-html-reporter, all attachments, including those initially attached as plain text strings, are now Base64 encoded. This uniform encoding approach leads to ambiguity for consumers of the report, as they cannot distinguish whether an attachment was originally a plain text string or a different file format.
To Reproduce
Steps to reproduce the behavior:
just generate a report based on cucumber 10.0.1 with some attachement (json/ text / image)
Expected behavior
The expected behavior was that string attachments would remain as plain text in the JSON formatter output, while other types of attachments would be Base64 encoded. This distinction would enable consumers to easily identify the nature of the attachments without additional processing.
Additional context
To resolve this issue, a decoding mechanism such as atob(embedding.data); should be implemented to correctly decode Base64 attachments before passing them to the report. This would ensure that plain text attachments maintain their original format in the JSON output.