Skip to content

Commit b1fe9b7

Browse files
committed
Mostly working tests
1 parent 9821bc3 commit b1fe9b7

File tree

8 files changed

+68
-2
lines changed

8 files changed

+68
-2
lines changed
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
1-
@cpts_ui @confirm_role @regression @blocker @smoke @ui
1+
@cpts_ui @confirm_role @rbac_banner @regression @blocker @smoke @ui
22
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4537
33
Feature: When the user selects a role, they see a confirmation page
44

55
Background:
66
Given I am logged in
7-
7+
88
Scenario:
99
Given I go to the select your role page
1010
And I have a selected role
1111
Then I see the 'confirm your role' page
12+
And I can see the RBAC banner
1213

1314
Scenario:
1415
Given I am on the change your role page
1516
When I click a change role role card
1617
Then I see the 'confirm your role' page
18+
And I can see the RBAC banner
1719

1820
Scenario:
1921
Given I am on the confirm your role page
2022
When I click the change link next to the role text
2123
Then I am on the change role page
24+
And I can see the RBAC banner
2225

2326
Scenario:
2427
Given I am on the confirm your role page
2528
When I click the change link next to the org text
2629
Then I am on the change role page
30+
And I can see the RBAC banner
2731

2832
Scenario:
2933
Given I am on the confirm your role page
3034
When I click the confirm and continue button on the confirm role page
3135
Then I am on the search for a prescription page
36+
And I can see the RBAC banner

features/cpts_ui/home.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4460
33
Feature: I can visit the Clinical Prescription Tracker Service Website
44

5+
@rbac_banner
56
Scenario: user can navigate to the Clinical Prescription Tracker Service Website homepage
67
When I go to the homepage
78
Then I am on the homepage
9+
And I can not see the RBAC banner
810

911
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4515
1012
Scenario: user can see the footer

features/cpts_ui/logout.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@ Feature: The user is able to logout of the application
1313
When I click the logout button
1414
Then I see the logout confirmation modal
1515

16+
@rbac_banner
1617
Scenario: User confirms logout
1718
Given the logout confirmation modal is displayed
1819
When I confirm the logout
1920
Then I see the logout successful page
21+
And I can not see the RBAC banner
2022

23+
@rbac_banner
2124
Scenario: User can log back in from the logout successful page
2225
Given I am on the logout successful page
2326
When I click the "log back in" button
2427
Then I am on the login page
28+
And I can not see the RBAC banner
2529

2630
############################################################################
2731
# Closing the logout modal

features/cpts_ui/search_for_a_prescription.feature

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,10 @@ Feature: I can visit the Clinical Prescription Tracker Service Website
2525
# | Prescription ID search |
2626
# | NHS Number Search |
2727
# | Basic Details Search |
28+
29+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4535
30+
@rbac_banner
31+
Scenario: User can see their RBAC banner when a role is selected
32+
Given I am logged in
33+
And I have a selected role
34+
Then I can see the RBAC banner

features/cpts_ui/select_your_role.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4653
33
Feature: Role selection page renders roles properly when logged in
44

5+
@rbac_banner
56
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4653
67
Scenario: User can navigate to the select your role page
78
Given I am logged in
89
And I go to the select your role page
10+
Then I can not see the RBAC banner
911

1012
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4656
1113
Scenario: User is redirected to the select your role page

features/steps/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
from cpts_ui.logout_steps import * # noqa: F403,F401
77
from cpts_ui.header_steps import * # noqa: F403,F401
88
from cpts_ui.confirm_role_steps import * # noqa: F403,F401
9+
from cpts_ui.rbac_banner import * # noqa: F403,F401
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# pylint: disable=no-name-in-module
2+
from behave import then # pyright: ignore [reportAttributeAccessIssue]
3+
from playwright.sync_api import expect
4+
5+
from pages.rbac_banner import RBACBannerPage
6+
7+
8+
############################################################################
9+
# THEN STEPS
10+
############################################################################
11+
12+
13+
@then("I can see the RBAC banner")
14+
def i_can_see_the_rbac_banner(context):
15+
rbac_banner = RBACBannerPage(context.page)
16+
17+
expect(rbac_banner.rbac_banner).to_be_visible()
18+
expect(rbac_banner.rbac_content).to_be_visible()
19+
20+
assert rbac_banner.rbac_content.text_content(), "No banner content"
21+
assert rbac_banner.banner_text.match(
22+
str(rbac_banner.rbac_content.text_content())
23+
), "Banner content does not match expected pattern"
24+
25+
26+
@then("I can not see the RBAC banner")
27+
def i_can_not_see_the_rbac_banner(context):
28+
rbac_banner = RBACBannerPage(context.page)
29+
30+
expect(rbac_banner.rbac_banner).not_to_be_visible()
31+
expect(rbac_banner.rbac_content).not_to_be_visible()

pages/rbac_banner.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from playwright.sync_api import Page
2+
import re
3+
4+
5+
class RBACBannerPage:
6+
def __init__(self, page: Page):
7+
self.page = page
8+
9+
self.banner_text = re.compile(
10+
r"^CONFIDENTIAL: PERSONAL PATIENT DATA accessed by (.+), (.+) - (.+) - (.+) \(ODS: (.+)\)$"
11+
)
12+
13+
self.rbac_banner = page.get_by_test_id("rbac-banner-div")
14+
self.rbac_content = page.get_by_test_id("rbac-banner-text")

0 commit comments

Comments
 (0)