Nightwatch Allure Reporter is a custom reporter for nightwatch, which uses allure reporter to generate reports.

Example with Configuration

Step 0: Install Nightwatch

Follow the guide or watch the video to install Nightwatch from scratch.

Step 1: Installing Allure

In order to use Allure reporter you must ensure that Allure CLI is already installed in your machine; if not, follow Allure's installation guide.

Step 2: Installing Nightwatch-Allure-Reporter

Install nightwatch-allure as a dependency in your nightwatch project.

npm i nightwatch-allure --save-dev

Step 3: Update globals

Add the following code to nightwatch's globals.js file. Note: Make sure your globals.js is configured already; if not please follow the setup guide.

const allureReporter = require('nightwatch-allure');
module.exports = {
  reporter: (results,done)=>{
   const reporter = new allureReporter.NightwatchAllureReporter({});

Step 4: Run an example test

Consider the duckDuckGo.js example test :

describe('duckduckgo example', function() {
  it('Search Nightwatch.js and check results', function(browser) {
      .sendKeys('#search_form_input_homepage', ['Nightwatch.js'])
      .assert.textContains('.results--main', 'Nightwatch.js');

You don't need to do anything extra because you've configured the allure reporter to be global. Run the tests as usual:

npx nightwatch examples/tests/duckDuckGo.js --env chrome 

That's it, this will create an allure-results folder in your root directory after you run the tests.

Step 5: Run the allure web server to view the reports

After running the test, make sure the allure-results folder is created at the root level of your directory. Now run the following command to start the allure web server

allure generate ./allure-results --clean && allure open 

Visit the URL provided in the terminal to view the report :