Skip to content

Commit b0ea474

Browse files
Addressing comments in #29
1 parent 7d36c85 commit b0ea474

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

pages/base_page.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,13 @@ def _accept_dialog(self, dialog: Dialog) -> None:
176176
try:
177177
dialog.accept()
178178
except Exception:
179-
logging.info("Dialog already accepted")
179+
logging.warning("Dialog already handled")
180180

181181
def safe_accept_dialog(self, locator: Locator) -> None:
182182
"""
183-
This is used to accept dialogs multiple times without getting the error:
183+
Safely accepts a dialog triggered by a click, avoiding the error:
184184
playwright._impl._errors.Error: Dialog.accept: Cannot accept dialog which is already handled!
185+
If no dialog appears, continues without error.
185186
"""
186187
self.page.once("dialog", self._accept_dialog)
187188
try:

tests/smokescreen/bcss_smokescreen_tests.properties

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,10 @@
2727
# compartment 4
2828
# ----------------------------------
2929
c4_eng_weeks_to_make_available = 6
30-
# c4_eng_centre_name=Wolverhampton
31-
# c4_eng_site_name=Royal Hospital
32-
# c4_eng_practitioner_id=243
33-
# c4_eng_practitioner_name=Arvind, Vanaja
34-
# c4_eng_practitioner_name=Macarena, Gave #use this for anonymised
35-
# c4_eng_practitioner_id_for_rebooking=870
36-
# c4_eng_practitioner_name_for_rebookings=Burns, Harriet
30+
c4_eng_centre_name=BCS001 - Wolverhampton Bowel Cancer Screening Centre
31+
c4_eng_site_name1=THE ROYAL HOSPITAL (WOLVERHAMPTON)
32+
c4_eng_site_name2=The Royal Hospital (Wolverhampton)
33+
c4_eng_practitioner_name=Astonish, Ethanol
3734

3835
# ----------------------------------
3936
# compartment 6

tests/smokescreen/test_compartment_4.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,18 @@ def test_compartment_4(page: Page, smokescreen_properties: dict) -> None:
5555
smokescreen_properties["c4_eng_number_of_appointments_to_book"]
5656
)
5757

58-
logging.info("Compartment 4 - Setting up appointments")
59-
logging.info("Logging in as Screening Centre Manager at BCS001")
58+
logging.info(
59+
f"Compartment 4 - Setting up appointments for {smokescreen_properties["c4_eng_weeks_to_make_available"]} Weeks"
60+
)
6061
UserTools.user_login(page, "Screening Centre Manager at BCS001")
6162
BasePage(page).go_to_screening_practitioner_appointments_page()
6263
ScreeningPractitionerAppointmentsPage(page).go_to_set_availability_page()
6364
SetAvailabilityPage(page).go_to_practitioner_availability_page()
6465
PractitionerAvailabilityPage(page).select_site_dropdown_option(
65-
"THE ROYAL HOSPITAL (WOLVERHAMPTON)"
66+
smokescreen_properties["c4_eng_site_name1"]
6667
)
6768
PractitionerAvailabilityPage(page).select_practitioner_dropdown_option(
68-
"Astonish, Ethanol"
69+
smokescreen_properties["c4_eng_practitioner_name"]
6970
)
7071
PractitionerAvailabilityPage(page).click_calendar_button()
7172
CalendarPicker(page).select_day(datetime.today())
@@ -82,9 +83,10 @@ def test_compartment_4(page: Page, smokescreen_properties: dict) -> None:
8283
)
8384
Logout(page).log_out(close_page=False)
8485

85-
logging.info("Compartment 4 - Booking subjects to appointments")
86+
logging.info(
87+
f"Compartment 4 - Booking {smokescreen_properties["c4_eng_number_of_appointments_to_book"]} subjects to appointments"
88+
)
8689
ScreeningPractitionerAppointmentsPage(page).go_to_log_in_page()
87-
logging.info("Logging in as Hub Manager State Registered at BCS01")
8890
UserTools.user_login(page, "Hub Manager State Registered at BCS01")
8991

9092
BasePage(page).go_to_screening_practitioner_appointments_page()
@@ -100,12 +102,12 @@ def test_compartment_4(page: Page, smokescreen_properties: dict) -> None:
100102
ColonoscopyAssessmentAppointments(page).filter_by_nhs_number(nhs_number)
101103
ColonoscopyAssessmentAppointments(page).click_nhs_number_link(nhs_number_spaced)
102104
BookAppointmentPage(page).select_screening_centre_dropdown_option(
103-
"BCS001 - Wolverhampton Bowel Cancer Screening Centre"
105+
smokescreen_properties["c4_eng_centre_name"]
104106
)
105107
BookAppointmentPage(page).select_site_dropdown_option(
106108
[
107-
"The Royal Hospital (Wolverhampton) (? km)",
108-
"The Royal Hospital (Wolverhampton) (? km) (attended)",
109+
f"{smokescreen_properties["c4_eng_site_name2"]} (? km)",
110+
f"{smokescreen_properties["c4_eng_site_name2"]} (? km) (attended)",
109111
]
110112
)
111113

utils/batch_processing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def prepare_and_print_batch(page: Page, link_text) -> None:
9898
page.wait_for_timeout(
9999
1000
100100
) # This one second timeout does not affect the time to execute, as it is just used to ensure the reprepare batch button is clicked and does not instantly advance to the next step
101-
ManageActiveBatch(page).reprepare_batch_text.wait_for(timeout=100000)
101+
ManageActiveBatch(page).reprepare_batch_text.wait_for(timeout=60000)
102102

103103
# This loops through each Retrieve button and clicks each one
104104
retrieve_button_count = 0
@@ -124,7 +124,7 @@ def prepare_and_print_batch(page: Page, link_text) -> None:
124124
logging.info(
125125
f"Clicking confirm printed button {confirm_printed_button + 1}"
126126
)
127-
BasePage(page).safe_accept_dialog(
127+
ManageActiveBatch(page).safe_accept_dialog(
128128
ManageActiveBatch(page).confirm_button.nth(0)
129129
)
130130
except Exception as e:

utils/user_tools.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def user_login(page: Page, username: str) -> None:
2424
page (playwright.sync_api.Page): The Playwright page object to interact with.
2525
username (str): Enter a username that exists in the users.json file.
2626
"""
27+
logging.info(f"Logging in as {username}")
2728
# Load dotenv to enable retrieval of a password from .env file
2829
load_dotenv()
2930
# Go to base url

0 commit comments

Comments
 (0)