Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack
MIT License
Bot releases are hidden (Show)
Published by beatfactor over 2 years ago
global
package to fix an issue on windowsPublished by beatfactor over 2 years ago
This release only contains a few dependency updates, such as the ejs
package and the cucumber
peer dependency version which was causing issues in newer version of NPM.
Published by beatfactor over 2 years ago
sendKeys
command (#3045)Published by beatfactor over 2 years ago
Published by beatfactor over 2 years ago
ejs
to avoid a high severity vulnerabilityPublished by beatfactor over 2 years ago
The Nightwatch 2.1 release adds a few important fixes and several improvements, including upgrade to Selenium 4.1.1. Here's the full list:
describe('sample with relative locators', function () {
before(browser => browser.navigateTo('https://archive.org/account/login'));
it('locates password input', function (browser) {
const passwordElement = locateWith(By.tagName('input')).below(By.css('input[type=email]'));
browser
.waitForElementVisible(passwordElement)
.expect.element(passwordElement).to.be.an('input');
browser.expect.element(passwordElement).attribute('type').equal('password');
});
});
.setNetworkConditions()
command (#2996)browser.setNetworkConditions({
offline: false,
latency: 5, // Additional latency (ms).
download_throughput: 500 * 1024, // Maximal aggregated download throughput.
upload_throughput: 500 * 1024 // Maximal aggregated upload throughput.
});
.registerBasicAuth()
command (Chrome/Edge) (#3116)browser
.registerBasicAuth('test-username', 'test-password')
.navigateTo('http://browserspy.dk/password-ok.php');
setValue
commandPublished by beatfactor over 2 years ago
Fixed an issue occurring when using the Mocha integrated test runner and a test failure was logged in an async
testcases.
Published by beatfactor over 2 years ago
Published by beatfactor over 2 years ago
This releases adds a few important fixes and improvements. We have made sure that Nightwatch works very well when using the Selenium 4 server in standalone mode and we've added several improvements and fixes for when using Mocha as a test runner.
Users of Selenium Server can now install our own jar download library from NPM and then use it in Nightwatch with no other config necessary. Make sure that chromedriver
or geckodriver
are also installed from NPM. You can install the Selenium Server with:
npm i @nightwatch/selenium-server
--parallel=<number of workers>
Published by beatfactor over 2 years ago
Published by beatfactor over 2 years ago
Published by beatfactor over 2 years ago
Published by beatfactor over 2 years ago
expect.element().an()
to accept case-insensitive tag names and regular expressions (efb6f109fb6475ef032359b04fb19b49940762ae)Published by beatfactor over 2 years ago
The public NPM release of Nightwatch 2.0 is here and can be installed directly with:
npm i nightwatch --save-dev
Over the past few weeks we have worked tirelessly to finalise the apis, add a few more examples, and try and smooth over any rough edges.
nightwatch.conf.cjs
as config file for projects that use ES Modules
chai expect
to version 5 and added support for using regular chai browser.expect()
assertions; this doesn't affect the existing expect.element()
, expect.elements()
, expect.cookie()
, expect.title()
, and expect.url()
.
const infoElement = element('.info');
expect(infoElement.property('innerHTML'))
.to.be.a('string')
.and.to.include('validation code');
See examples/tests/shadowRootExample.js for the complete example.--devtools
CLI flag to open the Chrome Devtools automaticallyPublished by beatfactor almost 3 years ago
Published by beatfactor almost 3 years ago
Published by beatfactor almost 3 years ago
We're delighted to present the first beta version of Nightwatch v2.0! Upcoming beta releases will incrementally be made available in NPM under the next tag, so in order to install it you'll have to run the following:
npm i nightwatch@next
Over the coming weeks we will also finish updating the documentation website with more pages in the Guide section and documenting the new APIs.
Since the previous alpha release we have only added a few improvements and several fixes. The fixes are mainly concerning working with the new element()
api and using cucumber-js.
src_folders
, page_object_path
, custom_commands_path
, custom_assertion_path
options – #2910;webdriver.log_file_name
setting to specify the filename where webdriver server logs should be written – 127760130341328010b9001598812916ace92363.click()
, e.g.:// with async
const elements = await browser.findElements('input');
await browser.click(elements[1]);
// with callback
browser.findElements('input', function(result) {
browser.click(result.value[1]);
});
getAttribute
command to use the W3C endpoint instead of the Selenium atom script - #2926;suiteRetries
– 127760130341328010b9001598812916ace92363We've also updated the bundled examples so do make sure to check those out in order to get a better feel about the new Nightwatch 2 features.
element()
global apiYou can run any of the examples by simply referring to the examples folder like below:
npx nightwatch examples/tests/angularTest.js
The bundled config file which is auto-generated by Nightwatch on the first run (only if one is not already present in the project), contains configuration and examples for running the CucumberJS examples immediately, using the following:
npx nightwatch --env cucumber-js
Published by beatfactor about 3 years ago
enable_fail_fast
setting and --fail-fast
cli argument to abort the test runner after a failed test suiteBelow are notable changes from the previous alpha version (2.0.0-alpha.3):
creatClient()
external method for programmatic usage; the new client now contains the following methods:
.launchBrowser()
)const Nightwatch = require('nightwatch');
const client = Nightwatch.createClient({
browserName: 'firefox',
headless: true
});
client.updateCapabilities({
testCapability: 'one, two, three'
});
const browser = await client.launchBrowser();
browser
object available as a globaldisable_colors
settingPublished by beatfactor about 3 years ago
const Nightwatch = require('nightwatch');
const client = Nightwatch.createClient({
headless: true,
output: true,
silent: true, // set to false to enable verbose logging
browserName: 'firefox', // can be either: firefox, chrome, safari, or edge
timeout: 10000, // set the global timeout to be used with waitFor commands and when retrying assertions/expects
env: null, // set the current test environment from the nightwatch config
desiredCapabilities: {
// any additional capabilities needed
},
globals: {}, // can define/overwrite test globals here; when using a third-party test runner only the global hooks onBrowserNavigate/onBrowserQuit are supported
parallel: false, // when the test runner used supports running tests in parallel; set to true if you need the webdriver port to be randomly generated
// All other settings can be overwritten here, such as:
disable_colors: false
});
const browser = await client.session();
Updated the bundled Mocha test runner to use Mocha v9 and added other features supported by the default nightwatch test runner (such as using test tags, global hooks etc.); pending Mocha v9.1.3 which contains https://github.com/mochajs/mocha/issues/4760
New API commands:
browser.navigateTo(url, [callback])
- navigates to a new url. Accepts also relative urls if launchUrl
is defined in the config and will execute onBrowserNavigate
global hook after the url is loaded.
browser.getCurrentUrl([callback])
browser.quit([callback])
- ends the session and closes down the test WebDriver server, if one is running. This is similar to calling the .end()
command, but the former doesn't quit the WebDriver session. It also executes the onBrowserQuit
global hook before ending the session.
browser.setAttribute([using], selector, property, [callback])
- set the value of a specified DOM attribute for the given element.
moveToElement
and moveTo
api commandsPublished by beatfactor about 3 years ago
proxy-agent
dependency package to the latest version.