0

I need to perform end to end test for Node.js front end Application developed using AngularJs 4. Currently we are using Mocha framework for Nodejs Rest API services. Can we use Mocha framework for testing Node.js front end Application developed using AngularJs 4??

Aman
  • 1
  • 3

1 Answers1

0

You can use Protractor as the e2e testing framework for testing the UI of the nodejs application. Be default, Protractor uses jasmine but it allows you to use mocha as the framework of choice, for your tests. It's pretty easy and straightforward to set up.

I suggest Protractor because it has built in synchronization and locators specific to Angular, which gives a lot of flexibility. You can also use Nightwatch and WebDriverio as well, but not sure if they'll let you keep mocha as framework.

You can combine Protractor, mocha and use chai as the assertion framework for the end to end tests, and also include Cucumber JS if you're looking for a BDD testing suite.

Example : I created this demo repository a while ago. It combines Protractor, TypeScript, CucumberJS and Mocha with Chai as assertion framework. This is based on this fantastic framework by Ram Pasala

demouser123
  • 4,108
  • 9
  • 50
  • 82
  • If possible, can you provide a link with an example of combining Protractor, mocha and using chai. It would be helpful – Aman Mar 21 '18 at 12:07