Skip to content

Commit e011412

Browse files
committed
Updated properties function and updated all tests to use the new login function on Compartment 1 branch
1 parent 67d51be commit e011412

16 files changed

+52
-79
lines changed

tests/smokescreen/test_compartment_1.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@ def smokescreen_properties() -> dict:
2525
dict: A dictionary containing the values loaded from the 'bcss_smokescreen_tests.properties' file.
2626
"""
2727
configs = Properties()
28-
if platform == "win32":
28+
if platform == "win32": # File path from content root is required on Windows OS
2929
with open('tests/smokescreen/bcss_smokescreen_tests.properties', 'rb') as read_prop:
3030
configs.load(read_prop)
31-
elif platform == "darwin":
31+
elif platform == "darwin": # Only the filename is required on macOS
3232
with open('bcss_smokescreen_tests.properties', 'rb') as read_prop:
3333
configs.load(read_prop)
3434
return configs.properties
3535

3636

37+
3738
@pytest.mark.smoke
3839
@pytest.mark.compartment1
3940
def test_create_invitations_plan(page: Page, smokescreen_properties: dict) -> None:

tests/test_bcss_19181_users_permit_list.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22
from playwright.sync_api import Page
3+
from utils.user_tools import UserTools
34
from pages import (login_page as login, bcss_home_page as bcss_home, navigation_bar_links as nav_bar_links,
45
log_out_page as logout, login_failure_screen as login_failure)
56
from utils.oracle import OracleDB
@@ -11,7 +12,7 @@ def before_test(page: Page):
1112
This fixture confirms that users can log in successfully in to BCSS whilst the approved users list is empty
1213
"""
1314
# Log in to BCSS as bcss401 user, then log out
14-
login.BcssLoginPage(page).login_as_user("BCSS401")
15+
UserTools.user_login(page, "Hub Manager State Registered")
1516
bcss_home.BcssHomePage(page).bowel_cancer_screening_system_header_is_displayed()
1617
nav_bar_links.NavigationBar(page).click_log_out_link()
1718
logout.Logout(page).verify_log_out_page()
@@ -37,7 +38,7 @@ def test_only_users_on_approved_can_login_to_bcss(page: Page) -> None:
3738
logout.Logout(page).verify_log_out_page()
3839

3940
# BCSS118 user fails to logs in to BCSS as they are not on the approved list
40-
login.BcssLoginPage(page).login_as_user("BCSS118")
41+
UserTools.user_login(page,"Screening Centre Manager")
4142
# Verify relevant error message is displayed
4243
login_failure.LoginFailureScreen(page).verify_login_failure_screen_is_displayed()
4344
page.close()

tests/test_bowel_scope_page.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from playwright.sync_api import Page, expect
33
from utils.click_helper import click
44
from pages.bcss_home_page import MainMenu
5-
from pages.login_page import BcssLoginPage
5+
from utils.user_tools import UserTools
66

77

88
@pytest.fixture(scope="function", autouse=True)
@@ -11,7 +11,7 @@ def before_each(page: Page):
1111
Before every test is executed, this fixture logs in to BCSS as a test user and navigates to the bowel scope page
1212
"""
1313
# Log in to BCSS
14-
BcssLoginPage(page).login_as_user("BCSS401")
14+
UserTools.user_login(page, "Hub Manager State Registered")
1515

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

tests/test_call_and_recall_page.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
from sys import platform
23
from playwright.sync_api import Page, expect
34
from utils.click_helper import click
45
from pages.bcss_home_page import MainMenu
@@ -16,8 +17,12 @@ def tests_properties() -> dict:
1617
dict: A dictionary containing the values loaded from the 'bcss_tests.properties' file.
1718
"""
1819
configs = Properties()
19-
with open('bcss_tests.properties', 'rb') as read_prop:
20-
configs.load(read_prop)
20+
if platform == "win32": # File path from content root is required on Windows OS
21+
with open('tests/bcss_tests.properties', 'rb') as read_prop:
22+
configs.load(read_prop)
23+
elif platform == "darwin": # Only the filename is required on macOS
24+
with open('bcss_tests.properties', 'rb') as read_prop:
25+
configs.load(read_prop)
2126
return configs.properties
2227

2328

@@ -48,13 +53,11 @@ def test_call_and_recall_page_navigation(page: Page) -> None:
4853
expect(page.locator("#ntshPageTitle")).to_contain_text("Generate Invitations")
4954
click(page, page.get_by_role("link", name="Back"))
5055

51-
5256
# Invitation generation progress page loads as expected
5357
click(page, page.get_by_role("link", name="Invitation Generation Progress"))
5458
expect(page.locator("#ntshPageTitle")).to_contain_text("Invitation Generation Progress")
5559
click(page, page.get_by_role("link", name="Back"))
5660

57-
5861
# Non invitation days page loads as expected
5962
click(page, page.get_by_role("link", name="Non Invitation Days"))
6063
expect(page.locator("#ntshPageTitle")).to_contain_text("Non-Invitation Days")
@@ -65,7 +68,6 @@ def test_call_and_recall_page_navigation(page: Page) -> None:
6568
expect(page.locator("#page-title")).to_contain_text("Age Extension Rollout Plans")
6669
click(page, page.get_by_role("link", name="Back"))
6770

