diff --git a/.github/workflows/build-node.yaml b/.github/workflows/build-node.yaml index 3c9407f..62cad34 100644 --- a/.github/workflows/build-node.yaml +++ b/.github/workflows/build-node.yaml @@ -22,4 +22,4 @@ jobs: node-version: ${{ matrix.node-version }} - run: npm ci - run: npm run eslint - - run: npm test -- --env chrome --headless + - run: npm test -- --env chrome --headless --tags "not @duckduckgo" diff --git a/cucumber.conf.js b/cucumber.conf.js new file mode 100644 index 0000000..1b47dc5 --- /dev/null +++ b/cucumber.conf.js @@ -0,0 +1,13 @@ +const {AfterStep} = require('@cucumber/cucumber'); + +AfterStep(async function(testCase) { + // take screenshot on test case failure. + // + // follow this Discord thread for integrating the screenshots into your Cucumber report: + // https://discord.com/channels/618399631038218240/1253341054921609306/1255939897047515250 + // + if (testCase.result.status === 'FAILED' && this.browser) { + await this.browser.saveScreenshot(`screenshots/${testCase.pickle.name}.png`); + } +}); + diff --git a/nightwatch.conf.js b/nightwatch.conf.js index 070a208..6abea1f 100644 --- a/nightwatch.conf.js +++ b/nightwatch.conf.js @@ -32,7 +32,8 @@ module.exports = { options: { feature_path: 'tests/features/*.feature', additional_config: '', - parallel: 2 + parallel: 2, + require: ['./cucumber.conf.js'] } }, diff --git a/package.json b/package.json index ed3dd9f..ba6575b 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "test": "test" }, "scripts": { - "test": "nightwatch", + "test": "nightwatch --env chrome --tags 'not @duckduckgo'", "eslint": "eslint src/specs --quiet" }, "repository": { diff --git a/tests/features/githubSearch.feature b/tests/features/githubSearch.feature index c4382bf..f5c9c10 100644 --- a/tests/features/githubSearch.feature +++ b/tests/features/githubSearch.feature @@ -6,7 +6,7 @@ Feature: Github test Scenario: open URL Given I open the url "https://github.com/" Then I expect the url to contain "github.com" - And I expect that the title is GitHub: Let’s build from here · GitHub" + And I expect that the title is "GitHub: Let’s build from here · GitHub" @githubSearch Scenario: search for nightwatch repository