Skip to content

Commit ea04c6a

Browse files
Victor Soaresvictor-soares-ibm
authored andcommitted
Removed hard coded values from test screening practitioner appointments
1 parent 9a2bfda commit ea04c6a

File tree

3 files changed

+34
-15
lines changed

3 files changed

+34
-15
lines changed
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 ColonoscopyAssessmentAppointments(BasePage):
5+
def __init__(self, page: Page):
6+
super().__init__(page)
7+
self.page = page
8+
#Colonoscopy Assessment Appointments - page locators
9+
self.page_header = self.page.locator("#page-title")
10+
11+
def verify_page_header(self) -> None:
12+
expect(self.page_header).to_contain_text("Patients that Require Colonoscopy Assessment Appointments")

pages/screening_practitioner_appointments.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ def __init__(self, page: Page):
99
self.log_in_page = self.page.get_by_role("button", name="Log in")
1010
self.view_appointments_page = self.page.get_by_role("link", name="View appointments")
1111
self.patients_that_require_page = self.page.get_by_role("link", name="Patients that Require")
12+
# Greyed out links (not clickable due to user role permissions)
13+
self.patients_that_require_colonoscopy_assessment_appointments_bowel_scope_link = self.page.get_by_text("Patients that Require Colonoscopy Assessment Appointments - Bowel Scope")
14+
self.patients_that_require_surveillance_appointment_link = page.get_by_text("Patients that Require Surveillance Appointments")
15+
self.patients_that_require_post = page.get_by_text("Patients that Require Post-")
16+
self.set_availability_link = page.get_by_text("Set Availability")
1217

1318
def go_to_log_in_page(self)->None:
1419
self.click(self.log_in_page)
@@ -17,4 +22,4 @@ def go_to_view_appointments_page(self)->None:
1722
self.click(self.view_appointments_page)
1823

1924
def go_to_patients_that_require_page(self)->None:
20-
self.click(self.view_appointments_page)
25+
self.click(self.patients_that_require_page)

tests/test_screening_practitioner_appointments_page.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import pytest
22
from playwright.sync_api import Page, expect
3-
from utils.click_helper import click
43
from pages.base_page import BasePage
4+
from pages.screening_practitioner_appointments import ScreeningPractitionerAppointmentsPage
5+
from pages.bowel_scope_appointments_page import BowelScopeAppointments
6+
from pages.colonoscopy_assessment_appointments_page import ColonoscopyAssessmentAppointments
57
from utils.user_tools import UserTools
68

79

@@ -25,21 +27,21 @@ def test_screening_practitioner_appointments_page_navigation(page: Page) -> None
2527
and clickable (where the user has required permissions).
2628
"""
2729
# Verify View appointments page opens as expected
28-
click(page, page.get_by_role("link", name="View appointments"))
29-
expect(page.locator("#ntshPageTitle")).to_contain_text("Appointment Calendar")
30-
click(page, page.get_by_role("link", name="Back"))
30+
ScreeningPractitionerAppointmentsPage(page).go_to_view_appointments_page()
31+
BowelScopeAppointments(page).verify_page_title()
32+
BowelScopeAppointments(page).click_back_button()
3133

3234
# Verify Patients that Require Colonoscopy Assessment Appointments page opens as expected
33-
click(page, page.get_by_role("link", name="Patients that Require"))
34-
expect(page.locator("#page-title")).to_contain_text("Patients that Require Colonoscopy Assessment Appointments")
35-
click(page, page.get_by_role("link", name="Back"))
35+
ScreeningPractitionerAppointmentsPage(page).go_to_patients_that_require_page()
36+
ColonoscopyAssessmentAppointments(page).verify_page_header()
3637

37-
# Verify below links are visible (not clickable due to user role permissions)
38-
expect(page.get_by_text("Patients that Require Colonoscopy Assessment Appointments - Bowel Scope")).to_be_visible()
39-
expect(page.get_by_text("Patients that Require Surveillance Appointments")).to_be_visible()
40-
expect(page.get_by_text("Patients that Require Post-")).to_be_visible()
41-
expect(page.get_by_text("Set Availability")).to_be_visible()
38+
ColonoscopyAssessmentAppointments(page).click_back_button()
39+
40+
expect(ScreeningPractitionerAppointmentsPage(page).patients_that_require_colonoscopy_assessment_appointments_bowel_scope_link).to_be_visible()
41+
expect(ScreeningPractitionerAppointmentsPage(page).patients_that_require_surveillance_appointment_link).to_be_visible()
42+
expect(ScreeningPractitionerAppointmentsPage(page).patients_that_require_post).to_be_visible()
43+
expect(ScreeningPractitionerAppointmentsPage(page).set_availability_link).to_be_visible()
4244

4345
# Return to main menu
44-
click(page, page.get_by_role("link", name="Main Menu"))
45-
expect(page.locator("#ntshPageTitle")).to_contain_text("Main Menu")
46+
ScreeningPractitionerAppointmentsPage(page).click_main_menu_link()
47+
ScreeningPractitionerAppointmentsPage(page).main_menu_header_is_displayed()

0 commit comments

Comments
 (0)