Goal
Create a new Happy Path scenario to cover 5 new scenarios for the options:
- Do you have a uniform, costume or outfit?
- Do you usually or intend to don a cape?
And add additional validations for help text and select different options for the Hero powers and validate dates
Starting code
Start tag: lesson/03 (Configurators can use lesson/02)
Steps
Now we are on lesson 2 the forms are becoming more complex with more elements on the screen. We want to ensure we don’t delete the previous lessons tests but we are going to create a new folder with the name H002 and a new test with name HappyPath under the folder.

Scenario description
We are going to create 4 scenarios to check different items on the screen:
- Scenario: Login as External User, check the title of the page, help title and help text
- Scenario: Login as External User and check the registration with radio button options I
- Scenario: Login as External User and check the registration with radio button options II
- Scenario: Login as External User and select value from the dropdown list
- Scenario: Login as External User and check the registration date as today date
Working with help titles and help text
In the previous lessons we learn that to validate specific items on the screen we need to check the UX guide. In this case for help titles and help text we want to check 4 things:
- The service title
- The help title / The link of the help title
- The help text

Not everything can be automated, but Hercules provides good coverage on what needs to be automated
Scenario Description: The scenario name must be short and descriptive of what needs to be achieved.
Scenario: Login as External User, check service title and validate the help title and help text

Actions: The actions like Given and I logon are common to most of the tests but now we are adding more complexity. In this case:
- Click link
- help-title
- help
help-title and help are related to the UX guide but the reason why we need to click the What is this? link is because we want to make sure the help title is really a help title that looks that a link and also to confirm that there is help text that is present under the link.
Scenario: Login as External User, check service title and validate the help title and help text
Given I set application to heroes
Then I logon as External01@fostermoore.com with password External01
And I click menu Online Services
And I click menu Register a Super Hero
And I expect service-title Register a Super Hero
And I expect help-title What is this?
And I click link What is this?
And I expect help-text It is recommended heroes have a uniform or costume that obscures their identity for privacy reasons.

Working with Radio buttons and dropdowns
Radio buttons are all across any Verne application and are identified by being rounded in a group and the group have multiple options. These radio buttons can be selected by using I select radio button <option> in radio button group <group label>
Scenario Name: The scenario name must be short and descriptive of what needs to be achieved.
Scenario: Login as External User and checks the default options for radio buttons
Actions:
- Select radio buttons
- Validate that there is a radio button selected/not selected
- Select an option from the dropdown

Scenario: Login as External User and checks the default options for radio buttons I
Given I set application to heroes
Then I logon as External01@fostermoore.com with password External01
When I click menu Online Services
And I click menu Register a Super Hero
Then I expect radio button Yes in radio button group Do you have a uniform, costume or outfit? to have option selected
And I expect radio button group Do you usually or intend to don a cape? to have no option selected

Now let’s make another scenario where we validate that the options are showing correctly when select a radio button
Scenario: Login as External User and checks the default options for radio buttons II
Given I set application to heroes
Then I logon as External01@fostermoore.com with password External01
And I click menu Online Services
And I click menu Register a Super Hero
When I select radio button No in radio button group Do you have a uniform, costume or outfit?
Then I do not expect text Do you usually or intend to don a cape?
When I select radio button Yes in radio button group Do you have a uniform, costume or outfit?
And I select radio button Yes in radio button group Do you usually or intend to don a cape?
And I select radio button No in radio button group Do you usually or intend to don a cape?

You can notice on the scenario above that we are selecting the radio buttons options Yes/No are present but an additional check was added to validate when a user selects No in radio button group Do you have a uniform, costume or outfit? the radio button Do you usually or intend to don a cape? doesn’t exist via and I expect text.
Comprehensive list of step definitions applicable to radio buttons here
Dropdowns
There are different types of dropdowns in Verne. These types can be divided in 2 types:
Normal dropdown: Where options are restricted to a number of selections and users cannot write to select the options

Autocomplete dropdown: Which users can select the options by entering text or selecting from the list

For any of the dropdowns described above we can use the step definition I select option <option> from dropdown <dropdown name>

The type on superhero app is Autocomplete, so for this we are going to use
And I select option Agility from dropdown Hero Powers
Scenario: Login as External User and select value from the dropdown list
Given I set application to heroes
Then I logon as External01@fostermoore.com with password External01
And I click menu Online Services
And I click menu Register a Super Hero
And I select radio button Yes in radio button group Do you usually or intend to don a cape?
And I select option Agility from dropdown Hero Powers
And I select option Flight from dropdown Hero Powers

Checking dates
Hercules provides capabilities to validate dates on screen via special formatting. Example: #FORMATTED_TODAY#yyyyMMdd#FORMATTED_TODAY# : Will format today’s date into any entered format In this case our screen label is TODAY’s date with a format of dd MMMM yyyy
Scenario: Login as External User and check the registration date as today date
Given I set application to heroes
Then I logon as External01@fostermoore.com with password External01
And I click menu Online Services
And I click menu Register a Super Hero
And I expect text #FORMATTED_TODAY#dd MMMM yyyy#FORMATTED_TODAY#

Scenario: Login as External User and check the registration date as today date
Given I set application to heroes
Then I logon as External01@fostermoore.com with password External01
And I click menu Online Services
And I click menu Register a Super Hero
And I expect text Registration Date > #FORMATTED_TODAY#dd MMMM yyyy#FORMATTED_TODAY#
The associate will check there is a text 07 September 2020 that has another test associated as a parent with text Registration Date

Recap
In this lessons we discover a few things:
- We interacted with help text and help titles using the right component. We clicked on the link for help to make sure the links are correctly displayed and also displays the proper text.
- Selected different options with radio buttons and validated that the options appear/disappear depending on the radio button selected
- Validated that we can check radio button default options.
- There are 2 different types of dropdowns in Verne and 1 automation step fit both types.
- We can check the text on the screen that contains dates using FORMATTED_TODAY#dd MMMM yyyy#FORMATTED_TODAY
- What is an associate and using it

