Skip to content

Commit da69223

Browse files
New: [AEA-4645] - add pre role tests (#220)
## Summary When a user has authenticated through CIS2 and the session can also be transferred and be used in the CPTS then this will show on the page. It will also be used when a user has authenticated and selected a role on the prescription and wants to change role. This gives them the opportunity ** to stick with the role selected or see if there is a different role to be selected - ✨ New Feature
1 parent 9821bc3 commit da69223

File tree

5 files changed

+29
-12
lines changed

5 files changed

+29
-12
lines changed

features/cpts_ui/select_your_role.feature

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,10 @@ Feature: Role selection page renders roles properly when logged in
7575
When I click on the summary expander
7676
Then I can see the summary container
7777
And I cannot see the summary table body
78+
79+
80+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4645
81+
Scenario: User with a pre selected role sees their pre selected role
82+
Given I am logged in as a user with a pre selected role
83+
And I go to the select your role page
84+
Then I can see the role that has been pre selected

features/environment.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
MOCK_CIS2_LOGIN_ID_NO_ACCESS_ROLE = "555083343101"
5858
MOCK_CIS2_LOGIN_ID_SINGLE_ACCESS_ROLE = "555043300081"
5959
MOCK_CIS2_LOGIN_ID_NO_ROLES = "555073103101"
60+
MOCK_CIS2_LOGIN_ID_MULTIPLE_ACCESS_ROLES_WITH_SELECTED_ROLE = "555043304334"
6061

6162
REPOS = {
6263
"CPTS-UI": "https://github.com/NHSDigital/eps-prescription-tracker-ui",

features/steps/cpts_ui/common_steps.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
MOCK_CIS2_LOGIN_ID_MULTIPLE_ACCESS_ROLES,
77
MOCK_CIS2_LOGIN_ID_NO_ACCESS_ROLE,
88
MOCK_CIS2_LOGIN_ID_SINGLE_ACCESS_ROLE,
9+
MOCK_CIS2_LOGIN_ID_MULTIPLE_ACCESS_ROLES_WITH_SELECTED_ROLE,
910
)
1011

1112
select_your_role_url_pattern = re.compile(r".*/selectyourrole(?:/|\.html)$")
@@ -65,6 +66,17 @@ def login_single_role(context):
6566
context.page.wait_for_url(select_your_role_url_pattern)
6667

6768

69+
@given("I am logged in as a user with a pre selected role")
70+
def login_pre_role_selected(context):
71+
context.execute_steps("given I am on the login page")
72+
context.page.get_by_role("button", name="Log in with mock CIS2").click()
73+
context.page.get_by_label("Username").fill(
74+
MOCK_CIS2_LOGIN_ID_MULTIPLE_ACCESS_ROLES_WITH_SELECTED_ROLE
75+
)
76+
context.page.get_by_role("button", name="Sign In").click()
77+
context.page.wait_for_url(select_your_role_url_pattern)
78+
79+
6880
###############################################################################
6981
# WHEN
7082
###############################################################################

features/steps/cpts_ui/select_your_role_steps.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,12 @@ def i_can_see_the_no_access_table_body_data(context):
102102
select_your_role_page = SelectYourRole(context.page)
103103
expect(select_your_role_page.first_row_org_name_no_access).to_be_visible()
104104
expect(select_your_role_page.first_row_role_name_no_access).to_be_visible()
105+
106+
107+
@then("I can see the role that has been pre selected")
108+
def i_see_logged_in_message(context):
109+
select_your_role_page = SelectYourRole(context.page)
110+
pre_selected_element = select_your_role_page.page.get_by_test_id(
111+
"eps_select_your_role_pre_role_selected"
112+
)
113+
expect(pre_selected_element).to_be_visible()

pages/select_your_role.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,3 @@ def __init__(self, page: Page):
4646
self.first_row_role_name_no_access = page.get_by_role(
4747
"cell", name="General Medical Practitioner"
4848
).first
49-
50-
self.no_access_header = page.locator(".nhsuk-heading-xl")
51-
self.no_access_message = page.get_by_text("None of the roles on your")
52-
self.roles_without_access_header = page.get_by_role(
53-
"heading", name="Your roles without access"
54-
)
55-
self.first_row_org_name_no_access = page.get_by_role(
56-
"cell", name="NO ORG NAME (ODS: A21464)"
57-
).first
58-
self.first_row_role_name_no_access = page.get_by_role(
59-
"cell", name="General Medical Practitioner"
60-
).first

0 commit comments

Comments
 (0)