Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# "DO NOT COMMIT THIS FILE"

BCSS_PASS=
93 changes: 93 additions & 0 deletions pages/bcss_home_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
from playwright.sync_api import Page


class BcssHomePage:
def __init__(self, page: Page):
self.page = page
# Homepage links
self.sub_menu_link = self.page.get_by_role("link", name="Show Sub-menu")
self.hide_sub_menu_link = self.page.get_by_role("link", name="Hide Sub-menu")
self.select_org_link = self.page.get_by_role("link", name="Select Org")
self.back_button = self.page.get_by_role("link", name="Back")
self.release_notes_link = self.page.get_by_role("link", name="- Release Notes")
self.refresh_alerts_link = self.page.get_by_role("link", name="Refresh alerts")
self.user_guide_link = self.page.get_by_role("link", name="User guide")
self.help_link = self.page.get_by_role("link", name="Help")

def click_sub_menu_link(self):
self.sub_menu_link.click()

def click_hide_sub_menu_link(self):
self.hide_sub_menu_link.click()

def click_select_org_link(self):
self.select_org_link.click()

def click_back_button(self):
self.back_button.click()

def click_release_notes_link(self):
self.release_notes_link.click()

def click_refresh_alerts_link(self):
self.refresh_alerts_link.click()

def click_user_guide_link(self):
self.user_guide_link.click()

def click_help_link(self):
self.help_link.click()


class MainMenu:
def __init__(self, page: Page):
self.page = page
# Main menu - page links
self.contacts_list_page = self.page.get_by_role("link", name="Contacts List")
self.bowel_scope_page = self.page.get_by_role("link", name="Bowel Scope")
self.call_and_recall_page = self.page.get_by_role("link", name="Call and Recall")
self.communications_production_page = self.page.get_by_role("link", name="Communications Production")
self.download_page = self.page.get_by_role("link", name="Download")
self.fit_test_kits_page = self.page.get_by_role("link", name="FIT Test Kits")
self.gfob_test_kits_page = self.page.get_by_role("link", name="gFOBT Test Kits")
self.lynch_surveillance_page = self.page.get_by_role("link", name="Lynch Surveillance")
self.organisations_page = self.page.get_by_role("link", name="Organisations")
self.reports_page = self.page.get_by_role("link", name="Reports")
self.screening_practitioner_appointments_page = self.page.get_by_role("link", name="Screening Practitioner")
self.screening_subject_search_page = self.page.get_by_role("link", name="Screening Subject Search")

def go_to_contacts_list_page(self):
self.contacts_list_page.click()

def go_to_bowel_scope_page(self):
self.bowel_scope_page.click()

def go_to_call_and_recall_page(self):
self.call_and_recall_page.click()

def go_to_communications_production_page(self):
self.communications_production_page.click()

def go_to_download_page(self):
self.download_page.click()

def go_to_fit_test_kits_page(self):
self.fit_test_kits_page.click()

def go_to_gfob_test_kits_page(self):
self.gfob_test_kits_page.click()

def go_to_lynch_surveillance_page(self):
self.lynch_surveillance_page.click()

def go_to_organisations_page(self):
self.organisations_page.click()

def go_to_reports_page(self):
self.reports_page.click()

def go_to_screening_practitioner_appointments_page(self):
self.screening_practitioner_appointments_page.click()

def go_to_screening_subject_search_page(self):
self.screening_subject_search_page.click()
25 changes: 25 additions & 0 deletions pages/cognito_login_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os

from playwright.sync_api import Page


class CognitoLoginPage:

def __init__(self, page: Page):
self.page = page
self.username = page.get_by_role("textbox", name="Username")
self.password = page.get_by_role("textbox", name="Password")
self.submit_button = page.get_by_role("button", name="submit")

def login_as_user(self, username: str, password: str) -> None:
"""Logs in to bcss with specified user credentials
Args:
username (str) enter a username that exists in users.json
password (str) the password for the user provided
"""
# Retrieve and enter username from users.json
self.username.fill(username)
# Retrieve and enter password from .env file
self.password.fill(password)
# Click Submit
self.submit_button.click()
109 changes: 109 additions & 0 deletions pages/reports_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
from datetime import datetime
from utils import date_time_utils
from playwright.sync_api import Page


class ReportsPageUtils:
def __init__(self):
pass


