Skip to content

Commit 11c7227

Browse files
Removing more hardcoded locators and adding them to the appropriate POMs
Altering the batch processing util to seperate it into multiple functions for easier visibility and understanding Altering the click method in the BasePage POM so that it does not constantly throw warnings
1 parent 2410bb3 commit 11c7227

34 files changed

+341
-94
lines changed

pages/base_page.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ def click(self, locator) -> None:
117117
try:
118118
self.page.wait_for_load_state('load')
119119
self.page.wait_for_load_state('domcontentloaded')
120-
locator.wait_for("attached")
121-
locator.wait_for("visible")
120+
locator.wait_for(state = "attached")
121+
locator.wait_for(state = "visible")
122122
locator.click()
123123

124124
except Exception as locatorClickError:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from playwright.sync_api import Page, expect
2+
from pages.base_page import BasePage
3+
4+
class BatchDownloadRequestAndRetrieval(BasePage):
5+
def __init__(self, page: Page):
6+
super().__init__(page)
7+
self.page = page
8+
#Batch Download Request And Retrieval - page locators
9+
self.batch_download_request_and_retrieval_title = self.page.locator("#ntshPageTitle")
10+
self.page_form = self.page.locator("form[name=\"frm\"]")
11+
12+
def expect_form_to_have_warning(self) -> None:
13+
expect(self.page_form).to_contain_text("Warning - FS Screening data will not be downloaded")
14+
15+
def verify_batch_download_request_and_retrieval_title(self) -> None:
16+
expect(self.batch_download_request_and_retrieval_title).to_contain_text("Batch Download Request and Retrieval")

pages/bowel_scope_appointments_page.py

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

1111
def verify_page_title(self) -> None:
12-
expect(self.page_title).to_contain_text("Appointment Calendar")
12+
expect(self.page_title).to_contain_text("Appointment Calendar")

pages/bowel_scope_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ def __init__(self, page: Page):
99
self.view_bowel_scope_appointments_page = self.page.get_by_role("link", name="View Bowel Scope Appointments")
1010

1111
def go_to_view_bowel_scope_appointments_page(self) -> None:
12-
self.click(self.view_bowel_scope_appointments_page)
12+
self.click(self.view_bowel_scope_appointments_page)

pages/cognito_login_page.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ class CognitoLoginPage(BasePage):
55
def __init__(self, page: Page):
66
super().__init__(page)
77
self.page = page
8-
self.username = page.get_by_role("textbox", name="Username")
9-
self.password = page.get_by_role("textbox", name="Password")
10-
self.submit_button = page.get_by_role("button", name="submit")
8+
self.username = self.page.get_by_role("textbox", name="Username")
9+
self.password = self.page.get_by_role("textbox", name="Password")
10+
self.submit_button = self.page.get_by_role("button", name="submit")
1111

1212
def login_as_user(self, username: str, password: str) -> None:
1313
"""Logs in to bcss with specified user credentials

pages/contacts_list_page.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from playwright.sync_api import Page
1+
from playwright.sync_api import Page, expect
22
from pages.base_page import BasePage
33

44
class ContactsListPage(BasePage):
@@ -10,15 +10,23 @@ def __init__(self, page: Page):
1010
self.edit_my_contact_details_page = self.page.get_by_role("link", name="Edit My Contact Details")
1111
self.maintain_contacts_page = self.page.get_by_role("link", name="Maintain Contacts")
1212
self.my_preference_settings_page = self.page.get_by_role("link", name="My Preference Settings")
13+
self.extract_contact_details_page = self.page.get_by_text("Extract Contact Details")
14+
self.resect_and_discard_accredited_page = self.page.get_by_text("Resect and Discard Accredited")
1315

1416
def go_to_view_contacts_page(self)->None:
1517
self.click(self.view_contacts_page)
1618

1719
def go_to_edit_my_contact_details_page(self)->None:
1820
self.click(self.edit_my_contact_details_page)
1921

20-
def go_to_maintain_contacts_details_page(self)->None:
22+
def go_to_maintain_contacts_page(self)->None:
2123
self.click(self.maintain_contacts_page)
2224

2325
def go_to_my_preference_settings_page(self)->None:
2426
self.click(self.my_preference_settings_page)
27+
28+
def verify_extract_contact_details_page_visible(self) -> None:
29+
expect(self.extract_contact_details_page).to_be_visible()
30+
31+
def verify_resect_and_discard_accredited_page_visible(self) -> None:
32+
expect(self.resect_and_discard_accredited_page).to_be_visible()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from playwright.sync_api import Page, expect
2+
from pages.base_page import BasePage
3+
4+
class EditMyContactDetails(BasePage):
5+
def __init__(self, page: Page):
6+
super().__init__(page)
7+
self.page = page
8+
#Edit My Contact Details - page locators
9+
self.edit_my_contact_details_title = self.page.locator("#ntshPageTitle")
10+
11+
def verify_edit_my_contact_details_title(self) -> None:
12+
expect(self.edit_my_contact_details_title).to_contain_text("Edit My Contact Details")

pages/electronic_communications_management.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def __init__(self, page: Page):
66
super().__init__(page)
77
self.page = page
88
#Electronic Communication Management - page locators
9-
self.electronic_communication_management_title = page.locator("#page-title")
9+
self.electronic_communication_management_title = self.page.locator("#page-title")
1010

1111
def verify_electronic_communication_management_title(self) -> None:
1212
expect(self.electronic_communication_management_title).to_contain_text("Electronic Communication Management")

pages/fit_rollout_summary_page.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from playwright.sync_api import Page, expect
2+
from pages.base_page import BasePage
3+
4+
class FITRolloutSummary(BasePage):
5+
def __init__(self, page: Page):
6+
super().__init__(page)
7+
self.page = page
8+
#FIT Rollout Summary - page locators
9+
self.fit_rollout_summary_body = self.page.locator("body")
10+
11+
def verify_fit_rollout_summary_body(self) -> None:
12+
expect(self.fit_rollout_summary_body).to_contain_text("FIT Rollout Summary")

pages/fit_test_kits_page.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from playwright.sync_api import Page
1+
from playwright.sync_api import Page, expect
22
from pages.base_page import BasePage
33

44
class FITTestKits(BasePage):
@@ -17,6 +17,10 @@ def __init__(self, page: Page):
1717
self.manage_qc_products_page = self.page.get_by_role("link", name="Manage QC Products")
1818
self.maintain_analysers_page = self.page.get_by_role("link", name="Maintain Analysers")
1919
self.fit_device_id = self.page.get_by_role("textbox", name="FIT Device ID")
20+
self.fit_test_kits_title = self.page.locator("#ntshPageTitle")
21+
22+
def verify_fit_test_kits_title(self) -> None:
23+
expect(self.fit_test_kits_title).to_contain_text("FIT Test Kits")
2024

2125
def go_to_fit_rollout_summary_page(self)->None:
2226
self.click(self.fit_rollout_summary_page)

0 commit comments

Comments
 (0)