-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ravs 1094 automate reports feature (#34)
* Added intial test for creating reports feature * Fixed failing test for RSV * Added more tests * Fixed -pl=,'@~ * Fixed failed RSV and pertussis tests * Fixed failed RSV and pertussis tests * Updated duplicate batch error and fixed non reponsive page issues when switching from vaccines to patient search * Get sequential index instead of random index * Fixed failing RSV and pertussis tests by adding new batches tagged as Automation * Fixed failing duplicate batch test following fix of 17456 * Reduced time.sleep to see how tests fare * Reset back time and reduced them slightly * Increaed wait time for logout tests * Increaed wait time for logout tests * Increaed wait time for logout tests * Added 2 new tests to reports * Fixed add batches tests --------- Co-authored-by: root <root@FA-0817>
- Loading branch information
1 parent
62cd787
commit 82dda98
Showing
8 changed files
with
203 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,114 +1,104 @@ | ||
from init_helpers import * | ||
from test_data.get_values_from_models import get_flu_vaccine_add_batch_radio_button_xpath, get_covid_vaccine_add_batch_radio_button_xpath | ||
|
||
ADD_BATCH_BUTTON = ("//button[text()='Add batch']") | ||
SELECT_SITE_RADIOBUTTON = ("#SiteId") | ||
BACK_BUTTON_ON_VACCINE_BATCHES_PAGE = ("//a[@href='/site-vaccines']") | ||
COVID_VACCINE_RADIOBUTTON = ("//input[@class='nhsuk-radios__input' and @name='VaccineProgramId' and @value='1']") | ||
FLU_VACCINE_RADIOBUTTON = ("//input[@class='nhsuk-radios__input' and @name='VaccineProgramId' and @value='2']") | ||
CANCEL_ADDING_VACCINE_BATCHES_BUTTON = ("//button[text()='Cancel']") | ||
CONFIRM_VACCINE_BATCHES_CHOICES_BUTTON = ("//button[text()='Confirm choices']") | ||
SELECT_VACCINES_LABEL = ("//legend[text()='Select vaccines']") | ||
FLU_BATCH_NUMBER_INPUT_FIELD = ("#FluBatchNumber") | ||
COVID_BATCH_NUMBER_PREFIX_INPUT_FIELD = ("#CovidBatchNumberPrefix") | ||
COVID_BATCH_NUMBER_SUFFIX_INPUT_FIELD = ("#CovidBatchNumberSuffix") | ||
EXPIRY_DATE_DAY_INPUT_FIELD = ("#ExpiryDate_1") | ||
EXPIRY_DATE_MONTH_INPUT_FIELD = ("#ExpiryDate_2") | ||
EXPIRY_DATE_YEAR_INPUT_FIELD = ("#ExpiryDate_3") | ||
COVID_BATCH_NUMBER_PREFIX_ERROR_LABEL = ("#CovidBatchNumberPrefixIdError") | ||
COVID_BATCH_NUMBER_SUFFIX_ERROR_LABEL = ("#CovidBatchNumberSuffixIdError") | ||
EXPIRY_DAY_INPUT_ERROR_LABEL = ("#ExpiryDate_1IdError") | ||
EXPIRY_MONTH_INPUT_ERROR_LABEL = ("#ExpiryDate_2IdError") | ||
EXPIRY_YEAR_INPUT_ERROR_LABEL = ("#ExpiryDate_3IdError") | ||
REACTIVATE_BATCH_CONFIRMATION_BUTTON = ("//button[text()='Reactivate']") | ||
|
||
def click_reactivate_batch_confirmation_button(): | ||
find_element_and_perform_action(REACTIVATE_BATCH_CONFIRMATION_BUTTON, "click") | ||
|
||
def get_first_active_batch_number_value(): | ||
xpath = "(//tbody[@class='nhsuk-table__body']//tr[td[@role='cell'][3]//strong[text()='Active']][1]//td[@role='cell'])[1]" | ||
wait_for_element_to_appear(("xpath", xpath)) | ||
full_text = find_element_and_perform_action(("xpath", xpath), "get_text") | ||
batch_number = full_text.replace('Batch number', '').strip() | ||
return batch_number | ||
|
||
def check_required_field_error_appears_for_expiry_month(wait): | ||
return check_element_exists(EXPIRY_MONTH_INPUT_ERROR_LABEL, wait) | ||
|
||
def check_required_field_error_appears_for_covid_batch_prefix(wait): | ||
return check_element_exists(COVID_BATCH_NUMBER_PREFIX_ERROR_LABEL, wait) | ||
|
||
def check_required_field_error_appears_for_covid_batch_suffix(wait): | ||
return check_element_exists(COVID_BATCH_NUMBER_SUFFIX_ERROR_LABEL, wait) | ||
|
||
def check_required_field_error_appears_for_expiry_year(wait): | ||
return check_element_exists(EXPIRY_YEAR_INPUT_ERROR_LABEL, wait) | ||
|
||
def check_required_field_error_appears_for_expiry_DAY(wait): | ||
return check_element_exists(EXPIRY_DAY_INPUT_ERROR_LABEL, wait) | ||
|
||
def enter_expiry_date(date): | ||
day, month, year = date.split('/') | ||
find_element_and_perform_action(EXPIRY_DATE_DAY_INPUT_FIELD, "input_text",day) | ||
find_element_and_perform_action(EXPIRY_DATE_MONTH_INPUT_FIELD,"input_text", month) | ||
find_element_and_perform_action(EXPIRY_DATE_YEAR_INPUT_FIELD, "input_text",year) | ||
|
||
def enter_flu_batch_number(batchnumber): | ||
find_element_and_perform_action(FLU_BATCH_NUMBER_INPUT_FIELD, "input_text",batchnumber) | ||
|
||
def enter_covid_batch_number_prefix(batchnumber): | ||
find_element_and_perform_action(COVID_BATCH_NUMBER_PREFIX_INPUT_FIELD,"input_text", batchnumber) | ||
|
||
def enter_covid_batch_number_suffix(batchnumber): | ||
find_element_and_perform_action(COVID_BATCH_NUMBER_SUFFIX_INPUT_FIELD,"input_text", batchnumber) | ||
|
||
def click_back_button_on_vaccine_batches_page(): | ||
find_element_and_perform_action(BACK_BUTTON_ON_VACCINE_BATCHES_PAGE,"click") | ||
|
||
def click_select_vaccines_label(): | ||
release_mouse() | ||
find_element_and_perform_action(SELECT_VACCINES_LABEL, "click") | ||
|
||
def click_cancel_adding_vaccine_batches_button(): | ||
find_element_and_perform_action(CANCEL_ADDING_VACCINE_BATCHES_BUTTON,"click") | ||
|
||
def click_confirm_vaccine_batch_choices_button(): | ||
find_element_and_perform_action(CONFIRM_VACCINE_BATCHES_CHOICES_BUTTON, "click") | ||
|
||
def click_add_batch_button(): | ||
find_element_and_perform_action(ADD_BATCH_BUTTON, "click") | ||
|
||
def check_add_batch_button_exists(): | ||
return check_element_exists(ADD_BATCH_BUTTON, True) | ||
|
||
def check_add_batch_button_enabled(): | ||
return check_element_enabled(ADD_BATCH_BUTTON, True) | ||
|
||
def click_site_radio_button(site): | ||
element = (f"//label[text()='{site}']/preceding-sibling::input[@name='SiteId']") | ||
find_element_and_perform_action(element, "click") | ||
|
||
def click_covid_vaccine_radiobutton(): | ||
find_element_and_perform_action(COVID_VACCINE_RADIOBUTTON, "click") | ||
|
||
def click_flu_vaccine_radiobutton(): | ||
find_element_and_perform_action(FLU_VACCINE_RADIOBUTTON, "click_checkbox") | ||
|
||
def click_covid_vaccine_type_radiobutton_on_add_batches_page(vaccinetype): | ||
element = get_covid_vaccine_add_batch_radio_button_xpath(vaccinetype.lower()) | ||
if element: | ||
find_element_and_perform_action(element, "click") | ||
else: | ||
print("Invalid vaccine type") | ||
|
||
def click_flu_vaccine_type_radiobutton_on_add_batches_page(vaccinetype): | ||
element = get_flu_vaccine_add_batch_radio_button_xpath(vaccinetype.lower()) | ||
if element: | ||
find_element_and_perform_action(element, "click") | ||
else: | ||
print("Invalid vaccine type") | ||
|
||
def check_vaccine_already_added_warning_message_exists(site, vaccine): | ||
element = (f"//span[text()='{site} already has {vaccine}']") | ||
return check_element_exists(element, False) | ||
# from init_helpers import * | ||
# from test_data.get_values_from_models import get_flu_vaccine_add_batch_radio_button_xpath, get_covid_vaccine_add_batch_radio_button_xpath | ||
|
||
|
||
|
||
|
||
|
||
# COVID_BATCH_NUMBER_PREFIX_ERROR_LABEL = ("#CovidBatchNumberPrefixIdError") | ||
# COVID_BATCH_NUMBER_SUFFIX_ERROR_LABEL = ("#CovidBatchNumberSuffixIdError") | ||
# EXPIRY_DAY_INPUT_ERROR_LABEL = ("#ExpiryDate_1IdError") | ||
# EXPIRY_MONTH_INPUT_ERROR_LABEL = ("#ExpiryDate_2IdError") | ||
# EXPIRY_YEAR_INPUT_ERROR_LABEL = ("#ExpiryDate_3IdError") | ||
# REACTIVATE_BATCH_CONFIRMATION_BUTTON = ("//button[text()='Reactivate']") | ||
|
||
# def click_reactivate_batch_confirmation_button(): | ||
# find_element_and_perform_action(REACTIVATE_BATCH_CONFIRMATION_BUTTON, "click") | ||
|
||
# def get_first_active_batch_number_value(): | ||
# xpath = "(//tbody[@class='nhsuk-table__body']//tr[td[@role='cell'][3]//strong[text()='Active']][1]//td[@role='cell'])[1]" | ||
# wait_for_element_to_appear(("xpath", xpath)) | ||
# full_text = find_element_and_perform_action(("xpath", xpath), "get_text") | ||
# batch_number = full_text.replace('Batch number', '').strip() | ||
# return batch_number | ||
|
||
# def check_required_field_error_appears_for_expiry_month(wait): | ||
# return check_element_exists(EXPIRY_MONTH_INPUT_ERROR_LABEL, wait) | ||
|
||
# def check_required_field_error_appears_for_covid_batch_prefix(wait): | ||
# return check_element_exists(COVID_BATCH_NUMBER_PREFIX_ERROR_LABEL, wait) | ||
|
||
# def check_required_field_error_appears_for_covid_batch_suffix(wait): | ||
# return check_element_exists(COVID_BATCH_NUMBER_SUFFIX_ERROR_LABEL, wait) | ||
|
||
# def check_required_field_error_appears_for_expiry_year(wait): | ||
# return check_element_exists(EXPIRY_YEAR_INPUT_ERROR_LABEL, wait) | ||
|
||
# def check_required_field_error_appears_for_expiry_DAY(wait): | ||
# return check_element_exists(EXPIRY_DAY_INPUT_ERROR_LABEL, wait) | ||
|
||
# def enter_expiry_date(date): | ||
# day, month, year = date.split('/') | ||
# find_element_and_perform_action(EXPIRY_DATE_DAY_INPUT_FIELD, "input_text",day) | ||
# find_element_and_perform_action(EXPIRY_DATE_MONTH_INPUT_FIELD,"input_text", month) | ||
# find_element_and_perform_action(EXPIRY_DATE_YEAR_INPUT_FIELD, "input_text",year) | ||
|
||
# def enter_flu_batch_number(batchnumber): | ||
# find_element_and_perform_action(FLU_BATCH_NUMBER_INPUT_FIELD, "input_text",batchnumber) | ||
|
||
# def enter_covid_batch_number_prefix(batchnumber): | ||
# find_element_and_perform_action(COVID_BATCH_NUMBER_PREFIX_INPUT_FIELD,"input_text", batchnumber) | ||
|
||
# def enter_covid_batch_number_suffix(batchnumber): | ||
# find_element_and_perform_action(COVID_BATCH_NUMBER_SUFFIX_INPUT_FIELD,"input_text", batchnumber) | ||
|
||
# def click_back_button_on_vaccine_batches_page(): | ||
# find_element_and_perform_action(BACK_BUTTON_ON_VACCINE_BATCHES_PAGE,"click") | ||
|
||
# def click_select_vaccines_label(): | ||
# release_mouse() | ||
# find_element_and_perform_action(SELECT_VACCINES_LABEL, "click") | ||
|
||
# def click_cancel_adding_vaccine_batches_button(): | ||
# find_element_and_perform_action(CANCEL_ADDING_VACCINE_BATCHES_BUTTON,"click") | ||
|
||
# def click_confirm_vaccine_batch_choices_button(): | ||
# find_element_and_perform_action(CONFIRM_VACCINE_BATCHES_CHOICES_BUTTON, "click") | ||
|
||
# def click_add_batch_button(): | ||
# find_element_and_perform_action(ADD_BATCH_BUTTON, "click") | ||
|
||
# def check_add_batch_button_exists(): | ||
# return check_element_exists(ADD_BATCH_BUTTON, True) | ||
|
||
# def check_add_batch_button_enabled(): | ||
# return check_element_enabled(ADD_BATCH_BUTTON, True) | ||
|
||
# def click_site_radio_button(site): | ||
# element = (f"//label[text()='{site}']/preceding-sibling::input[@name='SiteId']") | ||
# find_element_and_perform_action(element, "click") | ||
|
||
# def click_covid_vaccine_radiobutton(): | ||
# find_element_and_perform_action(COVID_VACCINE_RADIOBUTTON, "click") | ||
|
||
# def click_flu_vaccine_radiobutton(): | ||
# find_element_and_perform_action(FLU_VACCINE_RADIOBUTTON, "click_checkbox") | ||
|
||
# def click_covid_vaccine_type_radiobutton_on_add_batches_page(vaccinetype): | ||
# element = get_covid_vaccine_add_batch_radio_button_xpath(vaccinetype.lower()) | ||
# if element: | ||
# find_element_and_perform_action(element, "click") | ||
# else: | ||
# print("Invalid vaccine type") | ||
|
||
# def click_flu_vaccine_type_radiobutton_on_add_batches_page(vaccinetype): | ||
# element = get_flu_vaccine_add_batch_radio_button_xpath(vaccinetype.lower()) | ||
# if element: | ||
# find_element_and_perform_action(element, "click") | ||
# else: | ||
# print("Invalid vaccine type") | ||
|
||
# def check_vaccine_already_added_warning_message_exists(site, vaccine): | ||
# element = (f"//span[text()='{site} already has {vaccine}']") | ||
# return check_element_exists(element, False) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.