# Timestamp Date Formatting
def report_timestamp_date_format() -> str:
"""Gets the current date time and converts it to the timestamp format used on the report pages

Returns:
date report last requested (str): The current datetime in the "date report last requested" timestamp format.

"""
dtu = date_time_utils.DateTimeUtils
return dtu.format_date(datetime.now(), "%d/%m/%Y" + " at " + "%H:%M:%S")


def fobt_kits_logged_but_not_read_report_timestamp_date_format() -> str:
"""Gets the current date time and converts it to the timestamp format used on the fobt_kits_logged_but_not_read report page

Returns:
fobt_kits_logged_but_not_read timestamp (str): The current datetime in the "fobt_kits_logged_but_not_read report" timestamp format.

"""
dtu = date_time_utils.DateTimeUtils
return dtu.format_date(datetime.now(), "%d %b %Y %H:%M:%S")


def screening_practitioner_appointments_report_timestamp_date_format() -> str:
"""Gets the current date time and converts it to the timestamp format used on the screening practitioner appointments report page

Returns:
screening practitioner appointments timestamp (str): The current datetime in the "screening practitioner appointments report" timestamp format.

"""
dtu = date_time_utils.DateTimeUtils
return dtu.format_date(datetime.now(), "%d.%m.%Y" + " at " + "%H:%M:%S")


# Reports page main menu links
def go_to_failsafe_reports_page(page: Page) -> None:
page.get_by_role("link", name="Failsafe Reports").click()


def go_to_operational_reports_page(page: Page) -> None:
page.get_by_role("link", name="Operational Reports").click()


def go_to_strategic_reports_page(page: Page) -> None:
page.get_by_role("link", name="Strategic Reports").click()


def go_to_cancer_waiting_times_reports_page(page: Page) -> None:
page.get_by_role("link", name="Cancer Waiting Times Reports").click()


def go_to_dashboard(page: Page) -> None:
page.get_by_role("link", name="Dashboard").click()


# Failsafe Reports menu links
def go_to_date_report_last_requested_page(page: Page) -> None:
page.get_by_role("link", name="Date Report Last Requested").click()


def go_to_screening_subjects_with_inactive_open_episode_link_page(page: Page) -> None:
page.get_by_role("link", name="Screening Subjects With").click()


def go_to_subjects_ceased_due_to_date_of_birth_changes_page(page: Page) -> None:
page.get_by_role("link", name="Subjects Ceased Due to Date").click()


def go_to_allocate_sc_for_patient_movements_within_hub_boundaries_page(page: Page) -> None:
page.get_by_role("link", name="Allocate SC for Patient Movements within Hub Boundaries").click()


def go_to_allocate_sc_for_patient_movements_into_your_hub_page(page: Page) -> None:
page.get_by_role("link", name="Allocate SC for Patient Movements into your Hub").click()


def go_to_identify_and_link_new_gp_page(page: Page) -> None:
page.get_by_role("link", name="Identify and link new GP").click()


# Operational Reports menu links
def go_to_appointment_attendance_not_updated_page(page: Page) -> None:
page.get_by_role("link", name="Appointment Attendance Not").click()


def go_to_fobt_kits_logged_but_not_read_page(page: Page) -> None:
page.get_by_role("link", name="FOBT Kits Logged but Not Read").click()


def go_to_demographic_update_inconsistent_with_manual_update_page(page: Page) -> None:
page.get_by_role("link", name="Demographic Update").click()


def go_to_screening_practitioner_6_weeks_availability_not_set_up_report_page(page: Page) -> None:
page.get_by_role("link", name="Screening Practitioner 6").click()


def go_to_screening_practitioner_appointments_page(page: Page) -> None:
page.get_by_role("link", name="Screening Practitioner Appointments").click()
111 changes: 111 additions & 0 deletions pages/screening_subject_search_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
from playwright.sync_api import Page


class ScreeningStatusSearchOptions:
CALL_STATUS = "4001"
INACTIVE_STATUS = "4002"
RECALL_STATUS = "4004"
OPT_IN_STATUS = "4003"
SELF_REFERRAL_STATUS = "4005"
SURVEILLANCE_STATUS = "4006"
SEEKING_FURTHER_DATA_STATUS = "4007"
CEASED_STATUS = "4008"
BOWEL_SCOPE_STATUS = "4009"
LYNCH_SURVEILLANCE_STATUS = "306442"
LYNCH_SELF_REFERRAL_STATUS = "307129"

