While attempting to capture a screenshot following a failed step:
const { After } = require('cucumber');
After(function (scenario) {
if (scenario.result.status ==='failed') {
var world = this;
return browser.takeScreenshot().then(function(screenShot, error) {
if (!error) {
world.attach(screenShot, "image/png");
}
});
}
});
I encountered an issue with the browser: ReferenceError: browser is not defined