Let’s Use a Page Object
The integration tests were not really that complicated, but they can get cumbersome if we’re not careful. There are four major problems in the integration tests we wrote:
-
Noisy: The code to access the elements and to verify the contents is noisy. Less noise would result in easier-to-maintain tests.
-
Duplication: The code to get an element, like tasks or message, for example, is duplicated throughout the tests. Less duplication would mean fewer errors and make it easier to deal with changes to the pages.
-
Tight coupling on page implementation: Suppose, for whatever reason, the span element that displays the tasks count is changed to have a class instead of an id. All the tests that use this element will have to change—this ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access