Search code examples
nightwatch.jsinternpageobjectsweb-testingwebdriver-io

Page Object Pattern for web testing


I'm looking into several javascript frameworks that can be used for e2e automated testing, mainly: Webdriver.io, theIntern and Nightwatch.

And I really want to get some feedback from developers on which framework could best support the page object pattern?


Solution

  • Intern supports that pattern (and it's a general enough pattern that I'd assume the other two do as well). There are a couple of ways to implement it with Intern.

    One possibility is mentioned in the Intern Guide. The Command object used to control a remote browser is wrapped in another class that adds page-specific functionality.

    A different style of implementation that's a bit more flexible is described here. Setting up a Command wrapper to allow more than one custom call to be chained can be tricky. The second implementation uses Command helper functions, which can be easier to work with.