webdriverio-community / wdio-cucumberjs-json-reporter

A WDIO reporter that creates CucumberJS JSON files for WebdriverIO
https://webdriver.io/docs/wdio-cucumberjs-json-reporter
MIT License
24 stars 32 forks source link

Screenshot not getting attached to cucumber-html report #500

Open Sweetie7 opened 7 months ago

Sweetie7 commented 7 months ago

Describe your question with as much detail as possible A clear and concise question that doesn't require too much conversation. Need more help? Find us on Discord

If it's about a specific piece of code, try and include some of it to support your question. [...]

Environment (please complete the following information):

Additional context Add any other context about the problem here.

Sweetie7 commented 7 months ago

Node.js version: [21.7.3] NPM version: [10.5.0] webdriver.io version: [8.35.1] @wdio/cucumber-framework version: [8.35.0] wdio-cucumberjs-json-reporter version: [5.2.1] multiple-cucumber-html-reporter: [3.6.2],

I have configured in my webdriverio framework to create json file using wdio-cucumberjs-json-reporter, and then I am creating using the same json file html report using multiple-cucumber-html-reporter. I have added in Steps to capture screenshot using browser.saveScreenshot(), but this screenshots are not getting attached to html report.

Sweetie7 commented 7 months ago

I have added below lines in wdio.conf.js file. image

image

I have a this step in StepDef where I am taking screenshot. image

But when the report is generated, screenshot is not available with the step.

christian-bromann commented 7 months ago

@Sweetie7 thanks for reporting! Any contributions are appreciated.

HannaTarasevich commented 1 day ago

Hi @Sweetie7, Please try to use this one instead of browser.saveScreenshot:

import cucumberJson from 'wdio-cucumberjs-json-reporter';

cucumberJson.attach(await browser.takeScreenshot(), 'image/png');