webdriverio-community/wdio-cucumberjs-json-reporter

Cucumber v10+ attaches text/plain and application/json in base64 encoded format

HannaTarasevich opened this issue · 0 comments

Environment (please complete the following information):

  • Node.js version: 20.11.0
  • NPM version: 10.2.5
  • webdriver.io version: latest
  • @wdio/cucumber-framework version: latest
  • wdio-cucumberjs-json-reporter version: latest

Config of webdriver.io and the reporter
reporters: ['spec','dot', [ 'cucumberjs-json', {
jsonFolder: './reports/json-output-folder',
language: 'en',
}]],

Describe the bug
All text/plain and application/json attachments are encoded in a base64 string format starting from @cucumber/cucumber v10 (cucumber/cucumber-js#2260). This means that the reporters, such as multiple-cucumber-html-reporter (https://github.com/WasiqB/multiple-cucumber-html-reporter/releases/tag/v3.6.1), which use generated JSON files for creating reports, are trying to decode all such attachments. On the other hand, WDIO JSON reporter generates text/plain and application/json attachments as plain text. This means that attachments in text/plain and application/json formats are decoded from plain text.

To Reproduce

  1. clone https://github.com/HannaTarasevich/multiple-reporter-issue
  2. npm install
  3. npm run wdio
  4. check generated json files (reports > json)
  5. open reports > report > index.html and check attached data to the scenario's step
    image

Expected behavior

The suggestion is to unify the @cucumber/cucumber JSON reporting approach with wdio-cucumberjs-json-reporter, as it was before cucumber-js v10, and encode text/plain and application/json to base64 string.

Additional context
It could be a breaking change for the cases when generated json reports are using with the reporters that are not updated according to the latest cucumber-js changes or when the generated json files are the using for the custom reports.