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 Select a random age needed for children #7

Merged
merged 1 commit into from
Feb 5, 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
18 changes: 9 additions & 9 deletions features-frontend/stays.feature.robot
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ Scenario: Select minimum number of children
Then I see the number of children increase by 1
And I see the "Age needed" field is displayed for the added child

# Scenario: Select a random age needed for children
# [Documentation] This scenario verifies that when the "+" button for children is clicked, the number of children increases by 1 and the "Age needed" field appears.
# [Tags] Medium
# Given I click the "Age needed" field
# Then I will see the list of ages
# When I select a random age from the list
# Then The age will be assigned to the field
# When I click the Done button
# Then I see the selected number of child is displayed in the field
Scenario: Select a random age needed for children
[Documentation] This scenario verifies that when the "+" button for children is clicked, the number of children increases by 1 and the "Age needed" field appears.
[Tags] Medium
Given I click the "Age needed" field
Then I will see the list of ages
When I select a random age from the list
Then The age will be assigned to the field
When I click the Done button
Then I see the selected number of "1" is displayed in the field

# Scenario: Search for available accomaidation
# [Documentation] this
Expand Down
24 changes: 23 additions & 1 deletion step-definition/frontend/stays.steps.robot
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ I will see the displayed default value as "${adults}" adults · "${children}" ch
Should Be Equal As Strings ${adults_value} ${adults}

${children_value} Get Element Attribute ${CHILDREN_NUMBER} value
Set Global Variable ${children_value}
Should Be Equal As Strings ${children_value} ${children}

${rooms_value} Get Element Attribute ${ROOM_NUMBER} value
Expand Down Expand Up @@ -171,7 +172,6 @@ I see "${children}" displayed default for children

I click the '+' button for children
Click Element ${CHILDREN_PLUS_BTN}
Log ${CHILDREN_NUMBER}

I see the number of children increase by 1
${updated_children_value} Get Element Attribute ${CHILDREN_NUMBER} value
Expand All @@ -181,6 +181,28 @@ I see the number of children increase by 1
I see the "Age needed" field is displayed for the added child
Element Should Be Visible ${AGE_NEEDED_FIELD}

I click the "Age needed" field
Click Element ${AGE_NEEDED_FIELD}

I will see the list of ages
Element Should Be Visible ${AGE_NEEDED_LIST}

I select a random age from the list
${options} Get List Items ${AGE_NEEDED_FIELD}
${random_age} Evaluate random.choice(${options}) modules=random
Select From List By Label ${AGE_NEEDED_FIELD} ${random_age}

The age will be assigned to the field
${age_value} Get Value ${AGE_NEEDED_FIELD}

I click the Done button
Click ELement ${DONE_BTN}

I see the selected number of "${children}" is displayed in the field
${children_value} Evaluate ${children_value} + 1
${children} Convert To Integer ${children}
Should Be Equal ${children_value} ${children}

# I select a random destionation city
# I click on destination field
# I enter "P" "A" in the input field
Expand Down
3 changes: 2 additions & 1 deletion step-definition/frontend/webelements.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
GUEST_OPTION_BTN="(//div[@class='e22b782521'])[3]"
GUEST_POP_UP=" //div[@class='b067f3afe2 b3c059c742']"
ADULTS_NUMBER="//input[@id='group_adults']"
# CHILDREN_NUMBER="//input[@id='group_children']"
# CHILDREN_NO="//input[@id='group_children']"
CHILDREN_NUMBER="//div[2]/input"
ROOM_NUMBER="//input[@id='no_rooms']"
GUEST_FIELD="css=//span[@class='a8887b152e c7ce171153']"
Expand All @@ -35,3 +35,4 @@
ROOMS_PLUS_BTN="(//div[@class='bfb38641b0'])[3]//button[contains(@class, 'f4d78af12a')]"
AGE_NEEDED_FIELD="//select[@class='ebf4591c8e']"
AGE_NEEDED_LIST="//select[@class='ebf4591c8e']/option"
DONE_BTN="//button[contains(.,'Done')]"