Skip to content

Commit 89c63b2

Browse files
authored
Added vpn_required mark to ptest.ini (#26)
Added vpn_required mark to any tests that it applies to Moved cognito login page into the login directory <!-- markdownlint-disable-next-line first-line-heading --> ## Description A new pytest mark has been created for tests that require a vpn connection <!-- Describe your changes in detail. --> ## Context Some Playwright tests connect to the Oracle DB and a vpn connection is required to do this. A new pytest mark has been created (@pytest.mark.vpn_required) and has been added to any applicable tests. <!-- Why is this change required? What problem does it solve? --> ## Type of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply. --> - [ ] Refactoring (non-breaking change) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would change existing functionality) - [ ] Bug fix (non-breaking change which fixes an issue) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I am familiar with the [contributing guidelines](https://github.com/nhs-england-tools/playwright-python-blueprint/blob/main/CONTRIBUTING.md) - [x] I have followed the code style of the project - [x] I have added tests to cover my changes (where appropriate) - [ ] I have updated the documentation accordingly - [ ] This PR is a result of pair or mob programming --- ## Sensitive Information Declaration To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including [PII (Personal Identifiable Information) / PID (Personal Identifiable Data)](https://digital.nhs.uk/data-and-information/keeping-data-safe-and-benefitting-the-public) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter. - [x] I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.
1 parent ec77a67 commit 89c63b2

File tree

9 files changed

+10
-5
lines changed

9 files changed

+10
-5
lines changed

pages/base_page.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ def __init__(self, page: Page):
5151
self.main_menu__header = self.page.locator("#ntshPageTitle")
5252

5353
def click_main_menu_link(self) -> None:
54-
self.click(self.main_menu_link)
54+
if self.main_menu_link.is_visible():
55+
self.click(self.main_menu_link)
5556

5657
def click_log_out_link(self) -> None:
5758
self.click(self.log_out_link)

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ markers =
3232
compartment1: only for compartment 1
3333
compartment2: only for compartment 2
3434
compartment3: only for compartment 3
35+
vpn_required: for tests that require a VPN connection

tests/smokescreen/test_compartment_1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def test_create_invitations_plan(page: Page, smokescreen_properties: dict) -> No
4848
logging.info("Invitation plan created")
4949

5050

51+
@pytest.mark.vpn_required
5152
@pytest.mark.smoke
5253
@pytest.mark.smokescreen
5354
@pytest.mark.compartment1

tests/smokescreen/test_compartment_2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def smokescreen_properties() -> dict:
1818
return PropertiesFile().get_smokescreen_properties()
1919

2020

21+
@pytest.mark.vpn_required
2122
@pytest.mark.smoke
2223
@pytest.mark.smokescreen
2324
@pytest.mark.compartment2

tests/smokescreen/test_compartment_3.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def smokescreen_properties() -> dict:
1818
return PropertiesFile().get_smokescreen_properties()
1919

2020

21+
@pytest.mark.vpn_required
2122
@pytest.mark.smokescreen
2223
@pytest.mark.compartment3
2324
def test_compartment_3(page: Page, smokescreen_properties: dict) -> None:

tests/smokescreen/test_compartment_4.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def smokescreen_properties() -> dict:
1515
return PropertiesFile().get_smokescreen_properties()
1616

1717

18+
@pytest.mark.vpn_required
1819
@pytest.mark.smokescreen
1920
@pytest.mark.compartment4
2021
def test_compartment_4(page: Page, smokescreen_properties: dict) -> None:

tests/test_bcss_19181_users_permit_list.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ def before_test(page: Page):
2727
OracleDB().delete_all_users_from_approved_users_table()
2828

2929

30-
# @pytest.mark.smoke
30+
@pytest.mark.vpn_required
31+
@pytest.mark.smoke
3132
def test_only_users_on_approved_can_login_to_bcss(page: Page) -> None:
32-
#NOTE: You must be connected to the non prod vpn to connect to oracle DB and run this test
3333
# Add bcss401 user to approved users list table
3434
OracleDB().populate_ui_approved_users_table("BCSS401")
3535
# BCSS401 user successfully logs in to BCSS whilst on the approved list

utils/user_tools.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
from pathlib import Path
55
from dotenv import load_dotenv
66
from playwright.sync_api import Page
7-
8-
from pages.cognito_login_page import CognitoLoginPage
7+
from pages.login.cognito_login_page import CognitoLoginPage
98

109
logger = logging.getLogger(__name__)
1110
USERS_FILE = Path(__file__).parent.parent / "users.json"

0 commit comments

Comments
 (0)