Chapter 6: Refactoring with PageObjects

The main learning goal here will be to get familiar with how to upgrade a set of end-to-end tests (test suite) with a TestCafe role and the PageObject pattern. We will use Role to speed up the tests and will utilize PageObjects to achieve reduced code duplication and enhanced maintainability. By the end of this chapter, we will have a structured and optimized set of tests and know how to apply roles and PageObject patterns to any future projects.

In this chapter, we're going to cover the following main topics:

  • Adding a Role for logging in.
  • Refactoring tests with PageObjects.
  • Improving PageObjects with functions.

Technical requirements

All the code examples for this chapter can be found on GitHub: https://github.com/PacktPublishing/Modern-Web-Testing-with-TestCafe/tree/master/ch6 ...

Get Modern Web Testing with TestCafe 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.