Skip to content

Commit 387435d

Browse files
Merge branch 'main' of github.com:NHSDigital/bcss-playwright into feature/BCSS-20230-compartment-4-utils
2 parents a842776 + ec77a67 commit 387435d

19 files changed

+176
-110
lines changed

pages/base_page.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(self, page: Page):
3636
self.organisations_page = self.page.get_by_role("link", name="Organisations")
3737
self.reports_page = self.page.get_by_role("link", name="Reports")
3838
self.screening_practitioner_appointments_page = self.page.get_by_role(
39-
"link", name="Screening Practitioner"
39+
"link", name="Screening Practitioner Appointments"
4040
)
4141
self.screening_subject_search_page = self.page.get_by_role(
4242
"link", name="Screening Subject Search"
@@ -51,10 +51,7 @@ def __init__(self, page: Page):
5151
self.main_menu__header = self.page.locator("#ntshPageTitle")
5252

5353
def click_main_menu_link(self) -> None:
54-
for _ in range(3): # Try up to 3 times
55-
if self.main_menu_link.is_visible():
56-
self.click(self.main_menu_link)
57-
return # Exit if successful
54+
self.click(self.main_menu_link)
5855

5956
def click_log_out_link(self) -> None:
6057
self.click(self.log_out_link)
@@ -144,15 +141,22 @@ def go_to_screening_subject_search_page(self) -> None:
144141
self.click(self.screening_subject_search_page)
145142

146143
def click(self, locator: Locator) -> None:
144+
# Alerts table locator
145+
alerts_table = locator.get_by_role("table", name="cockpitalertbox")
147146
"""
148147
This is used to click on a locator
149148
The reason for this being used over the normal playwright click method is due to:
150149
- BCSS sometimes takes a while to render and so the normal click function 'clicks' on a locator before its available
151150
- Increases the reliability of clicks to avoid issues with the normal click method
152151
"""
152+
if alerts_table.is_visible():
153+
alerts_table.wait_for(state="attached")
154+
alerts_table.wait_for(state="visible")
155+
153156
try:
154157
self.page.wait_for_load_state("load")
155158
self.page.wait_for_load_state("domcontentloaded")
159+
self.page.wait_for_load_state("networkidle")
156160
locator.wait_for(state="attached")
157161
locator.wait_for(state="visible")
158162
locator.click()

pages/fit_test_kits/fit_test_kits_page.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ def __init__(self, page: Page):
3636
self.fit_device_id = self.page.get_by_role("textbox", name="FIT Device ID")
3737
self.fit_test_kits_title = self.page.locator("#ntshPageTitle")
3838

39+
self.sc_fit_configuration_page_screening_centre_dropdown = page.locator(
40+
"#screeningCentres"
41+
)
42+
3943
def verify_fit_test_kits_title(self) -> None:
4044
expect(self.fit_test_kits_title).to_contain_text("FIT Test Kits")
4145

pages/fit_test_kits/maintain_analysers_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ def __init__(self, page: Page):
1010
self.maintain_analysers_title = self.page.locator("#ntshPageTitle")
1111

1212
def verify_maintain_analysers_title(self) -> None:
13-
expect(self.maintain_analysers_title).to_contain_text("FIT QC Products")
13+
expect(self.maintain_analysers_title).to_contain_text("Maintain Analysers")

pages/fit_test_kits/screening_incidents_list_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ def __init__(self, page: Page):
1111

1212
def verify_screening_incidents_list_title(self) -> None:
1313
expect(self.screening_incidents_list_title).to_contain_text(
14-
"Select Screening Centre"
14+
"Screening Incidents List"
1515
)

pages/fit_test_kits/view_screening_centre_fit_configuration_page.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ def __init__(self, page: Page):
88
self.page = page
99
# View Screening Centre FIT Configuration - page locators
1010
self.view_screening_centre_body = self.page.locator("body")
11+
self.screening_centre_fit_title = self.page.get_by_role(
12+
"heading", name="View Screening Centre FIT"
13+
)
1114

1215
def verify_view_screening_centre_body(self) -> None:
1316
expect(self.view_screening_centre_body).to_contain_text("Maintain Analysers")
17+
18+
def verify_view_screening_centre_fit_title(self) -> None:
19+
expect(self.screening_centre_fit_title).to_contain_text(
20+
"View Screening Centre FIT Configuration"
21+
)

pages/gfobt_test_kits/gfobt_test_kits_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def go_to_test_kit_reading_page(self) -> None:
2525
self.click(self.test_kit_reading_page)
2626

2727
def go_to_test_kit_result_page(self) -> None:
28-
self.click(self.test_kit_reading_page)
28+
self.click(self.test_kit_result_page)
2929

3030
def go_to_create_qc_kit_page(self) -> None:
3131
self.click(self.create_qc_kit_page)

pages/reports/reports_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def click_reports_pages_update_button(self) -> None:
153153
def go_to_date_report_last_requested_page(self) -> None:
154154
self.click(self.date_report_last_requested_link)
155155

156-
def go_to_screening_subjects_with_inactive_open_episode_link_page(self) -> None:
156+
def go_to_screening_subjects_with_inactive_open_episode_page(self) -> None:
157157
self.click(self.screening_subjects_with_inactive_open_episode_link)
158158

159159
def go_to_subjects_ceased_due_to_date_of_birth_changes_page(self) -> None:

pages/screening_subject_search/subject_screening_summary.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from playwright.sync_api import Page, expect, Locator
22
from pages.base_page import BasePage
33
from enum import Enum
4+
import pytest
45

56

67
class SubjectScreeningSummary(BasePage):

tests/smokescreen/test_compartment_1.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ def test_compartment_1(page: Page, smokescreen_properties: dict) -> None:
6363
UserTools.user_login(page, "Hub Manager State Registered at BCS01")
6464

6565
# Generate Invitations
66-
BasePage(page).click_main_menu_link()
6766
BasePage(page).go_to_call_and_recall_page()
6867
CallAndRecall(page).go_to_generate_invitations_page()
6968
logging.info("Generating invitations based on the invitations plan")

tests/test_bcss_19181_users_permit_list.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def before_test(page: Page):
2929

3030
# @pytest.mark.smoke
3131
def test_only_users_on_approved_can_login_to_bcss(page: Page) -> None:
32+
#NOTE: You must be connected to the non prod vpn to connect to oracle DB and run this test
3233
# Add bcss401 user to approved users list table
3334
OracleDB().populate_ui_approved_users_table("BCSS401")
3435
# BCSS401 user successfully logs in to BCSS whilst on the approved list

0 commit comments

Comments
 (0)