diff --git a/features-frontend/stays.feature.robot b/features-frontend/stays.feature.robot index bb8c582..5fef8bd 100644 --- a/features-frontend/stays.feature.robot +++ b/features-frontend/stays.feature.robot @@ -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 diff --git a/step-definition/frontend/stays.steps.robot b/step-definition/frontend/stays.steps.robot index a20bfd0..e16dd64 100644 --- a/step-definition/frontend/stays.steps.robot +++ b/step-definition/frontend/stays.steps.robot @@ -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 @@ -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 @@ -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 diff --git a/step-definition/frontend/webelements.py b/step-definition/frontend/webelements.py index f87f5c2..12d0997 100644 --- a/step-definition/frontend/webelements.py +++ b/step-definition/frontend/webelements.py @@ -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']" @@ -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')]" \ No newline at end of file