I'm using mochawesome report to capture my cypress execution. The test case shows simply pass and didn't find the steps that it gone through and assertion that is added as part of that test in the report.
Sample snapshot (Sorry for too many strike):
I'm very new to cypress and mocha world, and I would like to see all the action that has been done in that test. Like I can see very clear details in the cypress.open. How can I get all the such information as part of mochawesome report? Is there any centralized (support/index.js or plugin/index.js file) place to make this changes that will replicate everywhere in the program.
Expected:
Expected all the Actions should be captured as part of mochawesome report as like below sample:
It contains click() action status and submit action status in the report for that test case. and type() failed so that it will be very easy to debug the failures.
In the mochawesome report, each it
block becomes one line of the report and you can put additional reporting using addConext as below (source: mochawesome documentation)
const addContext = require('mochawesome/addContext');
describe('test suite', function () {
it('should add context', function () {
// context can be a simple string
addContext(this, 'simple string');
// context can be an image url and the report will show it inline
addContext(this, 'http://www.url.com/screenshot-maybe.jpg');
});
});
But if you really want to generate the report as you have attached then you need to break each action into a test i.e. it
block. Below is the sample code that can be used.
describe("Test suite",function(){
const cy = "";//put your code to initialize cy
it("Action 1", function(){
//code to perform action
});
it("Action21", function(){
//code to perform action2
})
})