diff --git a/.github/workflows/tests_dev.yml b/.github/workflows/tests_dev.yml index f4bfce83f..41bc93fab 100644 --- a/.github/workflows/tests_dev.yml +++ b/.github/workflows/tests_dev.yml @@ -1,6 +1,14 @@ name: RAVS TESTS - DEV on: + push: + branches: + - '**' # Triggers on push to any branch + pull_request: + branches: + - '**' # Triggers on PR to any branch + schedule: + - cron: "0 7 * * *" workflow_dispatch: jobs: diff --git a/conftest.py b/conftest.py index 1de894334..7e6e23a3e 100644 --- a/conftest.py +++ b/conftest.py @@ -233,6 +233,9 @@ def choose_vaccine_and_vaccine_type_for_patient(vaccine, vaccine_type): click_continue_to_assess_patient_button() attach_screenshot("selected_vaccine_" + vaccine + "_and_" + vaccine_type + "_and_clicked_continue_button") +def check_vaccine_and_batch_exists_in_site_api_request(site, vaccine, vaccineType,batch_number, expirydate): + pass + def check_vaccine_and_batch_exists_in_site(site, vaccine, vaccineType,batch_number, expirydate): if config["browser"] == "mobile": if check_navlink_bar_toggle_exists(): @@ -246,10 +249,10 @@ def check_vaccine_and_batch_exists_in_site(site, vaccine, vaccineType,batch_numb attach_screenshot("before_clicking_site_radio_button") click_site_radio_button(site) if "covid" in vaccine.lower(): - attach_screenshot("before_clicking_covid_vaccine_checkbox") - click_covid_vaccine_checkbox() - attach_screenshot("before_clicking_covid_vaccinetype_checkbox") - click_covid_vaccine_type_checkbox(vaccineType) + attach_screenshot("before_clicking_covid_vaccine_checkbox") + click_covid_vaccine_checkbox() + attach_screenshot("before_clicking_covid_vaccinetype_checkbox") + click_covid_vaccine_type_checkbox(vaccineType) elif "flu" in vaccine.lower(): attach_screenshot("before_clicking_flu_vaccine_checkbox") click_flu_vaccine_checkbox() @@ -301,7 +304,8 @@ def check_vaccine_and_batch_exists_in_site(site, vaccine, vaccineType,batch_numb attach_screenshot("clicked_confirm_choices_button") click_find_a_patient_nav_link() -def assess_patient_with_details_and_click_continue_to_consent(eligible_decision, eligibility_type, staff_role, assessing_clinician, assessment_date, assessment_outcome, assessment_comments, eligibility_assessment_no_vaccine_given_reason=None): +def assess_patient_with_details_and_click_continue_to_consent(eligible_decision, eligibility_type, staff_role, assessing_clinician, assessment_date, legal_mechanism, assessment_outcome, assessment_comments, eligibility_assessment_no_vaccine_given_reason=None): + click_legal_mechanism(legal_mechanism) select_assessing_clinician_with_name_and_council(assessing_clinician) enter_comments_for_assessing_patient(assessment_comments) set_assessment_date(assessment_date) @@ -346,7 +350,7 @@ def record_consent_details_and_click_continue_to_vaccinate(consent_decision, co click_save_and_return_button_on_record_consent_page() attach_screenshot("patient_decided_to_not_consent_saved_and_returned") -def enter_vaccine_details_and_click_continue_to_check_and_confirm(vaccinate_decision, vaccination_date, vaccine, vaccine_type2, vaccination_route, batch_number, batch_expiry_date, dose_amount, prescribing_method, vaccinator, vaccination_comments, no_vaccination_reason=None): +def enter_vaccine_details_and_click_continue_to_check_and_confirm(vaccinate_decision, vaccination_date, vaccine, vaccine_type2, vaccination_site, batch_number, batch_expiry_date, dose_amount, legal_mechanism, vaccinator, vaccination_comments, no_vaccination_reason=None): select_vaccinator_name_and_council(vaccinator) enter_vaccination_comments(vaccination_comments) set_vaccination_date(vaccination_date) @@ -356,12 +360,11 @@ def enter_vaccine_details_and_click_continue_to_check_and_confirm(vaccinate_deci click_covid_vaccine_type_radiobutton_choose_vaccine_for_patient_on_vaccinated_page(vaccine_type2) elif "flu" in (vaccine).lower(): click_flu_vaccine_type_radiobutton_choose_vaccine_for_patient_on_vaccinated_page(vaccine_type2) - select_vaccination_route(vaccination_route) + select_vaccination_site(vaccination_site) batch_number_to_select = batch_number.upper() + " - " + batch_expiry_date select_batch_number(batch_number_to_select) time.sleep(3) enter_dose_amount_value(dose_amount) - click_prescribing_method(prescribing_method) if click_continue_to_check_and_confirm_screen_button() == True: vaccination_date = format_date(vaccination_date, "safari") set_vaccination_date(vaccination_date) diff --git a/features/find_a_patient.feature b/features/find_a_patient.feature index 1b9a01998..7ea1e970c 100644 --- a/features/find_a_patient.feature +++ b/features/find_a_patient.feature @@ -29,11 +29,11 @@ Feature: Find a patient | nhsNumber | name | dateofbirth | address | | 9693632109 | Bill GARTON | 23/6/1946 | 1 MOUNT AVENUE, BARTON-UPON-HUMBER, S HUMBERSIDE, DN18 5DW | | 9449304424 | COMFORT Jones | 9/3/2018 | Ifyoucan113, GDA11 UCL6, KT17 1NA | - | 9449305552 | abxxyz Patel | 13/2/2020 | Caretakers Flat, Line2121, Line323, HYDERABAD, Country, EN2 6SN | + | 9449305552 | Prasad Patel | 14/2/2020 | Caretakers Flat, Line2121, Line323, HYDERABAD, Country, EN2 6SN | | 9449306621 | Not found | 20110509 | KT21 1LJ | | 9449306613 | Briar Anderton | 20/5/1990 | 123 Main Vyt, AB12 3CE | | 9449306605 | Srinivasarao Patel | 03/03/2020 | 4 Calicut Lane2, Line 2, Line 3, SLOUGH, Berkshire, KT21 1EJ | - | 9449306494 | Reynolds Ryan | 27/3/2001 | 39 Barton Road, RG10 9DF | + | 9449306494 | Reynolds Ryan | 27/3/2001 | 40 Queen Street London, EC4R 1DD | | 9469997956 | SOLOMON DAZLEY | 20160130 | 10 BROOK STREET, LANCASTER, LA1 1SL | | 9469998626 | JONNY CONOPO | 20150305 | 1 DAISY BANK, LANCASTER, LA1 3JW | | 9470004272 | JOJO LANE | 20150706 | 10 RAKESMOOR LANE, BARROW-IN-FURNESS, LA14 4LG | diff --git a/helpers/datetimeHelper.py b/helpers/datetimeHelper.py index c8f76ee17..3e2269df9 100644 --- a/helpers/datetimeHelper.py +++ b/helpers/datetimeHelper.py @@ -78,17 +78,82 @@ def standardize_date_format(date_str): try: # Try parsing the date as '%d/%m/%Y' parsed_date = datetime.strptime(date_str, "%d/%m/%Y") - return parsed_date.strftime("%d/%m/%Y") except ValueError: try: # If parsing fails, try parsing as '%m/%d/%Y' parsed_date = datetime.strptime(date_str, "%m/%d/%Y") - # Format the parsed date to '%d/%m/%Y' - return parsed_date.strftime("%d/%m/%Y") except ValueError: # If parsing as both formats fails, return the original string return date_str + # Manually format the date to ensure no leading zeros on the day + day = parsed_date.day + month = parsed_date.strftime('%m') + year = parsed_date.year + + return f"{day}/{month}/{year}" + + @staticmethod + def date_format_with_age(date_str): + try: + # Try parsing the date as '%d/%m/%Y' + parsed_date = datetime.strptime(date_str, "%d/%m/%Y") + except ValueError: + try: + # If parsing fails, try parsing as '%m/%d/%Y' + parsed_date = datetime.strptime(date_str, "%m/%d/%Y") + except ValueError: + # If parsing as both formats fails, return the original string + return date_str + + today = datetime.today() + age = today.year - parsed_date.year - ((today.month, today.day) < (parsed_date.month, parsed_date.day)) + + day = parsed_date.day # Day without leading zero + month = parsed_date.strftime('%B') # Full month name + year = parsed_date.year # Full year + + return f"{day} {month} {year} (aged {age})" + + @staticmethod + def date_format_with_day_of_week(date_str): + try: + # Try parsing the date as '%d/%m/%Y' + parsed_date = datetime.strptime(date_str, "%d/%m/%Y") + except ValueError: + try: + # If parsing fails, try parsing as '%m/%d/%Y' + parsed_date = datetime.strptime(date_str, "%m/%d/%Y") + except ValueError: + # If parsing as both formats fails, return the original string + return date_str + + # Manually format the date to include the day of the week without leading zero for the day + day_of_week = parsed_date.strftime('%A') + day = parsed_date.day + month = parsed_date.strftime('%B') + year = parsed_date.year + + return f"{day_of_week} {day} {month} {year}" + + @staticmethod + def date_format_with_name_of_month(date_str): + try: + # Try parsing the date as '%d/%m/%Y' + parsed_date = datetime.strptime(date_str, "%d/%m/%Y") + except ValueError: + try: + # If parsing fails, try parsing as '%m/%d/%Y' + parsed_date = datetime.strptime(date_str, "%m/%d/%Y") + except ValueError: + # If parsing as both formats fails, return the original string + return date_str.strftime("%d %B %Y") + + day = parsed_date.day + month = parsed_date.strftime('%B') + year = parsed_date.year + return f"{day} {month} {year}" + class DatetimeHelper(BaseDatetimeHelper): def __init__(self): diff --git a/helpers/playwrightHelper.py b/helpers/playwrightHelper.py index b251c6583..f56e44038 100644 --- a/helpers/playwrightHelper.py +++ b/helpers/playwrightHelper.py @@ -120,7 +120,6 @@ def navigate_to_url(self,url): self.page.goto(url) self.page.wait_for_load_state() - def wait_for_page_to_load(self, timeout=1): self.page.wait_for_selector('*', timeout=timeout * 100) self.page.wait_for_load_state('domcontentloaded', timeout=timeout * 100) @@ -128,7 +127,7 @@ def wait_for_page_to_load(self, timeout=1): def find_elements(self, selector): return self.page.query_selector_all(selector) - def wait_for_element_to_appear(self, selector, timeout=50): + def wait_for_element_to_appear(self, selector, timeout=20): try: self.page.wait_for_selector(selector, timeout=timeout, state='visible') print(f"Element {selector} appeared on the page.") @@ -143,7 +142,6 @@ def wait_for_selector_to_disappear(self, selector, timeout=50): print(f"Error waiting for element {selector} to disappear: {e}") def check_element_exists(self, selector, wait=False): - self.wait_for_page_to_load() try: element = self.page.locator(selector) if wait == True: @@ -154,7 +152,6 @@ def check_element_exists(self, selector, wait=False): return False def check_element_enabled(self, selector, wait=False): - self.wait_for_page_to_load() try: element = self.page.locator(selector) if wait == True: @@ -169,7 +166,6 @@ def scroll_into_view(self, selector): element.scroll_into_view_if_needed() def clear_element(self, selector): - self.wait_for_page_to_load() try: element=self.page.locator(selector) element.clear() @@ -184,7 +180,6 @@ def release_mouse(self): self.page.mouse.up() def find_element_and_perform_action(self, selector, action, inputValue=None): - self.wait_for_page_to_load() selector_filename = "".join(c if c.isalnum() else "_" for c in selector) self.capture_screenshot(selector_filename) try: @@ -231,7 +226,6 @@ def find_element_and_perform_action(self, selector, action, inputValue=None): self.capture_screenshot(selector_filename) def get_current_url(self): - self.wait_for_page_to_load() return self.page.url() def get_accessibility_violations(self): @@ -239,7 +233,6 @@ def get_accessibility_violations(self): current_url = self.get_current_url(self.page) self.page.goto(current_url) - self.wait_for_page_to_load(self.page) axe = self.page.accessibility results = axe.check() diff --git a/init_helpers.py b/init_helpers.py index 1f04934e7..e033e702b 100644 --- a/init_helpers.py +++ b/init_helpers.py @@ -62,9 +62,9 @@ def load_config_from_env(): def attach_screenshot(filename): logging.basicConfig(level=logging.DEBUG) if config["browser"] == "mobile": - filename = config["browser"] + "_" + config["device"] + "_" + get_browser_version() + "_" + filename + ".png" + filename = config["test_environment"] + "_" + config["browser"] + "_" + config["device"] + "_" + get_browser_version() + "_" + filename + ".png" else: - filename = config["browser"] + "_" + get_browser_version() + "_" + filename + ".png" + filename = config["test_environment"] + "_" + config["browser"] + "_" + get_browser_version() + "_" + filename + ".png" directory = os.path.dirname(filename) if directory: @@ -164,6 +164,15 @@ def format_date(date, browser): def standardize_date_format(date): return datetime_helper_instance.standardize_date_format(date) +def date_format_with_day_of_week(date): + return datetime_helper_instance.date_format_with_day_of_week(date) + +def date_format_with_age(date): + return datetime_helper_instance.date_format_with_age(date) + +def date_format_with_name_of_month(date): + return datetime_helper_instance.date_format_with_name_of_month(date) + def get_date_value(date): return datetime_helper_instance.get_date_value(date) diff --git a/pages/add_vaccines_page.py b/pages/add_vaccines_page.py index 646e180aa..503c1038c 100644 --- a/pages/add_vaccines_page.py +++ b/pages/add_vaccines_page.py @@ -37,7 +37,7 @@ def check_confirm_choices_button_enabled(): return check_element_enabled(CONFIRM_VACCINE_CHOICES_BUTTON, True) def click_site_radio_button(site): - element = (f"//label[text()='{site}']/preceding-sibling::input[@id='SiteId']") + element = (f"//label[text()='{site}']/preceding-sibling::input[@name='SiteId']") find_element_and_perform_action(element, "click") def click_covid_vaccine_checkbox(): diff --git a/pages/assess_patient_page.py b/pages/assess_patient_page.py index d7c5f7779..ea80774b9 100644 --- a/pages/assess_patient_page.py +++ b/pages/assess_patient_page.py @@ -24,6 +24,18 @@ def select_eligibility_type(type): else: click_eligible_yes_radiobutton() +def click_legal_mechanism(legal_mechanism): + xpath_map = { + "national protocol (np)": "//label[@for='LegalMechanismId-1']", + "patient group directions (pgd)": "//label[@for='LegalMechanismId-2']", + "patient specific directions (psd)": "//label[@for='LegalMechanismId-3']", + } + element = xpath_map.get(legal_mechanism.lower()) + if element: + find_element_and_perform_action(element, "click") + else: + print("Invalid vaccine type") + def check_eligibility_type_is_visible(): return check_element_exists(ELIGIBILITY_TYPE_DROPDOWN_ELEMENT) diff --git a/pages/check_and_confirm_vaccinated_record_page.py b/pages/check_and_confirm_vaccinated_record_page.py index b2c7a0e6d..caaa252ca 100644 --- a/pages/check_and_confirm_vaccinated_record_page.py +++ b/pages/check_and_confirm_vaccinated_record_page.py @@ -6,119 +6,43 @@ PATIENT_DOB_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Date of birth']/following-sibling::dd[@class='nhsuk-summary-list__value']") PATIENT_ADDRESS_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Address']/following-sibling::dd[@class='nhsuk-summary-list__value']") PATIENT_NHS_NUMBER_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='NHS number']/following-sibling::dd[@class='nhsuk-summary-list__value']") -VACCINATOR_ORGANISATION_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Organisation']/following-sibling::dd[@class='nhsuk-summary-list__value']") -VACCINATOR_SITE_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Site']/following-sibling::dd[@class='nhsuk-summary-list__value']") -VACCINATOR_CARE_MODEL_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Care model']/following-sibling::dd[@class='nhsuk-summary-list__value']") -PATIENT_CHOSEN_VACCINE_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Please select which vaccine the patient wants to receive.']/following-sibling::dd[@class='nhsuk-summary-list__value']") -PATIENT_CHOSEN_VACCINE_TYPE_LABEL_ELEMENT = ("(//div[@class='nhsuk-summary-list__row']/dt[text()='Vaccine']/following-sibling::dd[@class='nhsuk-summary-list__value'])[1]") -PATIENT_ELIGIBLE_FOR_VACCINE_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Is the patient eligible for the vaccine?']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_PATIENT_ELIGIBLE_FOR_VACCINE_ANSWER_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Is the patient eligible for the vaccine?']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") +PATIENT_GENDER_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Gender']/following-sibling::dd[@class='nhsuk-summary-list__value']") +PATIENT_ELIGIBLE_FOR_VACCINE_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Eligible']/following-sibling::dd[@class='nhsuk-summary-list__value']") PATIENT_ELIGIBILITY_TYPE_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Eligibility type']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_PATIENT_ELIGIBILITY_TYPE_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Eligibility type']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") PATIENT_ELIGIBILITY_ASSESSING_CLINICIAN_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Assessing clinician']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_PATIENT_ELIGIBILITY_ASSESSING_CLINICIAN_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Eligibility type']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") PATIENT_ELIGIBILITY_ASSESSMENT_DATE_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Assessment date']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_PATIENT_ELIGIBILITY_ASSESSMENT_DATE_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Assessment date']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") PATIENT_ELIGIBILITY_ASSESSMENT_OUTCOME_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Assessment outcome']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_PATIENT_ELIGIBILITY_ASSESSMENT_OUTCOME_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Assessment outcome']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") PATIENT_ELIGIBILITY_ASSESSMENT_COMMENTS_LABEL_ELEMENT = ("(//div[@class='nhsuk-summary-list__row']/dt[text()='Comments']/following-sibling::dd[@class='nhsuk-summary-list__value'])[1]") -CHANGE_PATIENT_ELIGIBILITY_ASSESSMENT_COMMENTS_BUTTON = ("(//div[@class='nhsuk-summary-list__row']/dt[text()='Comments']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change'])[1]") -PATIENT_CONSENT_GIVEN_VALUE_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Does the patient or someone on their behalf consent to the vaccination?']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_PATIENT_CONSENT_GIVEN_VALUE_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Does the patient or someone on their behalf consent to the vaccination?']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") +CHANGE_PATIENT_ASSESSMENT_PAGE_DETAILS_BUTTON = ("//button[text()='Change assess the patient page details']") +PATIENT_CONSENT_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Consent?']/following-sibling::dd[@class='nhsuk-summary-list__value']") PATIENT_CONSENT_GIVEN_BY_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Consent given by']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_PATIENT_CONSENT_GIVEN_BY_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Consent given by']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") PATIENT_CONSENT_NAME_OF_PERSON_CONSENTING_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Name of the person consenting']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_CONSENT_NAME_OF_PERSON_CONSENTING_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Name of the person consenting']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") -PATIENT_CONSENT_PERSON_CONSENTING_RELATIONSHIP_TO_PARENT_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Relationship to patient']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_CONSENT_PERSON_CONSENTING_RELATIONSHIP_TO_PATIENT_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Relationship to patient']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") -PATIENT_CONSENT_RECORDED_BY_CLINICIAN_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Consent clinician']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_CONSENT_RECORDED_BY_CLINICIAN_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Consent clinician']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") -PATIENT_VACCINATED_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Have you vaccinated the patient?']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_PATIENT_VACCINATED_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Have you vaccinated the patient?']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") -PATIENT_VACCINATION_DATE_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Vaccination date']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_PATIENT_VACCINATION_DATE_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Vaccination date']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") -PATIENT_VACCINATED_VACCINE_LABEL_ELEMENT = ("(//div[@class='nhsuk-summary-list__row']/dt[text()='Vaccine']/following-sibling::dd[@class='nhsuk-summary-list__value'])[2]") -CHANGE_PATIENT_VACCINATION_VACCINE_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Vaccine']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") -PATIENT_VACCINATION_ROUTE_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Vaccination route']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_PATIENT_VACCINATION_ROUTE_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Vaccination route']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") -PATIENT_VACCINATION_BATCH_NUMBER_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Batch number']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_PATIENT_VACCINATION_BATCH_NUMBER_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Batch number']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") -PATIENT_VACCINATION_BATCH_EXPIRY_DATE_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Batch expiry date']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_PATIENT_VACCINATION_BATCH_EXPIRY_DATE_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Batch expiry date']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") +PATIENT_CONSENT_PERSON_CONSENTING_RELATIONSHIP_TO_PARENT_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Relationship to the patient']/following-sibling::dd[@class='nhsuk-summary-list__value']") +PATIENT_CONSENT_RECORDED_BY_CLINICIAN_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Consenting clinician']/following-sibling::dd[@class='nhsuk-summary-list__value']") +CHANGE_RECORD_CONSENT_PAGE_DETAILS_BUTTON = ("//button[text()='Change record consent page details']") +PATIENT_VACCINATED_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Vaccinated?']/following-sibling::dd[@class='nhsuk-summary-list__value']") +PATIENT_VACCINATION_DATE_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Date']/following-sibling::dd[@class='nhsuk-summary-list__value']") +PATIENT_VACCINE_LABEL_ELEMENT = ("(//div[@class='nhsuk-summary-list__row']/dt[text()='Vaccine']/following-sibling::dd[@class='nhsuk-summary-list__value'])[1]") +PATIENT_VACCINE_PRODUCT_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Product']/following-sibling::dd[@class='nhsuk-summary-list__value']") +PATIENT_VACCINE_BATCH_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Batch']/following-sibling::dd[@class='nhsuk-summary-list__value']") +PATIENT_VACCINE_BATCH_EXPIRY_DATE_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Expiry date']/following-sibling::dd[@class='nhsuk-summary-list__value']") +PATIENT_VACCINATION_SITE_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Site']/following-sibling::dd[@class='nhsuk-summary-list__value']") PATIENT_VACCINATION_DOSE_AMOUNT_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Dose amount (ml)']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_PATIENT_VACCINATION_DOSE_AMOUNT_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Dose amount']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") -PATIENT_VACCINATION_PRESCRIBING_METHOD_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Prescribing method']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_PATIENT_VACCINATION_PRESCRIBING_METHOD_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Prescribing method']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") PATIENT_VACCINATION_VACCINATOR_LABEL_ELEMENT = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Vaccinator']/following-sibling::dd[@class='nhsuk-summary-list__value']") -CHANGE_PATIENT_VACCINATION_VACCINATOR_BUTTON = ("//div[@class='nhsuk-summary-list__row']/dt[text()='Vaccinator']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change']") PATIENT_VACCINATION_COMMENTS_LABEL_ELEMENT = ("(//div[@class='nhsuk-summary-list__row']/dt[text()='Comments']/following-sibling::dd[@class='nhsuk-summary-list__value'])[2]") -CHANGE_PATIENT_VACCINATION_COMMENTS_BUTTON = ("(//div[@class='nhsuk-summary-list__row']/dt[text()='Comments']/following-sibling::dd[@class='nhsuk-summary-list__actions']/button[text()='Change'])[2]") +CHANGE_VACCINATE_PAGE_DETAILS_BUTTON = ("//button[text()='Change vaccinate page details']") CONFIRM_DETAILS_AND_SAVE_BUTTON = ("//button[text()='Confirm details and save']") CANCEL_CONFIRM_DETAILS_BUTTON = ("//button[text()='Cancel']") BACK_ON_CONFIRM_DETAILS_PAGE_BUTTON = ("//a[contains(@href, '/vaccination/add')]") -def click_change_patient_eligible_answer_button(): - find_element_and_perform_action(CHANGE_PATIENT_ELIGIBLE_FOR_VACCINE_ANSWER_BUTTON, "click") +def click_change_assess_patient_page_details_button(): + find_element_and_perform_action(CHANGE_PATIENT_ASSESSMENT_PAGE_DETAILS_BUTTON, "click") -def click_change_patient_eligibility_type_button(): - find_element_and_perform_action(CHANGE_PATIENT_ELIGIBILITY_TYPE_BUTTON, "click") +def click_change_patient_record_consent_page_details_button(): + find_element_and_perform_action(CHANGE_RECORD_CONSENT_PAGE_DETAILS_BUTTON, "click") -def click_change_patient_eligibility_assessing_clinician_button(): - find_element_and_perform_action(CHANGE_PATIENT_ELIGIBILITY_ASSESSING_CLINICIAN_BUTTON, "click") - -def click_change_patient_eligibility_assessment_date_button(): - find_element_and_perform_action(CHANGE_PATIENT_ELIGIBILITY_ASSESSMENT_DATE_BUTTON, "click") - -def click_change_patient_eligibility_assessment_outcome_button(): - find_element_and_perform_action(CHANGE_PATIENT_ELIGIBILITY_ASSESSMENT_OUTCOME_BUTTON, "click") - -def click_change_patient_eligibility_assessment_comments_button(): - find_element_and_perform_action(CHANGE_PATIENT_ELIGIBILITY_ASSESSMENT_COMMENTS_BUTTON, "click") - -def click_change_patient_consent_given_answer_button(): - find_element_and_perform_action(CHANGE_PATIENT_CONSENT_GIVEN_VALUE_BUTTON, "click") - -def click_change_patient_consent_given_by_button(): - find_element_and_perform_action(CHANGE_PATIENT_CONSENT_GIVEN_BY_BUTTON, "click") - -def click_change_patient_consent_given_by_name_of_person_button(): - find_element_and_perform_action(CHANGE_CONSENT_NAME_OF_PERSON_CONSENTING_BUTTON, "click") - -def click_change_patient_consenting_relationship_to_patient_button(): - find_element_and_perform_action(CHANGE_CONSENT_PERSON_CONSENTING_RELATIONSHIP_TO_PATIENT_BUTTON, "click") - -def click_change_patient_consent_recorded_by_clinician_button(): - find_element_and_perform_action(CHANGE_CONSENT_RECORDED_BY_CLINICIAN_BUTTON, "click") - -def click_change_patient_vaccinated_answer_button(): - find_element_and_perform_action(CHANGE_PATIENT_VACCINATED_BUTTON, "click") - -def click_change_patient_vaccination_date_button(): - find_element_and_perform_action(CHANGE_PATIENT_VACCINATION_DATE_BUTTON, "click") - -def click_change_patient_vaccination_vaccine_button(): - find_element_and_perform_action(CHANGE_PATIENT_VACCINATION_VACCINE_BUTTON, "click") - -def click_change_patient_vaccination_route_button(): - find_element_and_perform_action(CHANGE_PATIENT_VACCINATION_ROUTE_BUTTON, "click") - -def click_change_patient_vaccination_batch_number_button(): - find_element_and_perform_action(CHANGE_PATIENT_VACCINATION_BATCH_NUMBER_BUTTON, "click") - -def click_change_patient_vaccination_batch_expiry_date_button(): - find_element_and_perform_action(CHANGE_PATIENT_VACCINATION_BATCH_EXPIRY_DATE_BUTTON, "click") - -def click_change_patient_vaccination_vaccinator_button(): - find_element_and_perform_action(CHANGE_PATIENT_VACCINATION_VACCINATOR_BUTTON, "click") - -def click_change_patient_vaccination_comments_button(): - find_element_and_perform_action(CHANGE_PATIENT_VACCINATION_COMMENTS_BUTTON, "click") - -def click_change_patient_vaccination_prescribing_method_button(): - find_element_and_perform_action(CHANGE_PATIENT_VACCINATION_PRESCRIBING_METHOD_BUTTON, "click") - -def click_change_patient_vaccination_dose_amount_button(): - find_element_and_perform_action(CHANGE_PATIENT_VACCINATION_DOSE_AMOUNT_BUTTON, "click") +def click_change_patient_vaccinate_page_details_button(): + find_element_and_perform_action(CHANGE_VACCINATE_PAGE_DETAILS_BUTTON, "click") def click_confirm_details_and_save_button(): find_element_and_perform_action(CONFIRM_DETAILS_AND_SAVE_BUTTON, "click") @@ -146,21 +70,6 @@ def get_patient_address_value(): def get_patient_nhs_number_value(): return find_element_and_perform_action(PATIENT_NHS_NUMBER_LABEL_ELEMENT, "get_text") -def get_vaccinator_organisation_value(): - return find_element_and_perform_action(VACCINATOR_ORGANISATION_LABEL_ELEMENT, "get_text") - -def get_vaccinator_site_value(): - return find_element_and_perform_action(VACCINATOR_SITE_LABEL_ELEMENT, "get_text") - -def get_vaccinator_care_model_value(): - return find_element_and_perform_action(VACCINATOR_CARE_MODEL_LABEL_ELEMENT, "get_text") - -def get_patient_chosen_vaccine_value(): - return find_element_and_perform_action(PATIENT_CHOSEN_VACCINE_LABEL_ELEMENT, "get_text") - -def get_patient_vaccine_type_chosen_vaccine_value(): - return find_element_and_perform_action(PATIENT_CHOSEN_VACCINE_TYPE_LABEL_ELEMENT, "get_text") - def get_patient_eligibility_for_vaccine_value(): return find_element_and_perform_action(PATIENT_ELIGIBLE_FOR_VACCINE_LABEL_ELEMENT, "get_text") @@ -180,7 +89,7 @@ def get_patient_eligibility_assessment_comments_value(): return find_element_and_perform_action(PATIENT_ELIGIBILITY_ASSESSMENT_COMMENTS_LABEL_ELEMENT, "get_text") def get_patient_consented_given_value(): - return find_element_and_perform_action(PATIENT_CONSENT_GIVEN_VALUE_LABEL_ELEMENT, "get_text") + return find_element_and_perform_action(PATIENT_CONSENT_LABEL_ELEMENT, "get_text") def get_patient_consent_given_by_value(): return find_element_and_perform_action(PATIENT_CONSENT_GIVEN_BY_LABEL_ELEMENT, "get_text") @@ -201,23 +110,23 @@ def get_patient_vaccinated_date_value(): return find_element_and_perform_action(PATIENT_VACCINATION_DATE_LABEL_ELEMENT, "get_text") def get_patient_vaccinated_chosen_vaccine_value(): - return find_element_and_perform_action(PATIENT_VACCINATED_VACCINE_LABEL_ELEMENT, "get_text") + return find_element_and_perform_action(PATIENT_VACCINE_LABEL_ELEMENT, "get_text") + +def get_patient_vaccinated_chosen_vaccine_product_value(): + return find_element_and_perform_action(PATIENT_VACCINE_PRODUCT_LABEL_ELEMENT, "get_text") -def get_patient_vaccination_route_value(): - return find_element_and_perform_action(PATIENT_VACCINATION_ROUTE_LABEL_ELEMENT, "get_text") +def get_patient_vaccination_site_value(): + return find_element_and_perform_action(PATIENT_VACCINATION_SITE_LABEL_ELEMENT, "get_text") def get_patient_vaccination_batch_number_value(): - return find_element_and_perform_action(PATIENT_VACCINATION_BATCH_NUMBER_LABEL_ELEMENT, "get_text") + return find_element_and_perform_action(PATIENT_VACCINE_BATCH_LABEL_ELEMENT, "get_text") def get_patient_vaccination_batch_expiry_date_value(): - return find_element_and_perform_action(PATIENT_VACCINATION_BATCH_EXPIRY_DATE_LABEL_ELEMENT, "get_text") + return find_element_and_perform_action(PATIENT_VACCINE_BATCH_EXPIRY_DATE_LABEL_ELEMENT, "get_text") def get_patient_vaccination_dose_amount_value(): return find_element_and_perform_action(PATIENT_VACCINATION_DOSE_AMOUNT_LABEL_ELEMENT, "get_text") -def get_patient_vaccination_prescribing_method_value(): - return find_element_and_perform_action(PATIENT_VACCINATION_PRESCRIBING_METHOD_LABEL_ELEMENT, "get_text") - def get_patient_vaccination_vaccinator_value(): return find_element_and_perform_action(PATIENT_VACCINATION_VACCINATOR_LABEL_ELEMENT, "get_text") diff --git a/pages/home_page.py b/pages/home_page.py index 8ad5cc1a4..b6af37ffb 100644 --- a/pages/home_page.py +++ b/pages/home_page.py @@ -1,7 +1,7 @@ from init_helpers import * -LOGOUT_NAV_ELEMENT = ("//a[text()='Log Out']") -LOGOUT_NAV_ELEMENT = ("//a[text()='Log Out']") +LOGOUT_NAV_ELEMENT = ("//a[text()='Log Out']") +LOGOUT_NAV_ELEMENT = ("//a[text()='Log Out']") PROFILE_NAV_ELEMENT = ("//a[@href='/profile']") APPOINTMENTS_NAV_ELEMENT = ("//a[@href='/appointment']") PDS_SEARCH_NAV_ELEMENT = ("//a[@href='/patient-search/details']") @@ -25,55 +25,46 @@ def click_navlinkbar_toggler(): find_element_and_perform_action(NAVLINK_BAR_TOGGLER, "click") def check_logout_button_exists(): - return check_element_exists(LOGOUT_NAV_ELEMENT, True) + return check_element_exists(LOGOUT_NAV_ELEMENT, True) def check_navbar_toggle_exists_without_waiting(): - return check_element_exists(NAV_BAR_TOGGLER, False) + return check_element_exists(NAV_BAR_TOGGLER, False) def check_navbar_toggle_exists(): - return check_element_exists(NAV_BAR_TOGGLER, True) + return check_element_exists(NAV_BAR_TOGGLER, True) def check_navlink_bar_toggle_exists_without_waiting(): - return check_element_exists(NAVLINK_BAR_TOGGLER, False) + return check_element_exists(NAVLINK_BAR_TOGGLER, False) def check_navlink_bar_toggle_exists(): - return check_element_exists(NAVLINK_BAR_TOGGLER, True) + return check_element_exists(NAVLINK_BAR_TOGGLER, True) def check_logout_button_exists_without_waiting(): - return check_element_exists(LOGOUT_NAV_ELEMENT, False) + return check_element_exists(LOGOUT_NAV_ELEMENT, False) def click_profile_nav_link(): - wait_for_page_to_load() find_element_and_perform_action(PROFILE_NAV_ELEMENT, "click") def click_appointments_nav_link(): - wait_for_page_to_load() - find_element_and_perform_action(APPOINTMENTS_NAV_ELEMENT, "click") + find_element_and_perform_action(APPOINTMENTS_NAV_ELEMENT, "click") def click_pds_search_nav_link(): - wait_for_page_to_load() - find_element_and_perform_action(PDS_SEARCH_NAV_ELEMENT, "click") + find_element_and_perform_action(PDS_SEARCH_NAV_ELEMENT, "click") def click_records_nav_link(): - wait_for_page_to_load() - find_element_and_perform_action(RECORDS_NAV_ELEMENT, "click") + find_element_and_perform_action(RECORDS_NAV_ELEMENT, "click") def click_dashboard_nav_link(): - wait_for_page_to_load() - find_element_and_perform_action(DASHBOARD_NAV_ELEMENT, "click") + find_element_and_perform_action(DASHBOARD_NAV_ELEMENT, "click") def click_reports_nav_link(): - wait_for_page_to_load() - find_element_and_perform_action(REPORTS_NAV_ELEMENT, "click") + find_element_and_perform_action(REPORTS_NAV_ELEMENT, "click") def click_settings_nav_link(): - wait_for_page_to_load() - find_element_and_perform_action(SETTINGS_NAV_ELEMENT, "click") + find_element_and_perform_action(SETTINGS_NAV_ELEMENT, "click") def click_workflows_nav_link(): - wait_for_page_to_load() - find_element_and_perform_action(WORKFLOWS_NAV_ELEMENT, "click") + find_element_and_perform_action(WORKFLOWS_NAV_ELEMENT, "click") def click_find_a_patient_nav_link(): - wait_for_page_to_load() - find_element_and_perform_action(FIND_A_PATIENT_NAV_ELEMENT, "click") \ No newline at end of file + find_element_and_perform_action(FIND_A_PATIENT_NAV_ELEMENT, "click") diff --git a/pages/login_page.py b/pages/login_page.py index 0c0d690e2..784829478 100644 --- a/pages/login_page.py +++ b/pages/login_page.py @@ -8,10 +8,8 @@ def navigate_to_ravs_login_page(url): wait_for_element_to_appear(ACCEPT_COOKIES_ELEMENT) if check_element_exists(ACCEPT_COOKIES_ELEMENT): find_element_and_perform_action(ACCEPT_COOKIES_ELEMENT, "click") - wait_for_page_to_load() def check_login_button_exists(): - wait_for_page_to_load() return check_element_exists(LOGIN_BUTTON_ELEMENT, True) def click_login_button(): diff --git a/pages/nhs_signin_page.py b/pages/nhs_signin_page.py index 8802d1146..bc95d8da6 100644 --- a/pages/nhs_signin_page.py +++ b/pages/nhs_signin_page.py @@ -49,5 +49,4 @@ def get_emailAddress_missing_error_text(): return find_element_and_perform_action(ALERT_TEXT_EMAILADDRESS, "get_text") def check_unable_to_sign_in_error_exists(): - wait_for_page_to_load() return check_element_exists(ERROR_UNABLE_TO_SIGN_IN, True) diff --git a/pages/patient_details_page.py b/pages/patient_details_page.py index 26651cdef..04bae98ca 100644 --- a/pages/patient_details_page.py +++ b/pages/patient_details_page.py @@ -161,5 +161,4 @@ def click_back_button(): find_element_and_perform_action(BACK_BUTTON, "click") def check_choose_vaccine_button_exists(): - wait_for_page_to_load() return check_element_exists(CHOOSE_VACCINE_BUTTON, True) diff --git a/pages/record_consent_page.py b/pages/record_consent_page.py index c6d8581af..8da47b3ad 100644 --- a/pages/record_consent_page.py +++ b/pages/record_consent_page.py @@ -27,29 +27,29 @@ def click_no_to_consent(): find_element_and_perform_action(NO_CONSENT_RADIO_BUTTON, "click") def select_consent_clinician_with_name_and_council(nameandcouncil): - wait_for_element_to_appear(CONSENT_CLINICIAN_DROPDOWN_ELEMENT) - find_element_and_perform_action(CONSENT_CLINICIAN_DROPDOWN_ELEMENT, "select_option", nameandcouncil) + if check_element_enabled(CONSENT_CLINICIAN_DROPDOWN_ELEMENT): + find_element_and_perform_action(CONSENT_CLINICIAN_DROPDOWN_ELEMENT, "select_option", nameandcouncil) def select_reason_for_no_consent(reason): - find_element_and_perform_action(NO_CONSENT_REASON_DROPDOWN_ELEMENT, "select_option", reason) + find_element_and_perform_action(NO_CONSENT_REASON_DROPDOWN_ELEMENT, "select_option", reason) def select_consent_given_by_from_dropdown(givenBy): - find_element_and_perform_action(CONSENT_GIVEN_BY_DROPDOWN_ELEMENT, "select_option", givenBy) + find_element_and_perform_action(CONSENT_GIVEN_BY_DROPDOWN_ELEMENT, "select_option", givenBy) def select_consentType(consentType): - find_element_and_perform_action(CONSENT_TYPE_DROPDOWN_ELEMENT, "select_option", consentType) + find_element_and_perform_action(CONSENT_TYPE_DROPDOWN_ELEMENT, "select_option", consentType) def click_save_and_return_button_on_record_consent_page(): - find_element_and_perform_action(SAVE_AND_RETURN_BUTTON, "click") + find_element_and_perform_action(SAVE_AND_RETURN_BUTTON, "click") def click_continue_to_vaccinate_button(): - find_element_and_perform_action(CONTINUE_TO_VACCINATE_BUTTON, "click") + find_element_and_perform_action(CONTINUE_TO_VACCINATE_BUTTON, "click") def check_continue_to_vaccinate_patient_button_exists(): - return check_element_exists(CONTINUE_TO_VACCINATE_BUTTON) + return check_element_exists(CONTINUE_TO_VACCINATE_BUTTON) def check_required_alert_exists(wait): - return check_element_exists(REQUIRED_ALERT_BUTTON, wait) + return check_element_exists(REQUIRED_ALERT_BUTTON, wait) def check_name_of_person_consenting_input_element_exists(wait): return check_element_exists(NAME_OF_PERSON_CONSENTING_INPUT_ELEMENT, wait) @@ -67,4 +67,4 @@ def enter_relationship_to_patient(relationship): find_element_and_perform_action(RELATION_TO_PATIENT_INPUT_ELEMENT, "input_text", relationship) def enter_clinician_details(clinician): - find_element_and_perform_action(RESPONSIBLE_CLINICIAN_INPUT_ELEMENT, "input_text", clinician) \ No newline at end of file + find_element_and_perform_action(RESPONSIBLE_CLINICIAN_INPUT_ELEMENT, "input_text", clinician) diff --git a/pages/record_vaccinated_page.py b/pages/record_vaccinated_page.py index e7f8639e2..b48cbc036 100644 --- a/pages/record_vaccinated_page.py +++ b/pages/record_vaccinated_page.py @@ -15,7 +15,7 @@ CONSENT_GIVEN_BY_DROPDOWN_ELEMENT = ("#ConsentTypeId") VACCINATION_DATE_INPUT_ELEMENT = ("#VaccinationDate") VACCINATION_COMMENTS_ELEMENT = ("#VaccinationComments") -VACCINATION_ROUTE_DROPDOWN_ELEMENT = ("#VaccinationRouteId") +VACCINATION_SITE_DROPDOWN_ELEMENT = ("#VaccinationSiteId") BATCH_NUMBER_DROPDOWN_ELEMENT = ("#BatchNumber") BATCH_EXPIRY_DATE_READONLY_ELEMENT = ("#BatchExpiryDate") DOSE_AMOUNT_READONLY_ELEMENT = ("#DoseAmount") @@ -50,10 +50,11 @@ def click_not_vaccinated_radiobutton(): find_element_and_perform_action(NO_VACCINATED_RADIO_BUTTON, "click") def select_vaccinator_name_and_council(nameandcouncil): - find_element_and_perform_action(VACCINATOR_DROPDOWN_ELEMENT, "select_option", nameandcouncil) + if check_element_enabled(VACCINATOR_DROPDOWN_ELEMENT): + find_element_and_perform_action(VACCINATOR_DROPDOWN_ELEMENT, "select_option", nameandcouncil) -def select_vaccination_route(route): - find_element_and_perform_action(VACCINATION_ROUTE_DROPDOWN_ELEMENT, "select_option", route) +def select_vaccination_site(site): + find_element_and_perform_action(VACCINATION_SITE_DROPDOWN_ELEMENT, "select_option", site) def select_batch_number(batchNumber): find_element_and_perform_action(BATCH_NUMBER_DROPDOWN_ELEMENT, "click") @@ -110,17 +111,6 @@ def click_covid_vaccine_type_radiobutton_choose_vaccine_for_patient_on_vaccinate else: print("Invalid vaccine type") -def click_prescribing_method(prescribing_method): - xpath_map = { - "national protocol (np)": "//label[@for='PrescribingMethodId-1']", - "patient group directions (pgd)": "//label[@for='PrescribingMethodId-2']", - "patient specific directions (psd)": "//label[@for='PrescribingMethodId-3']", - } - element = xpath_map.get(prescribing_method.lower()) - if element: - find_element_and_perform_action(element, "click") - else: - print("Invalid vaccine type") def click_flu_vaccine_type_radiobutton_choose_vaccine_for_patient_on_vaccinated_page(vaccinetype): diff --git a/pages/site_vaccines_page.py b/pages/site_vaccines_page.py index 826e26b7e..b1b383fe3 100644 --- a/pages/site_vaccines_page.py +++ b/pages/site_vaccines_page.py @@ -1,7 +1,7 @@ from init_helpers import * -ADD_VACCINES_BUTTON = ("//button [text()='Add vaccines']") -ADD_BATCHES_BUTTON = ("//button [text()='Add batches']") +ADD_VACCINES_BUTTON = ("//a[text()='Add vaccines']") +ADD_BATCHES_BUTTON = ("//a[text()='Add batches']") SELECT_SITE_DROPDOWN = ("//select[@name='SiteId']") BACK_BUTTON_ON_VACCINES_PAGE = ("(//a[@href='/settings'])[2]") CONFIRM_CHOICES_BUTTON = ("//button[text()='Confirm choices']") diff --git a/test_data/get_values_from_models.py b/test_data/get_values_from_models.py index c901a6cc7..a784c7006 100644 --- a/test_data/get_values_from_models.py +++ b/test_data/get_values_from_models.py @@ -7,7 +7,7 @@ from test_data.models.job_roles import job_roles from test_data.models.consent_decision import consent_decision from test_data.models.eligible_decision import eligible_decision -from test_data.models.vaccination_routes import vaccination_routes +from test_data.models.vaccination_sites import vaccination_sites from test_data.models.vaccinated_decision import vaccinated_decision from test_data.models.vaccinating_clinicians import vaccinating_clinicians from test_data.models.consent_types import consent_types @@ -15,7 +15,7 @@ from test_data.models.assess_outcome_decisions import assessment_outcome from test_data.models.assessing_clinicians import assessing_clinicians from test_data.models.care_models import care_models -from test_data.models.prescribing_methods import prescribing_methods +from test_data.models.legal_mechanism import legal_mechanism from test_data.models.assess_vaccine_not_given_reasons import assessment_vaccine_not_given_reasons from test_data.models.no_consent_reasons import no_consent_reasons from test_data.models.no_vaccination_reasons import assessment_vaccine_not_given_reasons @@ -83,11 +83,11 @@ def get_vaccination_type(index, vaccine): elif vaccine.lower() == "flu": return flu_vaccine_types[get_wrapped_index(index, len(flu_vaccine_types))] -def get_vaccination_route(index): - return vaccination_routes[get_wrapped_index(index, len(vaccination_routes))] +def get_vaccination_site(index): + return vaccination_sites[get_wrapped_index(index, len(vaccination_sites))] -def get_prescribing_method(index): - return prescribing_methods[get_wrapped_index(index, len(prescribing_methods))] +def get_legal_mechanism(index): + return legal_mechanism[get_wrapped_index(index, len(legal_mechanism))] def get_vaccinator(index): return vaccinating_clinicians[get_wrapped_index(index, len(vaccinating_clinicians))] diff --git a/test_data/models/prescribing_methods.py b/test_data/models/legal_mechanism.py similarity index 82% rename from test_data/models/prescribing_methods.py rename to test_data/models/legal_mechanism.py index f69916f54..1349d428f 100644 --- a/test_data/models/prescribing_methods.py +++ b/test_data/models/legal_mechanism.py @@ -1,4 +1,4 @@ -prescribing_methods = [ +legal_mechanism = [ "National Protocol (NP)", "Patient Group Directions (PGD)", "Patient Specific Directions (PSD)" diff --git a/test_data/models/vaccination_routes.py b/test_data/models/vaccination_sites.py similarity index 86% rename from test_data/models/vaccination_routes.py rename to test_data/models/vaccination_sites.py index 0135d462d..1b06bd14c 100644 --- a/test_data/models/vaccination_routes.py +++ b/test_data/models/vaccination_sites.py @@ -1,4 +1,4 @@ -vaccination_routes = [ +vaccination_sites = [ "Left upper arm", "Right upper arm", "Left buttock", diff --git a/test_data/record_vaccine_data_all_yes_9470040228.json b/test_data/record_vaccine_data_all_yes_9470040228.json index db814a42b..d39096362 100644 --- a/test_data/record_vaccine_data_all_yes_9470040228.json +++ b/test_data/record_vaccine_data_all_yes_9470040228.json @@ -26,7 +26,7 @@ "batch_number_to_select": "SDYY2-12 - 19/10/2025", "batch_expiry_date": "19/10/2025", "dose_amount": "0.3", - "prescribing_method": "National Protocol (NP)", + "legal_mechanism": "National Protocol (NP)", "vaccinator": "Frazer Brindley - NMC (Nursing and Midwifery Council), NMC005", "no_vaccination_reason": "Not appropriate to vaccinate today, patient advised to rebook", "vaccination_comments": "", diff --git a/test_data/record_vaccine_data_all_yes_9470057589.json b/test_data/record_vaccine_data_all_yes_9470057589.json index 2650ce03d..3d9027f82 100644 --- a/test_data/record_vaccine_data_all_yes_9470057589.json +++ b/test_data/record_vaccine_data_all_yes_9470057589.json @@ -26,7 +26,7 @@ "batch_number_to_select": "sb12345-12 - 19/2/2026", "batch_expiry_date": "19/2/2026", "dose_amount": "0.3", - "prescribing_method": "Patient Group Directions (PGD)", + "legal_mechanism": "Patient Group Directions (PGD)", "vaccinator": "Neelima Guntupalli - GPhC (General Pharmaceutical Council), 008008", "no_vaccination_reason": "Not appropriate to vaccinate today, patient advised to rebook", "vaccination_comments": "", diff --git a/test_data/record_vaccine_data_all_yes_9472710255.json b/test_data/record_vaccine_data_all_yes_9472710255.json index 44d0430fe..96d8d5577 100644 --- a/test_data/record_vaccine_data_all_yes_9472710255.json +++ b/test_data/record_vaccine_data_all_yes_9472710255.json @@ -27,7 +27,7 @@ "batch_number_to_select": "sb12345-12 - 19/2/2026", "batch_expiry_date": "19/2/2026", "dose_amount": "0.3", - "prescribing_method": "Patient Group Directions (PGD)", + "legal_mechanism": "Patient Group Directions (PGD)", "vaccinator": "Neelima Guntupalli - GPhC (General Pharmaceutical Council), 008008", "no_vaccination_reason": "Not appropriate to vaccinate today, patient advised to rebook", "vaccination_comments": "", diff --git a/test_data/record_vaccine_data_all_yes_9693632109.json b/test_data/record_vaccine_data_all_yes_9693632109.json index 1e6038651..3c9836634 100644 --- a/test_data/record_vaccine_data_all_yes_9693632109.json +++ b/test_data/record_vaccine_data_all_yes_9693632109.json @@ -27,7 +27,7 @@ "batch_number_to_select": "SDYY2-12 - 19/10/2025", "batch_expiry_date": "19/10/2025", "dose_amount": "0.3", - "prescribing_method": "National Protocol (NP)", + "legal_mechanism": "National Protocol (NP)", "vaccinator": "Neelima Guntupalli - GPhC (General Pharmaceutical Council), 008008", "no_vaccination_reason": "Not appropriate to vaccinate today, patient advised to rebook", "vaccination_comments": "Automated vaccine_data_all_yes - Patient is eligible and consented and vaccinated, vaccination comments", diff --git a/test_data/record_vaccine_data_not_eligible_consented_vaccinated.json b/test_data/record_vaccine_data_not_eligible_consented_vaccinated.json index 5348642b9..440fe3537 100644 --- a/test_data/record_vaccine_data_not_eligible_consented_vaccinated.json +++ b/test_data/record_vaccine_data_not_eligible_consented_vaccinated.json @@ -26,7 +26,7 @@ "batch_number_to_select": "SDYY2-12 - 19/10/2025", "batch_expiry_date": "19/10/2025", "dose_amount": "0.3", - "prescribing_method": "National Protocol (NP)", + "legal_mechanism": "National Protocol (NP)", "vaccinator": "Neelima Guntupalli - GPhC (General Pharmaceutical Council), 008008", "no_vaccination_reason": "Not appropriate to vaccinate today, patient advised to rebook", "vaccination_comments": "Automated record_vaccine_data_not_eligible_consented_vaccinated - Patient is not eligible and consented and vaccinated, vaccination comments", diff --git a/test_data/record_vaccine_data_not_eligible_not_consented.json b/test_data/record_vaccine_data_not_eligible_not_consented.json index 65e93ef9b..8ab39c48b 100644 --- a/test_data/record_vaccine_data_not_eligible_not_consented.json +++ b/test_data/record_vaccine_data_not_eligible_not_consented.json @@ -26,7 +26,7 @@ "batch_number_to_select": "SDYY2-12 - 19/10/2025", "batch_expiry_date": "19/10/2025", "dose_amount": "0.3", - "prescribing_method": "National Protocol (NP)", + "legal_mechanism": "National Protocol (NP)", "vaccinator": "Neelima Guntupalli - GPhC (General Pharmaceutical Council), 008008", "no_vaccination_reason": "Not appropriate to vaccinate today, patient advised to rebook", "vaccination_comments": "Automated vaccine_data_not_eligible_not_consented Patient is National eligible and consented and vaccinated, vaccination comments", diff --git a/tests/test_add_vaccine_batches_steps.py b/tests/test_add_vaccine_batches_steps.py index 78e7fe005..2e3dd6a47 100644 --- a/tests/test_add_vaccine_batches_steps.py +++ b/tests/test_add_vaccine_batches_steps.py @@ -91,7 +91,6 @@ def i_enter_batchprefix_and_batchsuffix(batchprefix, batchsuffix, shared_data): enter_flu_batch_number(batchprefix) attach_screenshot("entered_batch_number") - @when(parse("I enter {expirydate}")) def i_enter_expiryDate(expirydate, shared_data): expirydate = format_date(str(get_date_value(expirydate)), config["browser"]) @@ -99,19 +98,16 @@ def i_enter_expiryDate(expirydate, shared_data): shared_data["expiryDate"] = expirydate attach_screenshot("entered_expiry_date") - @when("I click Add batch button") def i_click_add_batch_button(): Click_add_batch_button() attach_screenshot("clicked_add_batch_button") - @when("I click confirm choices button") def i_click_confirm_choices_button(): click_confirm_vaccine_batch_choices_button() attach_screenshot("clicked_confirm_choices_button") - @when("I click confirm button") def i_click_confirm_button(): click_confirm_button() diff --git a/tests/test_record_a_vaccine_for_patient_with_nhs_number_steps.py b/tests/test_record_a_vaccine_for_patient_with_nhs_number_steps.py index edf61ddf6..879bb60d7 100644 --- a/tests/test_record_a_vaccine_for_patient_with_nhs_number_steps.py +++ b/tests/test_record_a_vaccine_for_patient_with_nhs_number_steps.py @@ -49,7 +49,7 @@ def step_login_to_ravs(site, care_model, nhs_number, index, chosen_vaccine, batc today = datetime.strptime(today_str, '%d/%m/%Y') if datetime.strptime(batch_expiry_date, '%d/%m/%Y') <= today: batch_expiry_date = today + timedelta(days=7) - batch_expiry_date = batch_expiry_date.strftime('%d/m/%y') + batch_expiry_date = standardize_date_format(batch_expiry_date) shared_data["batch_expiry_date"] = batch_expiry_date check_vaccine_and_batch_exists_in_site(site, chosen_vaccine, vaccine_type, batch_number, batch_expiry_date) check_vaccine_and_batch_exists_in_site(site, chosen_vaccine, shared_data["vaccinated_type2"], batch_number, batch_expiry_date) @@ -75,6 +75,7 @@ def step_choose_vaccine_and_vaccine_type(shared_data, chosen_vaccine, vaccine_ty @when(parse("I assess the patient's {eligibility} with the details and date as {assess_date} and click continue to record consent screen button")) def step_assess_eligibility_and_click_continue_record_consent_screen(shared_data, eligibility, assess_date): shared_data['eligible_decision'] = eligibility + shared_data['legal_mechanism'] = get_legal_mechanism(shared_data["index"]) shared_data['eligibility_type'] = get_eligibility_type(shared_data["index"], shared_data["chosen_vaccine"]) shared_data["healthcare_worker"] = get_staff_role(shared_data["index"]) shared_data['eligibility_assessing_clinician'] = get_assessing_clinician(shared_data["index"]) @@ -83,7 +84,7 @@ def step_assess_eligibility_and_click_continue_record_consent_screen(shared_data shared_data['eligibility_assessment_outcome'] = get_assessment_outcome(shared_data["index"]) shared_data['eligibility_assessment_no_vaccine_given_reason'] = get_assess_vaccine_not_given_reason(shared_data["index"]) shared_data['assessment_comments'] = "Assessment comments " + assess_date + shared_data["patient_name"] - assess_patient_with_details_and_click_continue_to_consent(eligibility, shared_data['eligibility_type'], shared_data["healthcare_worker"], shared_data['eligibility_assessing_clinician'], assess_date, shared_data['eligibility_assessment_outcome'], shared_data['assessment_comments'],shared_data['eligibility_assessment_no_vaccine_given_reason']) + assess_patient_with_details_and_click_continue_to_consent(eligibility, shared_data['eligibility_type'], shared_data["healthcare_worker"], shared_data['eligibility_assessing_clinician'], assess_date, shared_data['legal_mechanism'], shared_data['eligibility_assessment_outcome'], shared_data['assessment_comments'],shared_data['eligibility_assessment_no_vaccine_given_reason']) @when(parse("I record {consent} with the details and click continue to vaccinate button")) def step_record_consent_and_click_continue_to_vaccinate_screen(shared_data, consent): @@ -92,7 +93,10 @@ def step_record_consent_and_click_continue_to_vaccinate_screen(shared_data, cons shared_data['consent_given_by'] = get_consent_given_by(shared_data["index"]) name_of_person_consenting = "Automation tester" relationship_to_patient = "RAVS tester" - shared_data['consent_clinician_details'] = get_consenting_clinician(shared_data["index"]) + if shared_data['legal_mechanism'] == "Patient Group Directions (PGD)": + shared_data['consent_clinician_details'] = shared_data['eligibility_assessing_clinician'] + else: + shared_data['consent_clinician_details'] = get_consenting_clinician(shared_data["index"]) shared_data["no_consent_reason"] = get_no_consent_reason(shared_data["index"]) record_consent_details_and_click_continue_to_vaccinate(shared_data['consent_decision'],shared_data['consent_given_by'], name_of_person_consenting, relationship_to_patient, shared_data['consent_clinician_details'], shared_data["no_consent_reason"]) @@ -103,13 +107,16 @@ def step_enter_vaccination_details_and_continue_to_check_and_confirm_screen(shar if shared_data["eligibility_assessment_outcome"].lower() == "Give vaccine".lower(): shared_data["vaccination_date"] = format_date(str(get_date_value(vaccination_date)), config["browser"]) chosen_vaccine = shared_data["chosen_vaccine"] - shared_data["vaccination_route"] = get_vaccination_route(shared_data["index"]) + shared_data["vaccination_site"] = get_vaccination_site(shared_data["index"]) shared_data["dose_amount"] = str(get_vaccine_dose_amount(shared_data["vaccinated_type2"])) - shared_data["prescribing_method"] = get_prescribing_method(shared_data["index"]) - shared_data["vaccinator"] = get_vaccinator(shared_data["index"]) + shared_data["legal_mechanism"] = get_legal_mechanism(shared_data["index"]) + if shared_data['legal_mechanism'] == "Patient Group Directions (PGD)": + shared_data['vaccinator'] = shared_data['eligibility_assessing_clinician'] + else: + shared_data["vaccinator"] = get_vaccinator(shared_data["index"]) shared_data["vaccination_comments"] = shared_data["vaccinated_type2"] + "vaccination given on " + shared_data["vaccination_date"] + " for " + shared_data["patient_name"] shared_data["no_vaccination_reason"] = get_vaccination_not_given_reason(shared_data["index"]) - enter_vaccine_details_and_click_continue_to_check_and_confirm(shared_data["vaccinated_decision"], shared_data["vaccination_date"], chosen_vaccine, shared_data["vaccinated_type2"], shared_data["vaccination_route"], shared_data["batch_number"], shared_data["batch_expiry_date"], shared_data["dose_amount"], shared_data["prescribing_method"] , shared_data["vaccinator"], shared_data["vaccination_comments"], shared_data["no_vaccination_reason"]) + enter_vaccine_details_and_click_continue_to_check_and_confirm(shared_data["vaccinated_decision"], shared_data["vaccination_date"], chosen_vaccine, shared_data["vaccinated_type2"], shared_data["vaccination_site"], shared_data["batch_number"], shared_data["batch_expiry_date"], shared_data["dose_amount"], shared_data["legal_mechanism"] , shared_data["vaccinator"], shared_data["vaccination_comments"], shared_data["no_vaccination_reason"]) attach_screenshot("entered_vaccination_details") @then(parse("I need to be able to see the patient {name}, {dob}, {address} and vaccination details on the check and confirm screen")) @@ -119,11 +126,15 @@ def step_see_patient_details_on_check_and_confirm_screen(shared_data, name, dob, assert get_patient_name_value() == shared_data["patient_name"] assert get_patient_address_value() == address assert get_patient_vaccination_dose_amount_value() == shared_data["dose_amount"] - assert get_patient_vaccine_type_chosen_vaccine_value() == shared_data["chosen_vaccine_type"] - assert get_patient_vaccinated_chosen_vaccine_value() == shared_data["vaccinated_type2"] - assert standardize_date_format(get_patient_eligibility_assessment_date_value()) == shared_data['eligibility_assessment_date'] - assert standardize_date_format(get_patient_vaccinated_date_value()) == shared_data['vaccination_date'] - assert dob in get_patient_dob_value() + assert get_patient_vaccinated_chosen_vaccine_value() == shared_data["chosen_vaccine"] + assert get_patient_vaccinated_chosen_vaccine_product_value() == shared_data["vaccinated_type2"] + assert get_patient_eligibility_assessment_date_value() == date_format_with_day_of_week(shared_data['eligibility_assessment_date']) + assert get_patient_vaccinated_date_value() == date_format_with_day_of_week(shared_data['vaccination_date']) + assert get_patient_dob_value() == date_format_with_age(dob) + assert get_patient_vaccination_batch_expiry_date_value() == date_format_with_name_of_month(shared_data['batch_expiry_date']) + assert get_patient_eligibility_assessing_clinician_vaccine_value() == shared_data['eligibility_assessing_clinician'] + assert get_patient_consent_recorded_by_clinician_value() == shared_data['consent_clinician_details'] + assert get_patient_vaccination_vaccinator_value() == shared_data['vaccinator'] attach_screenshot("check_and_confirm_screen_after_assertion") @then("when I click confirm and save button, the immunisation history of the patient should be updated in the patient details page")