Testing user registration

Let's use the setup built in the previous sections and write an actual test. Let's say that we want to make sure that our registering page works. The following are the two processes that we want to capture with our test:

  • Filling the form with wrong data and making sure that the application shows an error message
  • Filling the form with correct data and seeing a successful message

We are going to use PhantomJS as our headless (virtual) browser. So, all we have to do is load our registration page and simulate user interactions, such as typing in the fields and pressing the buttons.

Simulating user interaction

There are a couple of issues that we are going to resolve. The first one is the actual simulation of user actions. From ...

Get Node.js By Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.