Skip to content

Commit 8a8cf95

Browse files
Merge branch 'main' into aea-4645-pre-role-jw
2 parents 763114b + 9821bc3 commit 8a8cf95

File tree

13 files changed

+271
-5
lines changed

13 files changed

+271
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ For example:
7979
product=cpts-ui env=internal-dev PULL_REQUEST_ID=pr-300 tags=cpt-ui HEADLESS=true make run-tests
8080
```
8181

82-
Note that CPT-UI supports localhost testing. To do this, use the `env=localhost` variable. Make sure your localhost server is running!
82+
Note that CPT-UI supports localhost testing. To do this, use the `env=localhost` variable - but ensure you have *not* set the `PULL_REQUEST_ID` variable, as it is not needed and will break the tests. Make sure your localhost server is running!
8383

8484
### Method 4 (Not Recommended):
8585
Run the tests by running `behave` in a command prompt or terminal window.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@cpts_ui @confirm_role @regression @blocker @smoke @ui
2+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4537
3+
Feature: When the user selects a role, they see a confirmation page
4+
5+
Background:
6+
Given I am logged in
7+
8+
Scenario:
9+
Given I go to the select your role page
10+
And I have a selected role
11+
Then I see the 'confirm your role' page
12+
13+
Scenario:
14+
Given I am on the change your role page
15+
When I click a change role role card
16+
Then I see the 'confirm your role' page
17+
18+
Scenario:
19+
Given I am on the confirm your role page
20+
When I click the change link next to the role text
21+
Then I am on the change role page
22+
23+
Scenario:
24+
Given I am on the confirm your role page
25+
When I click the change link next to the org text
26+
Then I am on the change role page
27+
28+
Scenario:
29+
Given I am on the confirm your role page
30+
When I click the confirm and continue button on the confirm role page
31+
Then I am on the search for a prescription page

features/environment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def before_all(context):
136136
context.pfp_base_url = os.path.join(select_apigee_base_url(env), PFP_SUFFIX)
137137
context.psu_base_url = os.path.join(select_apigee_base_url(env), PSU_SUFFIX)
138138

139-
if PULL_REQUEST_ID:
139+
if PULL_REQUEST_ID and env != "LOCALHOST":
140140
print(f"--- Using pull request id: '{PULL_REQUEST_ID}'")
141141
pull_request_id = PULL_REQUEST_ID.lower()
142142
if "pr-" in pull_request_id:
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
@eps_fhir @smoke @regression @blocker @validator
2+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4895
3+
Feature: I can call the validator endpoint
4+
5+
Scenario: I can call the validator endpoint with valid fhir with x-show-validation-warnings set to false
6+
Given I am an authorised prescriber
7+
When I make a valid request to the eps_fhir validator endpoint with show validation set to false
8+
Then the response indicates a success
9+
And the validator response has 1 information issue
10+
11+
Scenario: I can call the validator endpoint with valid fhir with x-show-validation-warnings set to true
12+
Given I am an authorised prescriber
13+
When I make a valid request to the eps_fhir validator endpoint with show validation set to true
14+
Then the response indicates a bad request
15+
And the validator response has many information issue
16+
And the validator response has 0 error issue
17+
18+
Scenario: I can call the validator endpoint with valid fhir with x-show-validation-warnings set to false
19+
Given I am an authorised prescriber
20+
When I make a valid request to the eps_fhir validator endpoint with show validation set to unset
21+
Then the response indicates a success
22+
And the validator response has 1 information issue
23+
24+
Scenario: I can call the validator endpoint with invalid fhir
25+
Given I am an authorised prescriber
26+
When I make a invalid request to the eps_fhir validator endpoint with show validation set to false
27+
Then the response indicates a bad request
28+
And the validator response has many error issue
29+
And the validator response has error with diagnostic containing Failed to parse JSON encoded FHIR content
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
@eps_fhir_dispensing @smoke @regression @validator
2+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4895
3+
Feature: I can call the validator endpoint
4+
5+
Scenario: I can call the validator endpoint with valid fhir with x-show-validation-warnings set to false
6+
Given I am an authorised dispenser
7+
When I make a valid request to the eps_fhir_dispensing validator endpoint with show validation set to false
8+
Then the response indicates a success
9+
And the validator response has 1 information issue
10+
11+
Scenario: I can call the validator endpoint with valid fhir with x-show-validation-warnings set to true
12+
Given I am an authorised dispenser
13+
When I make a valid request to the eps_fhir_dispensing validator endpoint with show validation set to true
14+
Then the response indicates a bad request
15+
And the validator response has many information issue
16+
And the validator response has 0 error issue
17+
18+
Scenario: I can call the validator endpoint with valid fhir with x-show-validation-warnings set to unset
19+
Given I am an authorised dispenser
20+
When I make a valid request to the eps_fhir_dispensing validator endpoint with show validation set to unset
21+
Then the response indicates a success
22+
And the validator response has 1 information issue
23+
24+
Scenario: I can call the validator endpoint with invalid fhir
25+
Given I am an authorised dispenser
26+
When I make a invalid request to the eps_fhir_dispensing validator endpoint with show validation set to false
27+
Then the response indicates a bad request
28+
And the validator response has many error issue
29+
And the validator response has error with diagnostic containing Failed to parse JSON encoded FHIR content
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
@eps_fhir_prescribing @smoke @regression @validator
2+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4895
3+
Feature: I can call the validator endpoint
4+
5+
Scenario: I can call the validator endpoint with valid fhir with x-show-validation-warnings set to false
6+
Given I am an authorised prescriber
7+
When I make a valid request to the eps_fhir_prescribing validator endpoint with show validation set to false
8+
Then the response indicates a success
9+
And the validator response has 1 information issue
10+
11+
Scenario: I can call the validator endpoint with valid fhir with x-show-validation-warnings set to true
12+
Given I am an authorised prescriber
13+
When I make a valid request to the eps_fhir_prescribing validator endpoint with show validation set to true
14+
Then the response indicates a bad request
15+
And the validator response has many information issue
16+
And the validator response has 0 error issue
17+
18+
Scenario: I can call the validator endpoint with valid fhir with x-show-validation-warnings set to false
19+
Given I am an authorised prescriber
20+
When I make a valid request to the eps_fhir_prescribing validator endpoint with show validation set to unset
21+
Then the response indicates a success
22+
And the validator response has 1 information issue
23+
24+
Scenario: I can call the validator endpoint with invalid fhir
25+
Given I am an authorised prescriber
26+
When I make a invalid request to the eps_fhir_prescribing validator endpoint with show validation set to false
27+
Then the response indicates a bad request
28+
And the validator response has many error issue
29+
And the validator response has error with diagnostic containing Failed to parse JSON encoded FHIR content

features/steps/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
from cpts_ui.change_role_steps import * # noqa: F403,F401
66
from cpts_ui.logout_steps import * # noqa: F403,F401
77
from cpts_ui.header_steps import * # noqa: F403,F401
8+
from cpts_ui.confirm_role_steps import * # noqa: F403,F401

features/steps/common_steps.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ def indicate_record_created(context):
3434
common.the_expected_response_code_is_returned(context, 201)
3535

3636

37+
@then("the response indicates a bad request")
38+
def indicate_bad_request_response(context):
39+
if "sandbox" in context.config.userdata["env"].lower():
40+
return
41+
common.the_expected_response_code_is_returned(context, 400)
42+
43+
3744
@then("I can see the version information in the response")
3845
def i_see_version_in_response(context):
3946
response = context.response.json()

features/steps/cpts_ui/change_role_steps.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
@given("I am on the change your role page")
2020
def given_i_am_on_the_change_role_page(context):
2121
context.execute_steps("when I go to change my role")
22-
change_role_page = ChangeRole(context.page)
23-
24-
expect(change_role_page.change_role_title).to_be_visible(timeout=60000)
22+
context.execute_steps("then I am on the change role page")
2523

2624

2725
@given("the summary table body is displayed")
@@ -85,6 +83,12 @@ def i_go_to_change_my_role(context):
8583
############################################################################
8684

8785

86+
@then("I am on the change role page")
87+
def i_am_on_the_change_role_page(context):
88+
change_role_page = ChangeRole(context.page)
89+
expect(change_role_page.change_role_title).to_be_visible(timeout=60000)
90+
91+
8892
@then("I see the change role roles without access table")
8993
def then_i_see_the_roles_without_access_table(context):
9094
change_role_page = ChangeRole(context.page)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# pylint: disable=no-name-in-module
2+
from behave import given, when, then # pyright: ignore [reportAttributeAccessIssue]
3+
from playwright.sync_api import expect
4+
5+
from pages.confirm_role import ConfirmRole
6+
7+
8+
############################################################################
9+
# GIVEN STEPS
10+
############################################################################
11+
12+
13+
@given("I am on the confirm your role page")
14+
def i_am_on_the_confirm_your_role_page(context):
15+
context.execute_steps("given I go to the select your role page")
16+
context.execute_steps("given I have a selected role")
17+
context.execute_steps("then I see the 'confirm your role' page")
18+
19+
20+
############################################################################
21+
# WHEN STEPS
22+
############################################################################
23+
24+
25+
@when("I click the change link next to the role text")
26+
def i_click_the_change_link_next_to_the_role_text(context):
27+
confirm_role_page = ConfirmRole(context.page)
28+
confirm_role_page.role_change_role.click()
29+
30+
31+
@when("I click the change link next to the org text")
32+
def i_click_the_change_link_next_to_the_org_text(context):
33+
confirm_role_page = ConfirmRole(context.page)
34+
confirm_role_page.org_change_role.click()
35+
36+
37+
@when("I click the confirm and continue button on the confirm role page")
38+
def i_click_the_confirm_and_continue_button_on_the_confirm_role_page(context):
39+
confirm_role_page = ConfirmRole(context.page)
40+
confirm_role_page.confirm_button.click()
41+
42+
43+
############################################################################
44+
# THEN STEPS
45+
############################################################################
46+
47+
48+
@then("I see the 'confirm your role' page")
49+
def i_see_the_confirm_your_role_page(context):
50+
confirm_role_page = ConfirmRole(context.page)
51+
52+
expect(confirm_role_page.header).to_be_visible()
53+
expect(confirm_role_page.role_label_cell).to_be_visible()
54+
expect(confirm_role_page.org_label_cell).to_be_visible()
55+
expect(confirm_role_page.org_text_cell).to_be_visible()
56+
expect(confirm_role_page.role_text_cell).to_be_visible()
57+
expect(confirm_role_page.role_change_role).to_be_visible()
58+
expect(confirm_role_page.org_change_role).to_be_visible()

0 commit comments

Comments
 (0)