Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pages/logout/log_out_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ def __init__(self, page: Page):
def verify_log_out_page(self) -> None:
expect(self.log_out_msg).to_be_visible()

def log_out(self) -> None:
logging.info("Test Complete - Logging Out")
def log_out(self, close_page: bool = True) -> None:
logging.info("Logging Out")
self.click_log_out_link()
expect(self.log_out_msg).to_be_visible()
self.page.close()
if close_page:
self.page.close()
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from playwright.sync_api import Page
from pages.base_page import BasePage
from utils.table_util import TableUtils


class PractitionerAvailabilityPage(BasePage):
def __init__(self, page: Page):
super().__init__(page)
self.page = page
# Practitioner Availability - page locators
self.site_id_dropdown = page.locator("#UI_SITE_ID")
self.screening_practitioner_dropdown = page.locator("#UI_PRACTITIONER_ID")
self.calendar_button = page.get_by_role("button", name="Calendar")

def select_site_dropdown_option(self, site_to_use: str) -> None:
self.site_id_dropdown.select_option(label=site_to_use)

def select_practitioner_dropdown_option(self, practitioner: str) -> None:
self.screening_practitioner_dropdown.select_option(label=practitioner)

def click_calendar_button(self) -> None:
self.click(self.calendar_button)
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ def __init__(self, page: Page):
self.patients_that_require_page = self.page.get_by_role(
"link", name="Patients that Require"
)
self.active_set_availability_link = self.page.get_by_role(
"link", name="Set Availability"
)

# Greyed out links (not clickable due to user role permissions)
self.patients_that_require_colonoscopy_assessment_appointments_bowel_scope_link = self.page.get_by_text(
"Patients that Require Colonoscopy Assessment Appointments - Bowel Scope"
Expand All @@ -34,3 +38,6 @@ def go_to_view_appointments_page(self) -> None:

def go_to_patients_that_require_page(self) -> None:
self.click(self.patients_that_require_page)

def go_to_set_availability_page(self) -> None:
self.click(self.active_set_availability_link)
15 changes: 15 additions & 0 deletions pages/screening_practitioner_appointments/set_availability_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from playwright.sync_api import Page
from pages.base_page import BasePage


class SetAvailabilityPage(BasePage):
def __init__(self, page: Page):
super().__init__(page)
self.page = page
# Set Availability - page locators
self.practitioner_availability_link = page.get_by_role(
"link", name="Practitioner Availability -"
)

def go_to_practitioner_availability_page(self) -> None:
self.click(self.practitioner_availability_link)
25 changes: 19 additions & 6 deletions tests/smokescreen/test_compartment_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
from playwright.sync_api import Page, expect
from pages.logout.log_out_page import Logout
from pages.base_page import BasePage
from pages.screening_practitioner_appointments.screening_practitioner_appointments import (
ScreeningPractitionerAppointmentsPage,
)
from pages.screening_practitioner_appointments.set_availability_page import (
SetAvailabilityPage,
)
from pages.screening_practitioner_appointments.practitioner_availability_page import (
PractitionerAvailabilityPage,
)
from utils.user_tools import UserTools
from utils.load_properties_file import PropertiesFile
from utils.calendar_picker import CalendarPicker
Expand Down Expand Up @@ -45,11 +54,15 @@ def test_compartment_4(page: Page, smokescreen_properties: dict) -> None:

UserTools.user_login(page, "Screening Centre Manager at BCS001")
BasePage(page).go_to_screening_practitioner_appointments_page()
page.get_by_role("link", name="Set Availability").click()
page.get_by_role("link", name="Practitioner Availability -").click()
page.locator("#UI_SITE_ID").select_option(index=1)
page.locator("#UI_PRACTITIONER_ID").select_option(index=1)
page.get_by_role("button", name="Calendar").click()
ScreeningPractitionerAppointmentsPage(page).go_to_set_availability_page()
SetAvailabilityPage(page).go_to_practitioner_availability_page()
PractitionerAvailabilityPage(page).select_site_dropdown_option(
"THE ROYAL HOSPITAL (WOLVERHAMPTON)"
)
PractitionerAvailabilityPage(page).select_practitioner_dropdown_option(
"Astonish, Ethanol"
)
PractitionerAvailabilityPage(page).click_calendar_button()
CalendarPicker(page).select_day(
datetime.today()
) # This will make it so that we can only run this test once a day, or we need to restore the DB back to the snapshot
Expand All @@ -64,7 +77,7 @@ def test_compartment_4(page: Page, smokescreen_properties: dict) -> None:
page.locator("#FOR_WEEKS").press("Enter")
page.get_by_role("button", name="Save").click()
expect(page.get_by_text("Slots Updated for 6 Weeks")).to_be_visible()
Logout(page).log_out()
Logout(page).log_out(close_page=False)

page.get_by_role("button", name="Log in").click()
UserTools.user_login(page, "Hub Manager State Registered at BCS01")
Expand Down
2 changes: 1 addition & 1 deletion utils/calendar_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def select_day(self, date: datetime) -> None:
This function is used by both the v1 and v2 calendar picker
It extracts the day from the date and then selects that value in the calendar picker
"""
day_to_select = str(date.strftime("%#d"))
day_to_select = str(date.day)
number_of_cells_with_day = self.page.get_by_role(
"cell", name=day_to_select
).count()
Expand Down