What is the recommended folder structure for Protractor e2e test cases?

4.7k views Asked by At

Should the folder structure for e2e test cases in Protractor be the same as that of the application?

1

There are 1 answers

1
avandeursen On BEST ANSWER

This depends on the folder structure of your application :-).

To use Protractor effectively you need:

  • Page objects representing navigational states in your application. They hide the HTML implementation details and provide an API to your application in terms of the application domain.
  • Actual scenarios navigating through the pages and states. These scenarios can be simple (involving one state transition) or longer (involving the navigation across multiple states).

The page objects likely correspond to Angular elements such as templates, so you might follow a similar folder structure.

The actual test cases navigating through the states are closer to user stories. If you use a structured story format, you might organize scenarios into narratives ("As a ... I want ... so that ...") which then come with a number of acceptance scenarios ("Given ... when ... then") grouped together.

If you want to learn more about setting up Protractor tests using state machines, you can have a look at my blog post.