Skip to content

Commit

Permalink
Doc strings added for all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andyg79 committed Feb 14, 2025
1 parent e9639d2 commit e318b0b
Show file tree
Hide file tree
Showing 14 changed files with 265 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_bowel_scope_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@

@pytest.fixture(scope="function", autouse=True)
def before_each(page: Page):
"""
Before every test is executed, this fixture logs in to BCSS as a test user and navigates to the bowel scope page
"""
# Log in to BCSS
BcssLoginPage(page).login_as_user_bcss401()

# Go to bowel scope page
MainMenu(page).go_to_bowel_scope_page()


@pytest.mark.smoke
def test_bowel_scope_page_navigation(page: Page) -> None:
"""
Confirms that the bowel scope appointments page loads, the appointments calendar is displayed and the
main menu button returns the user to the main menu
"""
# Bowel scope appointments page loads as expected
page.get_by_role("link", name="View Bowel Scope Appointments").click()
expect(page.locator("#ntshPageTitle")).to_contain_text("Appointment Calendar")
Expand Down
9 changes: 9 additions & 0 deletions tests/test_call_and_recall_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

@pytest.fixture(scope="function", autouse=True)
def before_each(page: Page):
"""
Before every test is executed, this fixture logs in to BCSS as a test user and navigates to the call and recall page
"""
# Log in to BCSS
BcssLoginPage(page).login_as_user_bcss401()

Expand All @@ -16,6 +19,9 @@ def before_each(page: Page):

@pytest.mark.smoke
def test_call_and_recall_page_navigation(page: Page) -> None:
"""
Confirms that the Call and Recall menu displays all menu options and confirms they load the correct pages
"""
# Planning and monitoring page loads as expected
page.get_by_role("link", name="Planning and Monitoring").click()
expect(page.locator("#page-title")).to_contain_text("Invitations Monitoring - Screening Centre")
Expand Down Expand Up @@ -47,6 +53,9 @@ def test_call_and_recall_page_navigation(page: Page) -> None:


def test_view_an_invitation_plan(page: Page) -> None:
"""
Confirms that an invitation plan can be viewed via a screening centre from the planning ad monitoring page
"""
# Go to planning and monitoring page
page.get_by_role("link", name="Planning and Monitoring").click()

Expand Down
9 changes: 9 additions & 0 deletions tests/test_communications_production_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,23 @@

@pytest.fixture(scope="function", autouse=True)
def before_each(page: Page):
"""
Before every test is executed, this fixture logs in to BCSS as a test user and navigates to the communications
production page
"""
# Log in to BCSS
BcssLoginPage(page).login_as_user_bcss401()

# Go to communications production page
MainMenu(page).go_to_communications_production_page()


@pytest.mark.smoke
def test_communications_production_page_navigation(page: Page) -> None:
"""
Confirms all menu items are displayed on the communications production page, and that the relevant pages
are loaded when the links are clicked
"""
# Active batch list page loads as expected
page.get_by_role("link", name="Active Batch List").click()
expect(page.locator("#page-title")).to_contain_text("Active Batch List")
Expand Down
7 changes: 7 additions & 0 deletions tests/test_contacts_list_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

@pytest.fixture(scope="function", autouse=True)
def before_each(page: Page):
"""
Before every test is executed, this fixture logs in to BCSS as a test user and navigates to the contacts list page
"""
# Log in to BCSS
BcssLoginPage(page).login_as_user_bcss401()

Expand All @@ -16,6 +19,10 @@ def before_each(page: Page):

@pytest.mark.smoke
def test_contacts_list_page_navigation(page: Page) -> None:
"""
Confirms all menu items are displayed on the contacts list page, and that the relevant pages
are loaded when the links are clicked
"""
# View contacts page loads as expected
page.get_by_role("link", name="View Contacts").click()
expect(page.locator("#ntshPageTitle")).to_contain_text("View Contacts")
Expand Down
8 changes: 8 additions & 0 deletions tests/test_download_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

@pytest.fixture(scope="function", autouse=True)
def before_each(page: Page):
"""
Before every test is executed, this fixture logs in to BCSS as a test user and navigates to the download page
"""
# Log in to BCSS
BcssLoginPage(page).login_as_user_bcss401()

Expand All @@ -16,6 +19,11 @@ def before_each(page: Page):

@pytest.mark.smoke
def test_download_facility_page_navigation(page: Page) -> None:
"""
Confirms all menu items are displayed on the downloads page, and that the relevant pages
are loaded when the links are clicked. Also confirms that the warning header messages are displayed
on the relevant pages
"""
# Individual download request and retrieval page loads as expected
page.get_by_role("link", name="Individual Download Request").click()
expect(page.locator("#ntshPageTitle")).to_contain_text("Individual Download Request and Retrieval")
Expand Down
8 changes: 8 additions & 0 deletions tests/test_fit_test_kits_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

@pytest.fixture(scope="function", autouse=True)
def before_each(page: Page):
"""
Before every test is executed, this fixture logs in to BCSS as a test user and navigates to the
fit test kits page
"""
# Log in to BCSS
BcssLoginPage(page).login_as_user_bcss401()

Expand All @@ -16,6 +20,10 @@ def before_each(page: Page):

@pytest.mark.smoke
def test_fit_test_kits_page_navigation(page: Page) -> None:
"""
Confirms all menu items are displayed on the fit test kits page, and that the relevant pages
are loaded when the links are clicked
"""
# Verify FIT rollout summary page opens as expected
page.get_by_role("link", name="FIT Rollout Summary").click()
expect(page.locator("body")).to_contain_text("FIT Rollout Summary")
Expand Down
11 changes: 11 additions & 0 deletions tests/test_gfobt_test_kits_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

