Chapter 6. Testing a UI Using WebDriverJS

In this chapter, we will look into an advanced concept: how to test a user interface. For this purpose, you will learn the following topics:

  • Using WebDriverJS to manipulate a browser and inspect the resulting HTML generated by our UI
  • Organizing our UI codebase to make it easily testable
  • The right abstraction level for our UI tests
  • Testing modern, rich Internet applications

Our strategy for UI testing

There are two traditional strategies towards approaching the problem of UI testing: record-and-replay tools and end-to-end testing.

The first approach, record-and-replay, leverages the use of tools capable of recording user activity in the UI and saves this into a script file. This script file can be later executed ...

Get Learning Behavior-driven Development with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.