68-
6971
# Return to main menu
7072
click(page, page.get_by_role("link", name="Main Menu"))
7173
expect(page.locator("#ntshPageTitle")).to_contain_text("Main Menu")

tests/test_communications_production_page.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from pages.login_page import BcssLoginPage
44
from pages.bcss_home_page import MainMenu
55
from utils.click_helper import click
6+
from utils.user_tools import UserTools
67

78

89
@pytest.fixture(scope="function", autouse=True)
@@ -12,11 +13,12 @@ def before_each(page: Page):
1213
production page
1314
"""
1415
# Log in to BCSS
15-
BcssLoginPage(page).login_as_user("BCSS401")
16+
UserTools.user_login(page, "Hub Manager State Registered")
1617

1718
# Go to communications production page
1819
MainMenu(page).go_to_communications_production_page()
1920

21+
2022
@pytest.mark.smoke
2123
def test_communications_production_page_navigation(page: Page) -> None:
2224
"""

tests/test_contacts_list_page.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from playwright.sync_api import Page, expect
33
from utils.click_helper import click
44
from pages.bcss_home_page import MainMenu
5-
from pages.login_page import BcssLoginPage
5+
from utils.user_tools import UserTools
66

77

88
@pytest.fixture(scope="function", autouse=True)
@@ -11,7 +11,7 @@ def before_each(page: Page):
1111
Before every test is executed, this fixture logs in to BCSS as a test user and navigates to the contacts list page
1212
"""
1313
# Log in to BCSS
14-
BcssLoginPage(page).login_as_user("BCSS401")
14+
UserTools.user_login(page, "Hub Manager State Registered")
1515

1616
# Go to contacts list page
1717
MainMenu(page).go_to_contacts_list_page()

tests/test_download_page.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from playwright.sync_api import Page, expect
33
from utils.click_helper import click
44
from pages.bcss_home_page import MainMenu
5-
from pages.login_page import BcssLoginPage
5+
from utils.user_tools import UserTools
66

77

88
@pytest.fixture(scope="function", autouse=True)
@@ -11,7 +11,7 @@ def before_each(page: Page):
1111
Before every test is executed, this fixture logs in to BCSS as a test user and navigates to the download page
1212
"""
1313
# Log in to BCSS
14-
BcssLoginPage(page).login_as_user("BCSS401")
14+
UserTools.user_login(page, "Hub Manager State Registered")
1515

1616
# Go to download page
1717
MainMenu(page).go_to_download_page()

tests/test_fit_test_kits_page.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from playwright.sync_api import Page, expect
33
from utils.click_helper import click
44
from pages.bcss_home_page import MainMenu
5-
from pages.login_page import BcssLoginPage
5+
from utils.user_tools import UserTools
66

77

88
@pytest.fixture(scope="function", autouse=True)
@@ -12,7 +12,7 @@ def before_each(page: Page):
1212
fit test kits page
1313
"""
1414
# Log in to BCSS
15-
BcssLoginPage(page).login_as_user("BCSS401")
15+
UserTools.user_login(page, "Hub Manager State Registered")
1616

1717
# Go to fit test kits page
1818
MainMenu(page).go_to_fit_test_kits_page()

tests/test_gfobt_test_kits_page.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from playwright.sync_api import Page, expect
33
from utils.click_helper import click
44
from pages.bcss_home_page import MainMenu
5-
from pages.login_page import BcssLoginPage
5+
from utils.user_tools import UserTools
66

77

88
@pytest.fixture(scope="function", autouse=True)
@@ -12,7 +12,7 @@ def before_each(page: Page):
1212
gfob test kits page
1313
"""
1414
# Log in to BCSS
15-
BcssLoginPage(page).login_as_user("BCSS401")
15+
UserTools.user_login(page, "Hub Manager State Registered")
1616

1717
# Go to gFOBT test kits page
1818
MainMenu(page).go_to_gfob_test_kits_page()

tests/test_home_page_links.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22
from playwright.sync_api import Page, expect
3-
from pages.login_page import BcssLoginPage
3+
from utils.user_tools import UserTools
44
from pages.bcss_home_page import BcssHomePage
55
from utils.date_time_utils import DateTimeUtils
66

@@ -12,7 +12,7 @@ def before_each(page: Page):
1212
being displayed
1313
"""
1414
# Log in to BCSS
15-
BcssLoginPage(page).login_as_user("BCSS401")
15+
UserTools.user_login(page, "Hub Manager State Registered")
1616

1717

1818
@pytest.mark.smoke
@@ -53,7 +53,7 @@ def test_home_page_links_navigation(page: Page) -> None:
5353
homepage.click_refresh_alerts_link()
5454
# Verify that the 'last updated' timestamp matches the current date and time
5555
(expect(page.locator("form[name=\"refreshCockpit\"]")).to_contain_text
56-
("Refresh alerts (last updated :" + DateTimeUtils.current_datetime()))
56+
("Refresh alerts (last updated :" + DateTimeUtils.current_datetime()))
5757

5858
# Click the user guide link
5959
with page.expect_popup() as page1_info:

0 commit comments

Comments
 (0)