From 71e4d193967fc96a07e2a009efc93be1320ba2cc Mon Sep 17 00:00:00 2001 From: Priyansh Garg Date: Tue, 6 Aug 2024 23:56:56 +0530 Subject: [PATCH] Add cucumber.conf.js --- cucumber.conf.js | 9 +++++++++ nightwatch.conf.js | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 cucumber.conf.js 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'] } },