Skip to content

Commit f3e5961

Browse files
authored
New: [AEA-4535] - Add RBAC banner (#222)
## Summary - ✨ New Feature ### Details Regression tests for NHSDigital/eps-prescription-tracker-ui#370 Just piggybacks off existing tests
1 parent 80e4d38 commit f3e5961

14 files changed

+107
-43
lines changed
Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
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-
8-
Scenario:
9-
Given I go to the select your role page
7+
8+
Scenario: user is able to select a role, and see a confirmation page:
9+
When 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

13-
Scenario:
14+
Scenario: user can change their role, and see a confirmation page
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

18-
Scenario:
20+
Scenario: user can select a role, then change their mind with the first change link
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+
# TODO: Since the role selection doesnt work on the backend, this re-fetches the fact that the user has no selected Role
25+
# Uncomment this in PR 334: https://github.com/NHSDigital/eps-prescription-tracker-ui/pull/334
26+
# And I can see the RBAC banner
2227

23-
Scenario:
28+
Scenario: user can select a role, then change their mind with the second change link
2429
Given I am on the confirm your role page
2530
When I click the change link next to the org text
2631
Then I am on the change role page
32+
# TODO: As above
33+
# And I can see the RBAC banner
2734

28-
Scenario:
35+
Scenario: user is sent from role confirmation page to the search for a prescription page
2936
Given I am on the confirm your role page
3037
When I click the confirm and continue button on the confirm role page
3138
Then I am on the search for a prescription page
39+
And I can see the RBAC banner

features/cpts_ui/header_links.feature

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,25 @@ Feature: Header links are displayed according to the user's state and the curren
2727
Then I see the "Logout" link
2828

2929
Scenario: Logout link is not shown if user is not logged in
30-
Given I am on the home page
30+
When I am on the homepage
3131
Then I do not see the "Logout" link
3232

3333
############################################################################
3434
# SELECT YOUR ROLE
3535
############################################################################
3636
Scenario: Select Your Role link is shown on the homepage, if we dont select a role
3737
Given I am logged in
38-
And I am on the home page
38+
When I am on the homepage
3939
Then I see the "Select Your Role" link
4040

4141
Scenario: Select Your Role link is not shown if I go to the select your role page
4242
Given I am logged in
43-
And I go to the select your role page
43+
When I go to the select your role page
4444
Then I do not see the "Select Your Role" link
4545

4646
Scenario: Select Your Role link is not shown if I already have a selected role
4747
Given I am logged in
48-
And I have a selected role
48+
When I have a selected role
4949
And I am on the homepage
5050
Then I do not see the "Select Your Role" link
5151

@@ -54,13 +54,13 @@ Feature: Header links are displayed according to the user's state and the curren
5454
############################################################################
5555
Scenario: Change Role link is shown if the user has a selected role
5656
Given I am logged in
57-
And I have a selected role
58-
And I am on the home page
57+
When I have a selected role
58+
When I am on the homepage
5959
Then I see the "Change Role" link
6060

6161
Scenario: Change Role link is not shown if the user has no selected role
6262
Given I am logged in
63-
And I am on the homepage
63+
When I am on the homepage
6464
Then I do not see the "Change Role" link
6565

6666
# FIXME: Address this when the SPA is fixed!
@@ -69,7 +69,7 @@ Feature: Header links are displayed according to the user's state and the curren
6969
# @fixme
7070
# Scenario: Change Role link is not shown if I go to the select your role page
7171
# Given I am logged in
72-
# And I have a selected role
72+
# When I have a selected role
7373
# And I go to the select your role page
7474
# Then I do not see the "Change Role" link
7575

features/cpts_ui/home.feature

Lines changed: 3 additions & 1 deletion
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
6-
When I go to the homepage
7+
When I am on 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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Feature: The user is able to logout of the application
44

55
Background:
66
Given I am logged in
7-
And I go to the select your role page
7+
When I go to the select your role page
88

99
############################################################################
1010
# Logging out
@@ -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+
When I have a selected role
34+
Then I can see the RBAC banner

features/cpts_ui/select_your_role.feature

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,29 @@
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
8-
And I go to the select your role page
9+
When 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
1214
Given I am logged in
13-
And I go to the select your role page
15+
When I go to the select your role page
1416

1517
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4653
1618
Scenario: User can see the summary container, but not the table contents by default
1719
Given I am logged in
18-
And I go to the select your role page
20+
When I go to the select your role page
1921
Then I can see the summary container
2022
And I cannot see the summary table body
2123

2224
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4653
2325
Scenario: User can expand the summary table to see the contents. Clicking again hides it
2426
Given I am logged in
25-
And I go to the select your role page
27+
When I go to the select your role page
2628
When I click on the summary expander
2729
Then I can see the summary table body
2830
And I can see the table body has a header row
@@ -34,40 +36,40 @@ Feature: Role selection page renders roles properly when logged in
3436
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4651
3537
Scenario: User can see roles with access cards
3638
Given I am logged in
37-
And I go to the select your role page
39+
When I go to the select your role page
3840
Then I can see the roles with access cards
3941

4042
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4651
4143
Scenario: User can navigate to the your selected role page
4244
Given I am logged in
43-
And I go to the select your role page
45+
When I go to the select your role page
4446
Then I can navigate to the your selected role page by clicking a card
4547

4648
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4655
4749
Scenario: User without access can see the header on the select your role page
4850
Given I am logged in without access
49-
And I go to the select your role page
51+
When I go to the select your role page
5052
Then I cannot see the your selected role subheader
5153
And I can see the no access header
5254

5355
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4655
5456
Scenario: User without access can see the message on the select your role page
5557
Given I am logged in without access
56-
And I go to the select your role page
58+
When I go to the select your role page
5759
Then I cannot see the your selected role subheader
5860
And I can see the no access message
5961

6062
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4655
6163
Scenario: User without access can see the summary container, but not the table contents by default
6264
Given I am logged in without access
63-
And I go to the select your role page
65+
When I go to the select your role page
6466
Then I can see the summary container
6567
And I cannot see the summary table body
6668

6769
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4655
6870
Scenario: User without access can expand the summary table to see the contents. Clicking again hides it
6971
Given I am logged in without access
70-
And I go to the select your role page
72+
When I go to the select your role page
7173
When I click on the summary expander
7274
Then I can see the summary table body
7375
And I can see the table body has a header row
@@ -80,5 +82,5 @@ Feature: Role selection page renders roles properly when logged in
8082
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4645
8183
Scenario: User with a pre selected role sees their pre selected role
8284
Given I am logged in as a user with a pre selected role
83-
And I go to the select your role page
85+
When I go to the select your role page
8486
Then I can see the role that has been pre selected

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

features/steps/cpts_ui/change_role_steps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def when_i_click_change_role_header_link(context):
6969

7070
@when("I go to change my role")
7171
def i_go_to_change_my_role(context):
72-
context.execute_steps("Given I have a selected role")
72+
context.execute_steps("when I have a selected role")
7373
change_role_page = ChangeRole(context.page)
7474

7575
# We need to give the backend time to catch up?

features/steps/cpts_ui/common_steps.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,9 @@
1616
###############################################################################
1717

1818

19-
@given("I am on the home page")
20-
def i_am_on_home_page(context):
21-
context.page.goto(context.cpts_ui_base_url + "site/")
22-
23-
2419
@given("I am on the login page")
2520
def i_am_on_login_page(context):
26-
context.execute_steps("given I am on the home page")
21+
context.execute_steps("when I am on the homepage")
2722
context.page.get_by_test_id("eps_header_serviceName").click()
2823

2924

features/steps/cpts_ui/confirm_role_steps.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
@given("I am on the confirm your role page")
1414
def i_am_on_the_confirm_your_role_page(context):
15-
context.execute_steps("given I go to the select your role page")
16-
context.execute_steps("given I have a selected role")
15+
context.execute_steps("when I have a selected role")
1716
context.execute_steps("then I see the 'confirm your role' page")
1817

1918

0 commit comments

Comments
 (0)