Page Objects in AngularJS Protractor E2E Testing

wlingke picture wlingke · Dec 12, 2013 · Viewed 8.9k times · Source

What is the right way to handle the Page Objects model for writing Protractor E2E testing for AngularJS? I feel like I should write them in separate files (like homepage.js, page2.js, etc) then include somehow them into the specs like modules as need. However, I don't know how to inject them. Would appreciate any suggestions. Thanks!

Answer

Jmr picture Jmr · Dec 12, 2013

Keep them in separate files, and use Node's require to pull in any helpers or page objects you need. Check out this super simple example: https://github.com/juliemr/ng-page-e2e/blob/master/test/angularsite_test.js#L2