Skip to content

Commit

Permalink
Merge pull request #30 from BalamiRR/flights_hotels_FK
Browse files Browse the repository at this point in the history
DONE: Scenario: Adding a child and selecting a random child age
  • Loading branch information
BalamiRR authored Feb 19, 2025
2 parents 5c25709 + 8b01b6c commit 9b257b7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
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

0 comments on commit 9b257b7

Please sign in to comment.