Overview

You can also selectively target tests to run based on tags, such that a test may be belong to multiple tags. For example, you might have a login test that belongs to a login suite as well as a sanity suite.

The tagging can be accomplished by adding the @tags property to a test module:

module.exports = {
  '@tags': ['login', 'sanity'],
  'demo login test': function (browser) {
     // test code
  }
};

Or, if using the describe interface:

describe('testsuite', function() {
  this.tags = ['login', 'sanity'];
  
it('demo login test', function(browser) {
}); });

Run tagged tests

To select which tags to run, use the --tag command line flag:

nightwatch --tag login

Specify multiple tags as:
nightwatch --tag login --tag something_else

Skip tagged tests

To skip running tests with a specific tag, use the --skiptags flag:

nightwatch --skiptags login

Or to skip multiple tags, add each tag you want to skip as comma-separated:
nightwatch --skiptags login,something_else