The Action Wrapper pattern

The idea behind the Action Wrapper pattern is to collect all of the most common pain points, such as AJAX, and automatically implement them every time that action is performed. It helps to future proof the tests by automatically accounting for things that commonly go wrong and destabilizing the tests.

Advantages of the Action Wrapper pattern

The Action Wrapper pattern has a lot more advantages than disadvantages; let's take a look at them:

  • Single location for actions: All of the actions such as clicking, typing, and dealing with AJAX requests and animations are in a single class. This makes them easy to find and modify and very DRY.

    Note

    The DRY principle and the DRY pattern are discussed in Chapter 3, Refactoring Tests

Get Selenium Design Patterns and Best Practices 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.