Skip to content

Commit bef5a15

Browse files
committed
Merge branch 'main' of https://github.com/NHSDigital/eps-prescription-tracker-ui into AEA-4655-user-has-no-access-to-cpts
2 parents c9372cb + 23daf8b commit bef5a15

File tree

7 files changed

+49
-21
lines changed

7 files changed

+49
-21
lines changed

.github/workflows/regression_tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
uses: asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
7070

7171
- name: Cache asdf
72-
uses: actions/cache@a2ed59d39b352305bdd2f628719a53b2cc4f9613
72+
uses: actions/cache@v4
7373
with:
7474
path: |
7575
~/.asdf
@@ -83,7 +83,7 @@ jobs:
8383
PYTHON_CONFIGURE_OPTS: --enable-shared
8484

8585
- name: Cache Virtualenv
86-
uses: actions/cache@a2ed59d39b352305bdd2f628719a53b2cc4f9613
86+
uses: actions/cache@v4
8787
id: cache-venv
8888
with:
8989
path: .venv
@@ -163,7 +163,7 @@ jobs:
163163
repositories: "electronic-prescription-service-api-regression-tests,eps-test-reports"
164164

165165
- name: Report failure on test failure
166-
if: steps.tests.outcome != 'success' || ( steps.sha1_tests.outcome != 'success' && steps.sha1_tests.outcome != 'skipped' )
166+
if: steps.tests.outcome != 'success' || ( steps.sha1_tests.outcome != 'success' && steps.sha1_tests.outcome != 'skipped' )
167167
run: |
168168
poetry run python scripts/send_test_results.py --token=${{ steps.generate-token.outputs.token }} --run_id ${{GITHUB.RUN_ID}}
169169
echo The regression tests step failed, this likely means there are test failures.

features/cpts_ui/search_for_a_prescription.feature

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
@cpts_ui @home @regression @blocker @smoke @ui
1+
@cpts_ui @search_for_a_prescription @regression @blocker @smoke @ui
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+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4656
6+
Scenario: User is redirected to the Search For A Prescription Page
7+
Given I am logged in with a single access role
8+
Then I am on the search for a prescription page
9+
510
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4516
611
Scenario: User can view the Search For A Prescription Page
712
Given I am on the homepage

features/cpts_ui/select_your_role.feature

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,24 @@ Feature: Role selection page renders roles properly when logged in
55
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4653
66
Scenario: User can navigate to the select your role page
77
Given I am logged in
8-
And I am on the select your role page
8+
Then I am on the select your role page
9+
10+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4656
11+
Scenario: User is redirected to the select your role page
12+
Given I am logged in
913
Then I am on the select your role page
1014

1115
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4653
1216
Scenario: User can see the summary container, but not the table contents by default
1317
Given I am logged in
14-
And I am on the select your role page
18+
Then I am on the select your role page
1519
Then I can see the summary container
1620
And I cannot see the summary table body
1721

1822
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4653
1923
Scenario: User can expand the summary table to see the contents. Clicking again hides it
2024
Given I am logged in
21-
And I am on the select your role page
25+
Then I am on the select your role page
2226
When I click on the summary expander
2327
Then I can see the summary table body
2428
And I can see the table body has a header row
@@ -30,40 +34,40 @@ Feature: Role selection page renders roles properly when logged in
3034
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4651
3135
Scenario: User can see roles with access cards
3236
Given I am logged in
33-
And I am on the select your role page
37+
Then I am on the select your role page
3438
Then I can see the roles with access cards
3539

3640
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4651
3741
Scenario: User can navigate to the your_selected_role page
3842
Given I am logged in
39-
And I am on the select your role page
43+
Then I am on the select your role page
4044
Then I can navigate to the your selected role page by clicking a card
4145

4246
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4655
4347
Scenario: User without access can see the header on the select your role page
4448
Given I am logged in without access
45-
And I am on the select your role page
49+
Then I am on the select your role page
4650
Then I cannot see the your selected role subheader
4751
And I can see the no access header
4852

4953
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4655
5054
Scenario: User without access can see the message on the select your role page
5155
Given I am logged in without access
52-
And I am on the select your role page
56+
Then I am on the select your role page
5357
Then I cannot see the your selected role subheader
5458
And I can see the no access message
5559

5660
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4655
5761
Scenario: User without access can see the summary container, but not the table contents by default
5862
Given I am logged in without access
59-
And I am on the select your role page
63+
Then I am on the select your role page
6064
Then I can see the summary container
6165
And I cannot see the summary table body
6266

