Skip to content

Commit ba6a9b7

Browse files
committed
Add tests for a user without access table
1 parent 823b827 commit ba6a9b7

File tree

3 files changed

+44
-12
lines changed

3 files changed

+44
-12
lines changed

features/cpts_ui/select_your_role.feature

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,31 @@ Feature: Role selection page renders roles properly when logged in
4343
Scenario: User without access can see the header on the select your role page
4444
Given I am logged in without access
4545
And I am on the select_your_role page
46-
Then I cannot see the your selected role header
46+
Then I cannot see the your selected role subheader
4747
And I can see the no access header
4848

4949
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4655
5050
Scenario: User without access can see the message on the select your role page
5151
Given I am logged in without access
5252
And I am on the select_your_role page
53-
Then I cannot see the your selected role header
53+
Then I cannot see the your selected role subheader
5454
And I can see the no access message
55+
56+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4655
57+
Scenario: User without access can see the summary container, but not the table contents by default
58+
Given I am logged in without access
59+
And I am on the select_your_role page
60+
Then I can see the summary container
61+
And I cannot see the summary table body
62+
63+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4655
64+
Scenario: User without access can expand the summary table to see the contents. Clicking again hides it
65+
Given I am logged in without access
66+
And I am on the select_your_role page
67+
When I click on the summary expander
68+
Then I can see the summary table body
69+
And I can see the table body has a header row
70+
And I can see the no access table body has data
71+
When I click on the summary expander
72+
Then I can see the summary container
73+
And I cannot see the summary table body

features/steps/cpts_ui/select_your_role_steps.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,26 @@ def i_can_navigate_to_the_your_selected_role_page(context):
112112
raise
113113

114114

115-
@then("I cannot see the your selected role header")
116-
def i_cannot_see_select_your_role_header(context):
115+
@then("I cannot see the your selected role subheader")
116+
def i_can_see_select_your_role_subheader(context):
117117
select_your_role_page = SelectYourRole(context.page)
118-
expect(select_your_role_page.select_role_header).to_be_visible(visible=False)
118+
expect(select_your_role_page.select_role_subheader).to_be_visible(visible=False)
119119

120120

121121
@then("I can see the no access header")
122-
def i_can_see_select_your_role_header(context):
122+
def i_can_see_the_no_access_header(context):
123123
select_your_role_page = SelectYourRole(context.page)
124124
expect(select_your_role_page.no_access_header).to_be_visible()
125125

126126

127127
@then("I can see the no access message")
128-
def i_can_see_select_your_role_subheader(context):
128+
def i_can_see_the_no_access_message(context):
129129
select_your_role_page = SelectYourRole(context.page)
130130
expect(select_your_role_page.no_access_message).to_be_visible()
131+
132+
133+
@then("I can see the no access table body has data")
134+
def i_can_see_the_no_access_table_body_data(context):
135+
select_your_role_page = SelectYourRole(context.page)
136+
expect(select_your_role_page.first_row_org_name_no_access).to_be_visible()
137+
expect(select_your_role_page.first_row_role_name_no_access).to_be_visible()

pages/select_your_role.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,21 @@ def __init__(self, page: Page):
2525
self.role_card_descriptions = page.locator(".eps-card__roleName")
2626
self.selected_role_url = "**/site/yourselectedrole"
2727

28-
self.header = "[id='eps_header']"
29-
self.footer = "[id='eps_footer']"
30-
31-
self.select_role_header = page.locator(
32-
"span[data-testid='eps_header_selectYourRole'] > span.nhsuk-title"
28+
self.select_role_subheader = page.locator(
29+
"span.nhsuk-caption-l.nhsuk-caption--bottom"
3330
)
3431

3532
self.no_access_header = page.locator(".nhsuk-heading-xl")
3633
self.no_access_message = page.get_by_text("None of the roles on your")
3734
self.roles_without_access_header = page.get_by_role(
3835
"heading", name="Your roles without access"
3936
)
37+
self.first_row_org_name_no_access = page.get_by_role(
38+
"cell", name="NO ORG NAME (ODS: A21464)"
39+
).first
40+
self.first_row_role_name_no_access = page.get_by_role(
41+
"cell", name="General Medical Practitioner"
42+
).first
43+
44+
self.header = "[id='eps_header']"
45+
self.footer = "[id='eps_footer']"

0 commit comments

Comments
 (0)