Skip to content

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

@vishalkharge

Description

@vishalkharge

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions