A Context refers to a state of the application, and it presents specific actions user can take to accomplish a usecase on the system.
In the simplest form, you can consider each page of your web application to be a Context. Examples could include: Home Page, Login Page, Search Page, Search Results Page, Payment Info Page etc.
Visual rendering of a Context (or page) is captured in the form of a View. Most commonly you may have one View for each Context/page. However, it is also possible that some pages need multiple views.
So the question is, when is a new view warranted? Some times, a page may expose a set of new UI controls upon some action on the page. Examples could include
- Opening up of a calendar control when you click in date field
- Opening up a doormat menu when you hover on top tool bar
- Showing more-search options, when you click on "Advanced Options" link etc.
These controls (calendar, doormat menu etc.) may not be visible in the default view you take for the page. In case your test logic requires you to interact with these controls, you will be required to capture another view with the necessary UI controls visible.
Note: It is important that you do not create multiple Contexts in places, where actually what is needed is multiple Views.
Notice that clicking or hovering on the fields in green border results in new elements presented on the screen, necessitating new View.
Note: New view will be required ONLY if your action logic needs to perform any interaction with the elements that the view will bring.
Note: Changes in display information or data does not require new view. For example, when you are looking at Flight Search Results page, you may see different data every time. This does not require capturing new view.