-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Migrating to Nightwatch 1.0
Adrián Garrido edited this page Jan 16, 2019
·
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.
When using a remote Selenium server (or when selenium server is not managed by nightwatch) or a cloud testing service (such as BrowserStack), the selenium_host
/ selenium_port
properties need to be set accordingly, like below:
"test_settings" : {
"default" : {
"selenium_host": "hub-cloud.browserstack.com",
"selenium_port": 80
}
}
Another option is to set the default_path_prefix
to /wd/hub
.
{
webdriver: {
default_path_prefix: '/wd/hub'
}
}
See also http://nightwatchjs.org/gettingstarted#test-settings.
- removed
this.client
from after/afterEach hooks - use theclient
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) {}
orafterEach(client) {}
; - this.results and this.errors no longer passed to afterEach - use
client.currentTest.results
;
- 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
- consolidated the testSuite key on the
results
object passed to a globalreporter
- it is now containing the subfolders relative to the path(s) specified as thesrc_folders
property.
- behaviour of
filter
andexclude
properties has changed; if both are specified,exclude
is now applied on the matches fromfilter
.
- behaviour of custom commands called with page object selectors (ie.
@mySelector
) has changed; before you would receive a string with the selector, now you will receive an object. For more info check issue #1237
- 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
APIs:
- dismiss_alert
- accept_alert
- window_handle
- window_handles: replaced by windowHandles
- execute_async
Test Hooks:
- setUp/tearDown hooks no longer work - use beforeEach/afterEach
Grunt
- support for grunt, i.e.
Nightwatch.initGrunt
, has been removed