Reputation: 393
I want to attach the screenshot of failed step in html report for my BDD tests in cypress.
I am using "multiple-cucumber-html-reporter" and I am able to generate a BDD report of all test cases.
Below is my .js file that generates the html report:
const report = require("multiple-cucumber-html-reporter");
report.generate({
jsonDir: "cypress/reports", // ** Path of .json file **//
reportPath: "./cypress/reports/cucumber-htmlreport.html",
metadata: {
browser: {
name: "chrome",
version: "81",
},
device: "Local test machine",
platform: {
name: "mac",
version: "Catalina",
},
},
});
I understand that in cypress's plugin for BDD html report we cannot work with scenario object as we used to do in cucumber.
How do I add code for taking screenshots here ?
Upvotes: 0
Views: 1870
Reputation: 140
Cypress itself takes the screenshot of failed scenarios automatically. There should be no problem with taking the screenshots. see: documentation But if you mean to attach the SS into html report, I suggest you to switch to Allure reporting tool for Cypress. see the detailed info and report here: allure reports
Upvotes: 1