In my mochawesome-report addContext()
is keeping previous count and adding it to each 'it' scenario, in case of a test case failure, I'm adding 'someValue' as context to the test case. So if 2nd test case fails then value is getting printed twice.
Following is the snapshot:
Following is my afterEach()
method :
afterEach(function () {
if (this.currentTest.state === 'failed') {
var test = this.currentTest
Cypress.on('test:after:run', (test) => {
addContext({ test }, {
title: 'Failing Screenshot: ' + '>> screenshots/' + Cypress.spec.name + '/' + test_name + ' -- ' + test.title + ' (failed)' + '.png <<',
value: 'screenshots/' + Cypress.spec.name + '/' + test_name + ' -- ' + test.title + ' (failed)' + '.png'
//value: 'data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAA+gAAABkCAYAAAAVORraAAACH0lEQVR'
})
});
}
})