def __init__(self, page: Page):
self.page = page

# Locate screening status dropdown list
self.select_status = self.page.locator("#A_C_ScreeningStatus")

# Select screening status options
def select_status_call(self):
self.select_status.select_option(self.CALL_STATUS)

def select_status_inactive(self):
self.select_status.select_option(self.INACTIVE_STATUS)

def select_status_recall(self):
self.select_status.select_option(self.RECALL_STATUS)

def select_status_opt_in(self):
self.select_status.select_option(self.OPT_IN_STATUS)

def select_status_self_referral(self):
self.select_status.select_option(self.SELF_REFERRAL_STATUS)

def select_status_surveillance(self):
self.select_status.select_option(self.SURVEILLANCE_STATUS)

def select_status_seeking_further_data(self):
self.select_status.select_option(self.SEEKING_FURTHER_DATA_STATUS)

def select_status_ceased(self):
self.select_status.select_option(self.CEASED_STATUS)

def select_status_bowel_scope(self):
self.select_status.select_option(self.BOWEL_SCOPE_STATUS)

def select_status_lynch_surveillance(self):
self.select_status.select_option(self.LYNCH_SURVEILLANCE_STATUS)

def select_status_lynch_self_referral(self):
self.select_status.select_option(self.LYNCH_SELF_REFERRAL_STATUS)


class LatestEpisodeStatusSearchOptions:
OPEN_PAUSED_STATUS = "1"
CLOSED_STATUS = "2"
NO_EPISODE_STATUS = "3"

def __init__(self, page: Page):
self.page = page

# Locate latest episode status status dropdown list
self.select_status = self.page.locator("#A_C_EpisodeStatus")

# Select latest episode status options
def select_status_open_paused(self):
self.select_status.select_option(self.OPEN_PAUSED_STATUS)

def select_status_closed(self):
self.select_status.select_option(self.CLOSED_STATUS)

def select_status_no_episode(self):
self.select_status.select_option(self.NO_EPISODE_STATUS)


class SearchAreaSearchOptions:
SEARCH_AREA_HOME_HUB = "01"
SEARCH_AREA_GP_PRACTICE = "02"
SEARCH_AREA_CCG = "03"
SEARCH_AREA_SCREENING_CENTRE = "05"
SEARCH_AREA_OTHER_HUB = "06"
SEARCH_AREA_WHOLE_DATABASE = "07"

def __init__(self, page: Page):
self.page = page

# Locate search area dropdown list
self.select_area = self.page.locator("#A_C_SEARCH_DOMAIN")

# Select search area options
def select_search_area_home_hub(self):
self.select_area.select_option(self.SEARCH_AREA_HOME_HUB)

def select_search_area_gp_practice(self):
self.select_area.select_option(self.SEARCH_AREA_GP_PRACTICE)

def select_search_area_ccg(self):
self.select_area.select_option(self.SEARCH_AREA_CCG)

def select_search_area_screening_centre(self):
self.select_area.select_option(self.SEARCH_AREA_SCREENING_CENTRE)

def select_search_area_other_hub(self):
self.select_area.select_option(self.SEARCH_AREA_OTHER_HUB)

def select_search_area_whole_database(self):
self.select_area.select_option(self.SEARCH_AREA_WHOLE_DATABASE)
14 changes: 9 additions & 5 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ addopts =
--json-report-file=test-results/results.json
--json-report-omit=collectors
--tracing=retain-on-failure
--base-url=https://bcss-bcss-18680-ddc-bcss.k8s-nonprod.texasplatform.uk/

# Allows pytest to identify the base of this project as the pythonpath
pythonpath = .

# These are the tags that pytest will recognise when using @pytest.mark
markers =
example: tests used for example purposes by this blueprint
utils: tests for utility classes provided by this blueprint
branch: tests designed to run at a branch level
main: tests designed to run against the main branch
release: tests designed to run specifically against a release branch
#example: tests used for example purposes by this blueprint
#utils: tests for utility classes provided by this blueprint
#branch: tests designed to run at a branch level
#main: tests designed to run against the main branch
#release: tests designed to run specifically against a release branch
utils: test setup and support methods
smoke: tests designed to run as part of the smokescreen regression test suite
wip: tests that are currently in progress
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pytest-playwright>=0.5.1
pytest-html>=4.1.1
pytest-json-report>=1.5.0
python-dotenv~=1.0.1
Loading