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

Plain text attached to cucumber JSON is shown as junk characters in the multiple cucumber html report #365

Open
vishalkharge opened this issue Aug 16, 2024 · 0 comments
Labels
Milestone

Comments

@vishalkharge
Copy link

Environment (please complete the following information)

  • multiple-cucumber-html-reporter: 3.7.0
  • Node.js version: v16.20.2
  • NPM version: 8.19.4
  • Platform name and version: macOS Sonoma 14.6 (Darwin Kernel Version 23.6.0 RELEASE_ARM64_T6031 arm64)
  • Cucumber version: 9.0.0

Config of multiple-cucumber-html-reporter

{
jsonDir: './dashboard/e2e-tests/multireport/',
reportPath: './dashboard/e2e-tests/multireport/',
reportName: 'Automation Report',
pageTitle: 'Automation Report',
displayDuration: true
}

Describe the bug

Plain text attached to cucumber JSON is shown as junk characters in the multiple cucumber html report

When the plain text is attached to the scenario world object as shown below, multiple cucumber html report shows it as junk characters.

// Reference Code: https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/attachments.md

After(function () {
this.attach('Some text');
});

Screenshot 2024-08-16 at 11 33 25 AM

In the multiple-cucumber-html-reporter library code, if I comment the base64 conversion as shown below, the generated report shows the correct plain text.

../node_modules/multiple-cucumber-html-reporter/lib/generate-report.js

function _parseSteps(scenario) {
scenario.steps.forEach((step) => {
if (step.embeddings !== undefined) {
step.attachments = [];
step.embeddings.forEach((embedding, embeddingIndex) => {
/* Decode Base64 for Text-ish attachements */
if(
embedding.mime_type === 'text/html' ||
embedding.mime_type === 'text/plain'
) {
// embedding.data = Buffer.from(embedding.data.toString(), 'base64'). //-------> Comment this
}

@WasiqB WasiqB added the bug label Sep 11, 2024
@WasiqB WasiqB modified the milestones: v3.8.0, v4.0.0 Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants