cypress-mochawesome-reporter
cypress-mochawesome-reporter copied to clipboard
Failed screenshots not getting attached to html report
Environment
- OS: Mac
- Node: v18.16.1
- cypress-mochawesome-reporter: "^3.6.1"
- cypress: "^12.16.0"
What happened?
According to the documentation if a test fails , cypress-mochawesome-reporter it should take screenshot and attach it to html report. But actual behaviour is , its taking screenshot and saving it inside a folder.
Config file
const { defineConfig } = require("cypress");
// Create a timestamp
const currentDate = new Date().toLocaleString('en-US', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false,
timeZoneName: 'short',
}).replace(/[,/:]/g, '-');
module.exports = defineConfig({
pageLoadTimeout: 300000,
modifyObstructiveCode: false,
responseTimeout: 10000,
requestTimeout: 10000,
defaultCommandTimeout: 20000,
failOnStatusCode: false,
experimentalSourceRewriting: true,
experimentalCspAllowList: true,
reporter: 'cypress-mochawesome-reporter',
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
require('cypress-mochawesome-reporter/plugin')(on);
},
supportFile: "cypress/support/B2B_Common_Intercepts.js",
baseUrl: "http://10.88.35.162", //We can't use "http://tf101webappstg" failed DNS lookup
},
video: false,
});
Relevant log output
No error as such
Anything else?
No response
reporterOptions: {
charts: true,
reportPageTitle: 'Test Report',
embeddedScreenshots: true,
inlineAssets: true,
saveAllAttempts: false
},
I used this and it work properly.
Please create a repo with the problem and steps to reproduce the issue so I can have a look.
Thanks.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
I was having the same issue.
Have you added import 'cypress-mochawesome-reporter/register';
to the cypress/support/e2e.js file?
I am also getting the same error. I will create a repo and will push from my personal account. But what I did was write a failed test with following steps:
- Open terminal in new folder.
-
npm init -y
-
npm install cypress --save-dev
-
npm i --save-dev cypress-mochawesome-reporter
- in cypress/support/e2e/js, I added
import 'cypress-mochawesome-reporter/register';
- I did not add
require('cypress-mochawesome-reporter/plugin')(on);
, as it gives error in console fornpx cypress run
- in cypress.config.js, I added
const { defineConfig } = require("cypress");
module.exports = defineConfig({
reporter: 'cypress-mochawesome-reporter',
reporterOptions: {
charts: true,
reportPageTitle: 'custom-title',
embeddedScreenshots: true,
inlineAssets: true,
saveAllAttempts: false,
},
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.