Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences between using Nightwatch.js vs Protractor

What are the differences? What are the advantages of using one over the other for an Angular project?

Nightwatch.js vs Protractor

like image 920
Atav32 Avatar asked Dec 04 '14 18:12

Atav32


People also ask

What is Nightwatch js used for?

js, Nightwatch. js is an open-source automated testing framework that aims at providing complete E2E (end to end) solutions to automate testing with Selenium Javascript for web-based applications, browser applications, and websites. Nightwatch.

What is the difference between Protractor and Cypress?

Cypress by default allows only CSS selectors and also using a third party package able to use Xpath as well. Protractor have the in-built libraries to use almost all the selectors and also have the extra type useful to automate Angular Applications.

Is there any other tool used for automation testing other than Nightwatch?

Nightwatch vs Protractor vs Mocha : The Preferred Testing Framework. Amidst many commercial and open-source tools, Selenium is the most widely used open-source tool for automating testing suite for web applications across a range of platforms and browsers.

Is Nightwatch a framework?

Nightwatch. js is an open-source automated testing framework that is powered by Node. js and provides complete E2E (end to end) solutions to automation testing with Selenium Javascript be it for web apps, browser apps, and websites.


2 Answers

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 hand off 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/

like image 20
Kevin S Avatar answered Oct 09 '22 02:10

Kevin S


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)
  • 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
like image 167
alecxe Avatar answered Oct 09 '22 03:10

alecxe