Skip to content

Commit 1db7701

Browse files
committed
Merge branch 'main' into aea-0000-auth_redirect
2 parents 5b26616 + 6b95162 commit 1db7701

File tree

4 files changed

+50
-34
lines changed

4 files changed

+50
-34
lines changed

features/cpts_ui/select_your_role.feature

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ Feature: Role selection page renders roles properly when logged in
44

55
Background:
66
Given I am logged in
7-
And I am on the select_your_role page
7+
And I am on the select your role page
88

99
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4653
1010
Scenario: User can navigate to the select_your_role page
11-
Then I am on the select_your_role page
11+
Then I am on the select your role page
1212

1313
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4653
1414
Scenario: User can see the summary container, but not the table contents by default
@@ -24,11 +24,19 @@ Feature: Role selection page renders roles properly when logged in
2424
When I click on the summary expander
2525
Then I can see the summary container
2626
And I cannot see the summary table body
27-
27+
2828
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4651
2929
Scenario: User can see roles with access cards
3030
Then I can see the roles with access cards
3131

3232
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4651
33-
Scenario: User can navigate to the your_selected_role page
34-
Then I can navigate to the your_selected_role page by clicking a card
33+
Scenario: User can navigate to the your selected role page
34+
Then I can navigate to the your selected role page by clicking a card
35+
36+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4658
37+
Scenario: User can see the header on the select your role page
38+
Then I can see the your selected role header
39+
40+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4658
41+
Scenario: User can see the subheader on the select your role page
42+
Then I can see the your selected role subheader

features/environment.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"dispenser": {"user_id": "555260695103", "role_id": "555265434108"},
5151
}
5252
LOGIN_USERS = {"user_id": "9449304130"}
53+
MOCK_CIS2_LOGIN_ID = "555073103100"
5354

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

features/steps/cpts_ui/select_your_role_steps.py

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,22 @@
33
from playwright.sync_api import expect
44

55
from pages.select_your_role import SelectYourRole
6+
from features.environment import MOCK_CIS2_LOGIN_ID
67

78

8-
@when("I go to the select_your_role page")
9+
@when("I go to the select your role page")
910
def i_go_to_the_select_your_role_page(context):
1011
context.page.goto(context.cpts_ui_base_url + "site/selectyourrole.html")
1112

1213

13-
@given("I am on the select_your_role page")
14+
@given("I am on the select your role page")
1415
def i_am_on_select_your_role_page(context):
1516
i_go_to_the_select_your_role_page(context)
1617
select_your_role_page = SelectYourRole(context.page)
1718
expect(select_your_role_page.summary).to_be_visible()
1819

1920

20-
@then("I am on the select_your_role page")
21+
@then("I am on the select your role page")
2122
def verify_on_select_your_role_page(context):
2223
select_your_role_page = SelectYourRole(context.page)
2324
expect(select_your_role_page.summary).to_be_visible()
@@ -27,7 +28,7 @@ def verify_on_select_your_role_page(context):
2728
def login(context):
2829
context.page.goto(context.cpts_ui_base_url + "site/login")
2930
context.page.get_by_role("button", name="Log in with mock CIS2").click()
30-
context.page.get_by_label("Username").fill("555073103100")
31+
context.page.get_by_label("Username").fill(MOCK_CIS2_LOGIN_ID)
3132
context.page.get_by_role("button", name="Sign In").click()
3233
context.page.wait_for_url("**/login.html")
3334

@@ -75,29 +76,24 @@ def click_on_summary_expander(context):
7576
@then("I can see the roles with access cards")
7677
def i_can_see_the_roles_with_access_cards(context):
7778
select_your_role_page = SelectYourRole(context.page)
78-
try:
79-
expect(select_your_role_page.first_role_card).to_be_visible(timeout=5000)
80-
print("Verified that at least one role card is displayed.")
81-
except Exception as e:
82-
print("Error verifying roles with access cards:", str(e))
83-
print("Page content during error:")
84-
print(context.page.content())
85-
raise
79+
expect(select_your_role_page.first_role_card).to_be_visible()
8680

8781

88-
@then("I can navigate to the your_selected_role page by clicking a card")
82+
@then("I can navigate to the your selected role page by clicking a card")
8983
def i_can_navigate_to_the_your_selected_role_page(context):
9084
select_your_role_page = SelectYourRole(context.page)
91-
try:
92-
expect(select_your_role_page.first_role_card).to_be_visible(timeout=5000)
93-
select_your_role_page.first_role_card.click()
94-
context.page.wait_for_url(select_your_role_page.selected_role_url)
95-
print(
96-
"Navigation to your_selected_role page successful. Current URL:",
97-
context.page.url,
98-
)
99-
except Exception as e:
100-
print("Error navigating to your_selected_role page:", str(e))
101-
print("Page content during error:")
102-
print(context.page.content())
103-
raise
85+
expect(select_your_role_page.first_role_card).to_be_visible()
86+
select_your_role_page.first_role_card.click()
87+
context.page.wait_for_url(select_your_role_page.selected_role_url)
88+
89+
90+
@then("I can see the your selected role header")
91+
def i_can_see_select_your_role_header(context):
92+
select_your_role_page = SelectYourRole(context.page)
93+
expect(select_your_role_page.select_role_header).to_be_visible()
94+
95+
96+
@then("I can see the your selected role subheader")
97+
def i_can_see_select_your_role_subheader(context):
98+
select_your_role_page = SelectYourRole(context.page)
99+
expect(select_your_role_page.select_role_subheader).to_be_visible()

pages/select_your_role.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33

44
class SelectYourRole:
55
def __init__(self, page: Page):
6+
"""
7+
Initialise the SelectYourRole page object with locators and text constants.
8+
"""
69
self.page = page
710

8-
self.slr_title = "Select your role"
11+
# Title and summary locators
912
self.summary = page.locator("summary")
1013
self.organisation_column_header = page.get_by_role(
1114
"columnheader", name="Organisation"
@@ -19,11 +22,19 @@ def __init__(self, page: Page):
1922
"cell", name="Registration Authority Agent"
2023
).first
2124

25+
# Role cards - roles with access
2226
self.roles_with_access_cards = page.locator(".nhsuk-card--clickable")
2327
self.first_role_card = self.roles_with_access_cards.first
2428
self.role_card_headings = page.locator(".nhsuk-card__heading")
2529
self.role_card_descriptions = page.locator(".eps-card__roleName")
2630
self.selected_role_url = "**/site/yourselectedrole"
2731

28-
self.header = "[id='eps_header']"
29-
self.footer = "[id='eps_footer']"
32+
# Header locators
33+
self.select_role_header = page.locator(
34+
"span[data-testid='eps_header_selectYourRole'] > span.nhsuk-title"
35+
)
36+
37+
# Subheader locators
38+
self.select_role_subheader = page.locator(
39+
"span.nhsuk-caption-l.nhsuk-caption--bottom"
40+
)

0 commit comments

Comments
 (0)