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.
Increased overall build stability: Overall, the test suite becomes a lot more stable since forgetting to add a wait no longer breaks random tests at random times.
Capture and append exceptions: If an action (such as clicking on a button) cannot be...