
Getting started with NightwatchJS
I've been looking at newer browser automation frameworks that might also be written in NodeJS and Nightwatch was a match.
I've been looking at newer browser automation frameworks that might also be written in NodeJS and Nightwatch was a match. So far I've found NightwatchJS to be very quick to get up and running.
NightwatchJS offers built in, easy to use, support for the page object model.
I am a big fan of using the page object model and their use of basically a JSON object to hold the page elements with their selectors seems very organized and natural to me. Below is an example I used for automating a quick test for the Google home page.
Page object model example:
module.exports = {
url: 'http://www.google.com',
elements: {
searchBar: {
selector: 'input[type=text]'
},
submit: {
selector: 'input[name=btnK]'
}
}
}
Nightwatch example test starter on my GitHub
I go through the Nightwatch installation and creation of my first test in the NightwatchJS tutorial below.