Skip to content

Commit

Permalink
Added 2 new tests to reports
Browse files Browse the repository at this point in the history
  • Loading branch information
root authored and root committed Nov 14, 2024
1 parent 29d8125 commit b22daa3
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 4 deletions.
15 changes: 15 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,3 +353,18 @@ def enter_vaccine_details_and_click_continue_to_check_and_confirm(vaccinate_deci
attach_screenshot("patient_decided_to_not_vaccinate")
click_save_and_return_button_on_record_vaccinated_page()
attach_screenshot("patient_decided_to_not_vaccinate_saved_and_returned")

def navigate_and_login_with_username(username):
if config["browser"] == "mobile":
if check_navbar_toggle_exists_without_waiting():
click_navbar_toggler()
if check_logout_button_exists_without_waiting():
click_logout_button()
url = get_app_url(config["test_environment"])
navigate_to_ravs_login_page(url)
click_login_button()
emailAddress = username
enter_email_address(emailAddress)
password = config["credentials"]["ravs_password"]
enter_password(password)
click_nhs_signin_button()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 17 additions & 1 deletion features/reports.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
Feature: Reports

@reports
Scenario: Create reports page should launch
Scenario: "Reports" page is displayed
Given I am logged into the RAVS app
When I click the reports navigation link
Then the reports page should be displayed

Scenario: "Choose dates" page is displayed
Given I am logged into the RAVS app
When I click the reports navigation link
And I click the create report button
Then the choose dates page should be displayed

Scenario Outline: Create report for an organization with no location sites
Given I am logged into the RAVS app with the <username>
When I click the reports navigation link
Then the `No vaccination data to report on` message should be displayed
And the Create report button should be disabled

Examples:
| username |
| neelima.guntupalli1+no_location_sites@nhs.net |
11 changes: 11 additions & 0 deletions pages/reports_date_range_selection_page.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from init_helpers import *

CREATE_REPORT_BUTTON = ("role", "button", "Create report")
NO_VACCINATION_DATE_TO_REPORT = ("text", "No vaccination data to report")
TODAY_RADIO_BUTTON = ("label", "Today", None, True)
YESTERDAY_RADIO_BUTTON = ("label", "Yesterday")
LAST_7_DAYS_RADIO_BUTTON = ("label", "Last 7 days (includes today)")
Expand Down Expand Up @@ -30,6 +31,16 @@ def check_create_report_button_exists():
wait_for_element_to_appear(CREATE_REPORT_BUTTON)
return check_element_exists(CREATE_REPORT_BUTTON)

def check_no_vaccination_data_to_report_message_exists():
wait_for_element_to_disappear(PAGE_LOADING_ELEMENT)
wait_for_element_to_appear(NO_VACCINATION_DATE_TO_REPORT)
return check_element_exists(NO_VACCINATION_DATE_TO_REPORT)

def check_create_report_button_enabled():
wait_for_element_to_disappear(PAGE_LOADING_ELEMENT)
wait_for_element_to_appear(CREATE_REPORT_BUTTON)
return check_element_enabled(CREATE_REPORT_BUTTON)

def click_create_report_button():
wait_for_element_to_appear(CREATE_REPORT_BUTTON)
find_element_and_perform_action(CREATE_REPORT_BUTTON, "click")
Expand Down
35 changes: 32 additions & 3 deletions tests/test_reports_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import secrets
import string
from pytest_bdd import given, when, then, scenarios, scenario
from pytest_bdd.parsers import parse, cfparse
from pytest_bdd.parsers import parse
from pages.login_page import *
from pages.home_page import *
from pages.nhs_signin_page import *
Expand All @@ -24,11 +24,11 @@ def shared_data():

@pytest.mark.reports
@given("I am logged into the RAVS app")
def logged_into_ravs_app():
def logged_into_ravs_app(navigate_and_login):
pass

@when("I click the reports navigation link")
def I_click_reports_nav_link(navigate_and_login):
def I_click_reports_nav_link():
click_reports_nav_link()
attach_screenshot("reports_navigation_link_clicked")
logging.info("logged_in_and_reports_navigation_link_clicked")
Expand All @@ -38,3 +38,32 @@ def the_reports_page_should_be_displayed():
assert check_create_report_button_exists() == True
attach_screenshot("reports_page_loads_and_create_report_button_is_visible")
logging.info("reports_page_loads_and_create_report_button_is_visible")

@when("I click the create report button")
def I_click_create_report_button():
click_create_report_button()
attach_screenshot("create_report_button_is_clicked")
logging.info("logged_in_and_reports_navigation_link_clicked")

@then("the choose dates page should be displayed")
def the_choose_dates_page_should_be_displayed():
assert check_today_radio_button_exists() == True
attach_screenshot("choose_dates_range_page_should_be_displayed")
logging.info("choose_dates_range_page_should_be_displayed")


@given(parse('I am logged into the RAVS app with the {username}'))
def logged_into_ravs_app_with_username(username):
navigate_and_login_with_username(username)

@then("the `No vaccination data to report on` message should be displayed")
def the_choose_dates_page_should_be_displayed():
assert check_no_vaccination_data_to_report_message_exists() == True
attach_screenshot("no_vaccination_data_to_report_message_exists")
logging.info("no_vaccination_data_to_report_message should be visible")

@then("the Create report button should be disabled")
def the_choose_dates_page_should_be_displayed():
assert check_create_report_button_enabled() == False
attach_screenshot("Create report button should be disabled")
logging.info("Create report button should be disabled")

0 comments on commit b22daa3

Please sign in to comment.