Skip to content

Commit df437d5

Browse files
added tests for pre-role-selected
1 parent 800b280 commit df437d5

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

features/cpts_ui/select_your_role.feature

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,12 @@ 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+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4645
80+
Scenario: User with assigned roles sees the correct logged-in message
81+
Given I am logged in as a user with the role "Health Professional Access Role"
82+
And I am accessing "GREENE'S PHARMACY (FG419)"
83+
When I view the homepage
84+
Then I see a message saying "You are currently logged in at {pharmacy} with {role}."
85+
| pharmacy | role |
86+
| GREENE'S PHARMACY (FG419) | Health Professional Access Role |

features/steps/cpts_ui/select_your_role_steps.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,13 @@ 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 see a message saying "You are currently logged in at {pharmacy} with {role}."')
108+
def i_see_logged_in_message(context, pharmacy, role):
109+
select_your_role_page = SelectYourRole(context.page)
110+
message = f"You are currently logged in at {pharmacy} with {role}."
111+
expect(select_your_role_page.logged_in_message_container).to_contain_text(
112+
"Information: Information: You"
113+
)
114+
expect(select_your_role_page.logged_in_message).to_contain_text(message)

pages/select_your_role.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ def __init__(self, page: Page):
1515
)
1616
self.role_column_header = page.get_by_role("columnheader", name="Role")
1717

18+
# Logged-in message
19+
self.logged_in_message_container = page.get_by_text(
20+
"Information: Information: You"
21+
)
22+
self.logged_in_message = page.get_by_text("You are currently logged in")
23+
1824
# Roles without access
1925
self.roles_without_access_table_body = page.get_by_role("group").locator("div")
2026

@@ -46,15 +52,3 @@ def __init__(self, page: Page):
4652
self.first_row_role_name_no_access = page.get_by_role(
4753
"cell", name="General Medical Practitioner"
4854
).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)