Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DONE: Scenario: Adding a child and selecting a random child age #30

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions features-frontend/flights_hotels.feature.robot
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*** Settings ***
Resource ../step-definition/frontend/flights_hotels.steps.robot
Resource ../step-definition/frontend/stays.steps.robot
Force Tags UC-FLIGHTS-HOTELS
Suite Setup Open BookingApp
Test Teardown Run Keyword If Test Failed Capture Page Screenshot
Expand Down Expand Up @@ -43,8 +44,8 @@ Scenario: Assign a new destination to a destination field
... Select a destination randomly from the item proposed in the list
... Ensure that the new destination is assigned to the destination field
[Tags] Medium
Given I select a random destination from the list
Then The destination will be assigned to the destination field
Given I select a random destination for hotels and flights from the list
Then I will see that destination will be assigned to the destination field

Scenario: Clear button for departure and destination
[Documentation]
Expand Down Expand Up @@ -81,6 +82,8 @@ Scenario: Adding a child and selecting a random child age
[Tags] Low
Given I click on the "Add a child" option
Then I will see the list of ages til 12 years
When I select a random age for the child from the list
Then I will see the newly added child's age displayed

Scenario: Adding a new room
[Documentation] This scenario verifies that a new room can be added successfully and appears next to the first room.
Expand Down
24 changes: 18 additions & 6 deletions step-definition/frontend/flights_hotels.steps.robot
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ I see related cities or airports for destination
${lenght_destination}= Get Length ${destination_items}
RETURN ${destination_items} ${lenght_destination}

I select a random destination from the list
I select a random destination for hotels and flights from the list
${destination_items} ${destination_count} I see related cities or airports for destination
${random_index} Evaluate random.randint(0, ${destination_count}-1)
${selected_destination} Get Text ${destination_items}[${random_index}]
Expand All @@ -84,7 +84,7 @@ I select a random destination from the list
Set Global Variable ${selected_destination}
[Return] ${selected_destination}

The destination will be assigned to the destination field
I will see that destination will be assigned to the destination field
${destination_assigned} Get Value ${ASSIGNED_DESTINATION}
Should Start With ${selected_destination} ${destination_assigned}

Expand Down Expand Up @@ -151,13 +151,25 @@ I will see the any class option is selected as default
I click on the "Add a child" option
Click Element ${ADD_CHILD_BTN}

I will see the ages til 12 years
I will see the list of ages til 12 years
Wait Until Element Is Visible ${AGE_LIST}
${age_items} Get WebElements ${AGE_LIST}
${l}= Get Length ${age_items}
${length_of_ages}= Get Length ${age_items}
Set Global Variable @{age_items}
Set Global Variable ${l}
RETURN ${age_items} ${l}
Set Global Variable ${length_of_ages}
RETURN ${age_items} ${length_of_ages}

I select a random age for the child from the list
${age_items} ${age_numbers} I will see the list of ages til 12 years
${random_age} Evaluate random.randint(0,${age_numbers}-1)
${selected_age} Get Text ${age_items}[${random_age}]
Click Element ${age_items}[${random_age}]
Sleep 1s
Set Global Variable ${selected_age}
[Return] ${selected_age}

I will see the newly added child's age displayed
Log message

I click on the "Add a Room" button
Log message
Expand Down
2 changes: 1 addition & 1 deletion step-definition/frontend/webelements.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
FLIGHT_HOTEL_ACCEPT_COOKIES="css=button.iubenda-cs-accept-btn"
ASSIGNED_DEPARTURE="(//div[@class='d-28ke2m ed5mks93'])[1]/input"
DESTINATION_FLIGHT_HOTEL_FIELD="//input[@placeholder='Where do you want to go?']"
LIST_OF_DESTINATION="//ul[@id=':R3a6j6lalqmt2mmH2:']/li/ul/li"
LIST_OF_DESTINATION="//ul[@class='d-1ip0gkj']/li/ul/li"
ASSIGNED_DESTINATION="(//div[@class='d-28ke2m ed5mks93'])[2]/input"
CLEAR_DEPARTURE_DESTINATION="(//button[@class='d-l65ey4 ed5mks91'])[1]"
SWITCH_BUTTON="css=.ButtonFlip-module__flipIcon___2sPKY > svg"
Expand Down