Underlying Code - Page Object Pattern
Time to introduce some framework concepts. If you notice, we interacted with three different pages in our scenario.
- Landing Page - from where we chose to sign up
- SignUp Page - where we entered details of the new user and committed
- Home Page - of the application you see as a signed-in user
Page object pattern in test automation is a concept that basically advocates the idea of creating one java class per page of the application.
The idea is to encapsulate all the controls that are available on the page and also all the actions that can be performed on a specific page.
This way you can also re-use the code written on a page for different test scenarios we would be creating.
Having said that, in our case we should be creating 3 different page classes. And based on above understanding
- Landing page - should encapsulate the sign up button and the sign up method.
- SignUp Page - should encapsulate all the user details field inputs and the actions for the same.
- Home Page - should encapuslate the logged-in user home page controls and the related actions.