diff --git a/cucumber.conf.js b/cucumber.conf.js new file mode 100644 index 0000000..e431dbf --- /dev/null +++ b/cucumber.conf.js @@ -0,0 +1,9 @@ +const {AfterStep} = require('@cucumber/cucumber'); + +AfterStep(async function(testStep) { + // take screenshot on failure after each step + if (testStep.result.status === 'FAILED' && this.browser) { + await this.browser.saveScreenshot('failure-screenshot.png'); + } +}); + diff --git a/nightwatch.conf.js b/nightwatch.conf.js index 60e25a1..036e999 100644 --- a/nightwatch.conf.js +++ b/nightwatch.conf.js @@ -33,7 +33,8 @@ module.exports = { options: { feature_path: 'tests/features/*.feature', additional_config: '', - parallel: 2 + parallel: 2, + require: ['./cucumber.conf.js'] } },