6367
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4655
6468
Scenario: User without access can expand the summary table to see the contents. Clicking again hides it
6569
Given I am logged in without access
66-
And I am on the select your role page
70+
Then I am on the select your role page
6771
When I click on the summary expander
6872
Then I can see the summary table body
6973
And I can see the table body has a header row

features/environment.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@
5050
"dispenser": {"user_id": "555260695103", "role_id": "555265434108"},
5151
}
5252
LOGIN_USERS = {"user_id": "9449304130"}
53-
MOCK_CIS2_LOGIN_ID_1 = "555073103100"
54-
MOCK_CIS2_LOGIN_ID_2 = "555083343101"
53+
MOCK_CIS2_LOGIN_ID_MULTIPLE_ACCESS_ROLES = "555073103100"
54+
MOCK_CIS2_LOGIN_ID_NO_ACCESS_ROLE = "555083343101"
55+
MOCK_CIS2_LOGIN_ID_SINGLE_ACCESS_ROLE = "555043300081"
56+
MOCK_CIS2_LOGIN_ID_NO_ROLES = "555073103101"
5557

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

features/steps/cpts_ui/search_for_a_prescription_steps.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44

55
from pages.home import Home
66
from pages.search_for_a_prescription import SearchForAPrescription
7+
from features.environment import MOCK_CIS2_LOGIN_ID_SINGLE_ACCESS_ROLE
8+
9+
10+
@given("I am logged in with a single access role")
11+
def login_single_role(context):
12+
context.page.goto(context.cpts_ui_base_url + "site/auth_demo.html")
13+
context.page.get_by_role("button", name="Log in with mock CIS2").click()
14+
context.page.get_by_label("Username").fill(MOCK_CIS2_LOGIN_ID_SINGLE_ACCESS_ROLE)
15+
context.page.get_by_role("button", name="Sign In").click()
16+
context.page.wait_for_url("**/searchforaprescription")
717

818

919
@when("I go to the search for a prescription page")
@@ -21,7 +31,8 @@ def go_to_search_prescription_page(context):
2131

2232
@then("I am on the search for a prescription page")
2333
def i_am_on_the_search_prescription_page(context):
24-
expect(context.page).to_have_title("Search for a prescription")
34+
search_for_a_prescription = SearchForAPrescription(context.page)
35+
expect(search_for_a_prescription.temp_text).to_be_visible()
2536

2637

2738
@when("I click on tab {}")

features/steps/cpts_ui/select_your_role_steps.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
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_1, MOCK_CIS2_LOGIN_ID_2
6+
from features.environment import (
7+
MOCK_CIS2_LOGIN_ID_MULTIPLE_ACCESS_ROLES,
8+
MOCK_CIS2_LOGIN_ID_NO_ACCESS_ROLE,
9+
)
710

811

912
@when("I go to the select your role page")
@@ -28,18 +31,18 @@ def verify_on_select_your_role_page(context):
2831
def login(context):
2932
context.page.goto(context.cpts_ui_base_url + "site/auth_demo.html")
3033
context.page.get_by_role("button", name="Log in with mock CIS2").click()
31-
context.page.get_by_label("Username").fill(MOCK_CIS2_LOGIN_ID_1)
34+
context.page.get_by_label("Username").fill(MOCK_CIS2_LOGIN_ID_MULTIPLE_ACCESS_ROLES)
3235
context.page.get_by_role("button", name="Sign In").click()
33-
context.page.wait_for_url("**/auth_demo.html")
36+
context.page.wait_for_url("**/selectyourrole.html")
3437

3538

3639
@given("I am logged in without access")
3740
def login_without_access(context):
3841
context.page.goto(context.cpts_ui_base_url + "site/auth_demo.html")
3942
context.page.get_by_role("button", name="Log in with mock CIS2").click()
40-
context.page.get_by_label("Username").fill(MOCK_CIS2_LOGIN_ID_2)
43+
context.page.get_by_label("Username").fill(MOCK_CIS2_LOGIN_ID_NO_ACCESS_ROLE)
4144
context.page.get_by_role("button", name="Sign In").click()
42-
context.page.wait_for_url("**/auth_demo.html")
45+
context.page.wait_for_url("**/selectyourrole.html")
4346

4447

4548
@then("I can see the summary container")

pages/search_for_a_prescription.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ class SearchForAPrescription:
55

66
def __init__(self, page: Page):
77
self.page = page
8+
self.temp_text = (
9+
page.locator("div").filter(has_text="Search for a prescription").nth(2)
10+
)
811
self.hero_banner = page.get_by_test_id("hero-heading")
912
self.prescription_id_search_tab = page.get_by_role(
1013
"tab", name="Prescription ID search"

0 commit comments

Comments
 (0)