@pytest.fixture(scope="function", autouse=True)
def before_each(page: Page):
"""
Before every test is executed, this fixture logs in to BCSS as a test user and navigates to the
gfob test kits page
"""
# Log in to BCSS
BcssLoginPage(page).login_as_user_bcss401()

Expand All @@ -16,6 +20,10 @@ def before_each(page: Page):

@pytest.mark.smoke
def test_gfob_test_kit_page_navigation(page: Page) -> None:
"""
Confirms all menu items are displayed on the gfob test kits page, and that the relevant pages
are loaded when the links are clicked
"""
# Test kit logging page opens as expected
page.get_by_role("link", name="Test Kit Logging").click()
expect(page.locator("#ntshPageTitle")).to_contain_text("Test Kit Logging")
Expand All @@ -41,6 +49,9 @@ def test_gfob_test_kit_page_navigation(page: Page) -> None:


def test_create_a_qc_kit(page: Page) -> None:
"""
Confirms that a qc test kit can be created and that each of the dropdowns has an option set available for selection
"""
# Navigate to create QC kit page
page.get_by_role("link", name="Create QC Kit").click()

Expand Down
7 changes: 7 additions & 0 deletions tests/test_home_page_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@

@pytest.fixture(scope="function", autouse=True)
def before_each(page: Page):
"""
Before every test is executed, this fixture logs in to BCSS as a test user and results in the home page
being displayed
"""
# Log in to BCSS
BcssLoginPage(page).login_as_user_bcss401()


@pytest.mark.smoke
def test_home_page_links_navigation(page: Page) -> None:
"""
Confirms that homepage links are visible and clickable, and the expected pages open when clicking the links
"""
homepage = BcssHomePage(page)

# Click 'show sub menu' link
Expand Down
19 changes: 19 additions & 0 deletions tests/test_login_to_bcss.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,44 @@


def test_successful_login_to_bcss(page: Page) -> None:
"""
Confirms that a user with valid credentials can log in to bcss
"""
# Enter a valid username and password and click 'sign in' button
BcssLoginPage(page).login_as_user_bcss401()
# Confirm user has successfully signed in and is viewing the bcss homepage
expect(page.locator("#ntshAppTitle")).to_contain_text("Bowel Cancer Screening System")


def test_login_to_bcss_with_invalid_username(page: Page) -> None:
"""
Confirms that a user with a valid password, and invalid username, can NOT log in to bcss
"""
# Enter a valid password with an invalid username and click 'sign in' button
username = "BCSSZZZ"
password = "changeme"
BcssLoginPage(page).login(username, password)
# Confirm error message is displayed
expect(page.locator("body")).to_contain_text("Incorrect username or password.")


def test_login_to_bcss_with_invalid_password(page: Page) -> None:
"""
Confirms that a user with a valid username, and invalid password, can NOT log in to bcss
"""
# Enter a valid username with an invalid password and click 'sign in' button
username = "BCSS401"
password = "zzzzzz"
BcssLoginPage(page).login(username, password)
# Confirm error message is displayed
expect(page.locator("body")).to_contain_text("Incorrect username or password.")


def test_login_to_bcss_with_no_username_or_password(page: Page) -> None:
"""
Confirms that a user can NOT log in to bcss if no credentials are entered in the log in form
"""
# At the login screen, leave the fields empty and click 'sign in' button
username = ""
password = ""
BcssLoginPage(page).login(username, password)
Expand Down
8 changes: 8 additions & 0 deletions tests/test_lynch_surveillance_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

@pytest.fixture(scope="function", autouse=True)
def before_each(page: Page):
"""
Before every test is executed, this fixture logs in to BCSS as a test user and navigates to the
lynch surveillance page
"""
# Log in to BCSS
BcssLoginPage(page).login_as_user_bcss401()

Expand All @@ -16,6 +20,10 @@ def before_each(page: Page):

@pytest.mark.smoke
def test_lynch_surveillance_page_navigation(page: Page) -> None:
"""
Confirms that the 'set lynch invitation rates' link is visible and clickable, and navigates to the
expected page when clicked
"""
# 'Set lynch invitation rates' page loads as expected
page.get_by_role("link", name="Set Lynch Invitation Rates").click()
expect(page.locator("#page-title")).to_contain_text("Set Lynch Surveillance Invitation Rates")
Expand Down
11 changes: 11 additions & 0 deletions tests/test_organisations_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

@pytest.fixture(scope="function", autouse=True)
def before_each(page: Page):
"""
Before every test is executed, this fixture logs in to BCSS as a test user and navigates to the
organisations page
"""
# Log in to BCSS
BcssLoginPage(page).login_as_user_bcss401()

Expand All @@ -16,6 +20,10 @@ def before_each(page: Page):

@pytest.mark.smoke
def test_organisations_page_navigation(page: Page) -> None:
"""
Confirms all menu items are displayed on the organisations page, and that the relevant pages
are loaded when the links are clicked
"""
# Screening centre parameters page loads as expected
page.get_by_role("link", name="Screening Centre Parameters").click()
expect(page.locator("#ntshPageTitle")).to_contain_text("Screening Centre Parameters")
Expand Down Expand Up @@ -45,6 +53,9 @@ def test_organisations_page_navigation(page: Page) -> None:


def test_view_an_organisations_system_parameters(page: Page) -> None:
"""
Confirms that an organisation's system parameters can be accessed and viewed
"""
# Go to screening centre parameters page
page.get_by_role("link", name="Screening Centre Parameters").click()

Expand Down
Loading

0 comments on commit e318b0b

Please sign in to comment.