What are the differences between using Nightwatch.js vs Protractor
If you are working on an AngularJS project, the choice is simple - Protractor
:
- it is being made specifically for angular apps (though it can be used for non-angular apps also)
- supports angular-specific locator strategies (like
by.model
,by.repeater
etc) - waits for angular to start up during the page load (sync)
- supports angular-specific locator strategies (like
- it is being actively maintained and improved mostly by google developers with a close cooperation with an angular team - this means that protractor follows the angular release cycle and new changes
There are a few more differences that weren't laid out in the top answer.
The big one for me is, as of now, protractor doesn't support phantomJS (http://www.protractortest.org/#/browser-setup#setting-up-phantomjs). I planned on integrating automation in to the CI system, but with protractor I would have to set up a windows VM to run the tests.
Other benefits of nightwatch:
- Asserts are done automatically.
- Clean console output, you could handoff to anyone.
- Test reports are automatically generated and saved to a
/reports
directory.
Protractor pros:
- The angular-specific locators that protractor supports is very powerful and could help immensely with creating stable tests.
- WaitForAngular is also very helpful.
EDIT:Since the time I wrote this comment and present day our team has happily switched over to using cypress.io. If you are deciding test frameworks I highly recommend checking it out: https://www.cypress.io/