Skip to content

Migrating to Nightwatch 1.0

Andrei Rusu edited this page Apr 24, 2018 · 8 revisions

Below is a list of potentially breaking changes in version 1.0 and deprecated functionality which was removed. All attempts have been made to ensure a complete and accurate list, but there might be things which we overlooked.

Test Hooks

  • removed this.client from after/afterEach hooks - use the client argument
  • after/afterEach currentTest.name is the name of the last test (it used to be null in after()).
  • in order not to break compatibility with early versions, afterEach hook used to accept the done callback parameter, if passed just one argument (i.e. afterEach(done) {}; that is no longer the case from 1.0, current behaviour is either: afterEach(client, done) {} or afterEach(client) {};
  • this.results and this.errors no longer passed to afterEach - use client.currentTest.results;

Global Hooks

  • global beforeEach hooks used to contain a client.currentTest.results object with initial values; now the .results object is not present anymore inside the beforeEach hooks

Global Reporter

  • consolidated the testSuite key on the results object passed to a global reporter - it is now containing the subfolders relative to the path(s) specified as the src_folders property.

Folder/File Name Filtering

  • behaviour of filter and exclude properties has changed; if both are specified, exclude is now applied on the matches from filter.

Deprecated

nightwatch.json

  • selenium_host -> use webdriver.webdriver_host
  • selenium_port -> use webdriver.webdriver_port
  • use_ssl -> use webdriver.ssl
  • proxy -> use webdriver.proxy
  • request_timeout_options -> use webdriver.timeout_options
  • default_path_prefix -> use webdriver.default_path_prefix
  • username -> use webdriver.username
  • access_key -> use webdriver.access_key
  • password -> use webdriver.access_key

Removed deprecated:

APIs:

  • dismiss_alert
  • accept_alert
  • window_handle
  • window_handles
  • execute_async

Test Hooks:

  • setUp/tearDown hooks no longer work - use beforeEach/afterEach

Grunt

  • support for grunt, i.e. Nightwatch.initGrunt, has been removed