Skip to content

Commit d03fe97

Browse files
New: [AEA-4941] - Repeat prescription automated test end to end journey (#287)
## Summary - Routine Change - ✨ New Feature ### Details updated pre-commit version package updates slight addition to `make deep-clean` template.env updated to reflect new environment variables used when running locally Modified EPS tests to include repeats when creating prescriptions
1 parent 624ab93 commit d03fe97

19 files changed

+708
-672
lines changed

.gitallowed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ CidrBlock:\s?"?10\.0\.\d+\.\d+\/\d+"
1313
.*token_response\[\"access_token\"\].*
1414
.*password=None.*
1515
.*secrets.REGRESSION_TESTS_PAT.*
16+
*.env

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ default_language_version:
22
python: python3.12
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.5.0
5+
rev: v5.0.0
66
hooks:
77
- id: check-merge-conflict
88
name: Check for merge conflict strings

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ update-node:
1818
update-poetry:
1919
poetry update
2020

21+
install-asdf:
22+
asdf plugin add python
23+
asdf plugin add poetry
24+
asdf plugin add shellcheck
25+
asdf plugin add nodejs
26+
asdf plugin add actionlint
27+
asdf install
28+
2129
install-python:
2230
poetry install
2331

@@ -52,6 +60,7 @@ check-licenses:
5260

5361
deep-clean-install:
5462
rm -f -d -r .venv/
63+
mkdir .venv/
5564
asdf uninstall poetry
5665
asdf uninstall python
5766
asdf plugin remove poetry

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ These tests will automate End-to-End regression testing for:
66
* [Prescriptions for Patients (PfP)](https://digital.nhs.uk/developer/api-catalogue/prescriptions-for-patients)
77
* [Prescription Status Update (PSU)](https://digital.nhs.uk/developer/api-catalogue/prescription-status-update-fhir/)
88
* [Clinical Prescription Tracker UI (CPT-UI)](https://github.com/NHSDigital/eps-prescription-tracker-ui)
9+
* [Clinical Prescription Tracker API (CPT-API)](https://github.com/NHSDigital/electronic-prescription-service-clinical-prescription-tracker)
910

1011
## General usage
1112
These tests are run automatically during deployment and shouldn't need to be touched unless performing debugging or
@@ -22,12 +23,27 @@ It is necessary to set some Environment variables in order to run any tests in y
2223
1. `.env` file
2324
2. OS environment variable
2425

25-
The following environment variables need to be set for the correct environment you wish to test against:
26-
* CLIENT_ID
27-
* CLIENT_SECRET
26+
The following environment variables may need to be set for the correct environment you wish to test against:
27+
* CPT_FHIR_CLIENT_ID
28+
* CPT_FHIR_CLIENT_SECRET
29+
* EPS_FHIR_CLIENT_ID
30+
* EPS_FHIR_CLIENT_SECRET
31+
* EPS_FHIR_SHA1_CLIENT_ID
32+
* EPS_FHIR_SHA1_CLIENT_SECRET
33+
* EPS_FHIR_PRESCRIBING_CLIENT_ID
34+
* EPS_FHIR_PRESCRIBING_CLIENT_SECRET
35+
* EPS_FHIR_PRESCRIBING_SHA1_CLIENT_ID
36+
* EPS_FHIR_PRESCRIBING_SHA1_CLIENT_SECRET
37+
* EPS_FHIR_DISPENSING_CLIENT_ID
38+
* EPS_FHIR_DISPENSING_CLIENT_SECRET
39+
* PFP_CLIENT_ID
40+
* PFP_CLIENT_SECRET
41+
* PSU_CLIENT_ID
42+
* PSU_CLIENT_SECRET
2843
* PRIVATE_KEY
2944
* CERTIFICATE
3045

46+
3147
To make this easier, a `template.env` file is located on the root. Fill in the values and rename this to `.env`
3248

3349
Any file that begins with `.env` is automatically ignored by Git
@@ -42,15 +58,8 @@ You may need to run `poetry shell` to activate the poetry shell, followed by `ma
4258
If you'd like to use your own machine without containerisation. You will need the following;
4359
* Ubuntu (WSL)
4460
* [ASDF](https://asdf-vm.com/guide/getting-started.html)
45-
#### Once ASDF is installed, add the following plugins:
46-
* ASDF python plugin `asdf plugin add python`
47-
* ASDF poetry plugin `asdf plugin add poetry`
48-
* ASDF shellcheck plugin `asdf plugin add shellcheck`
49-
* ASDF nodejs plugin `asdf plugin add nodejs`
50-
#### Once the plugins are added you can install them
51-
`asdf install` This will install the versions as described in .tool-versions
52-
53-
Now you can run `make install` to install the virtualenv and packages. You may need to run `poetry shell` to activate the poetry shell, followed by `make install-playwright` to install the playwright tools. To check if these are installed properly, run `playwright codegen` and check that you see a browser window pop up.
61+
You can now run the `make install-asdf` command
62+
* next, run `make install` to install the virtualenv and packages. You may need to run `poetry shell` to activate the poetry shell, followed by `make install-playwright` to install the playwright tools. To check if these are installed properly, run `playwright codegen` and check that you see a browser window pop up.
5463

5564
## Developing/Debugging Tests
5665

@@ -101,7 +110,7 @@ Change the `env` variable accordingly to either `INT` or `INTERNAL-DEV`.
101110
If you wish to test a different product i.e. `PFP-APIGEE` then you must change `product=` and `--tags` respectively.
102111

103112
### Method 5:
104-
Run the tests by pushing changes to github in a pull request and running the regression tests job.
113+
Run the tests by pushing changes to GitHub in a pull request and running the regression tests job.
105114
You can do this by the browser or by running this
106115
```
107116
BRANCH=fix_tests_take_2

features/environment.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ def before_scenario(context, scenario):
169169
return
170170
product = context.config.userdata["product"].upper()
171171
if product == "CPTS-UI":
172-
global _playwright
173-
global _page
172+
global _playwright # noqa: F824
173+
global _page # noqa: F824
174174
context.browser = context.browser.new_context()
175175
context.browser.tracing.start(screenshots=True, snapshots=True, sources=True)
176176
context.page = context.browser.new_page()
@@ -194,7 +194,7 @@ def after_scenario(context, scenario):
194194
attachment_type="application/zip",
195195
)
196196
if context.page is not None:
197-
global _page
197+
global _page # noqa: F824
198198
_page.close()
199199

200200

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
@eps_fhir @cancel @regression @blocker @smoke
22
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-3869
3+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4941
34
Feature: I can cancel prescriptions
45

56
@skip-sandbox
67
Scenario Outline: I can cancel a prescription
78
Given I am an authorised prescriber with <App> app
8-
And I successfully prepare and sign a non-nominated prescription
9+
And I successfully prepare and sign a <Nomination> <Type> prescription
910
When I cancel all line items on the prescription
1011
Then the response indicates a success
1112
And the response body indicates a successful cancel action
1213
Examples:
13-
| App |
14-
| EPS-FHIR |
15-
| EPS-FHIR-SHA1 |
14+
| App | Nomination | Type |
15+
| EPS-FHIR | nominated | acute |
16+
| EPS-FHIR | non-nominated | acute |
17+
| EPS-FHIR | nominated | repeat |
18+
| EPS-FHIR | non-nominated | repeat |
19+
| EPS-FHIR-SHA1 | nominated | acute |
20+
| EPS-FHIR-SHA1 | non-nominated | acute |
21+
| EPS-FHIR-SHA1 | nominated | repeat |
22+
| EPS-FHIR-SHA1 | non-nominated | repeat |

features/eps_fhir/create_prescriptions.feature

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,33 @@
33
Feature: I can create prescriptions
44

55
@skip-sandbox
6+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4941
67
Scenario Outline: I can create, sign and release a prescription
78
Given I am an authorised prescriber with <App> app
8-
And I successfully prepare and sign a <Type> prescription
9+
And I successfully prepare and sign a <Nomination> <Type> prescription
910
When I am an authorised dispenser with EPS-FHIR app
1011
And I release the prescription
1112
Then the response indicates a success
1213
And the response body indicates a successful release action
1314
Examples:
14-
| Type | App |
15-
| nominated | EPS-FHIR |
16-
| non-nominated | EPS-FHIR |
17-
| nominated | EPS-FHIR-SHA1 |
18-
| non-nominated | EPS-FHIR-SHA1 |
15+
| App | Nomination | Type |
16+
| EPS-FHIR | nominated | acute |
17+
| EPS-FHIR | non-nominated | acute |
18+
| EPS-FHIR | nominated | repeat |
19+
| EPS-FHIR | non-nominated | repeat |
20+
| EPS-FHIR-SHA1 | nominated | acute |
21+
| EPS-FHIR-SHA1 | non-nominated | acute |
22+
| EPS-FHIR-SHA1 | nominated | repeat |
23+
| EPS-FHIR-SHA1 | non-nominated | repeat |
1924

2025
@skip-sandbox
2126
Scenario: I can create a prescription with sha256
2227
Given I am an authorised prescriber with EPS-FHIR app
23-
And I successfully prepare a nominated prescription
28+
And I successfully prepare a nominated acute prescription
2429
Then the signing algorithm is RS256
2530

2631
@skip-sandbox
2732
Scenario: I can create a prescription with sha1
2833
Given I am an authorised prescriber with EPS-FHIR-SHA1 app
29-
And I successfully prepare a nominated prescription
34+
And I successfully prepare a nominated acute prescription
3035
Then the signing algorithm is RS1

features/eps_fhir/dispense_prescriptions.feature

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22
Feature: I can dispense prescriptions
33

44
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-3865
5-
Scenario: I can dispense a prescription
6-
Given a prescription has been created and released using apim apis
5+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4941
6+
Scenario Outline: I can dispense a prescription
7+
Given a <Nomination> <Type> prescription has been created and released using apim apis
78
When I dispense the prescription
89
Then the response indicates a success
910
And the response body indicates a successful dispense action
11+
Examples:
12+
| Nomination | Type |
13+
| nominated | acute |
14+
| non-nominated | acute |
15+
| nominated | repeat |
16+
| non-nominated | repeat |
1017

1118
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-3868
1219
Scenario: I can amend a single dispense notification
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
@eps_fhir @smoke @regression @blocker @return
22
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-3866
3+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4941
34
Feature: I can return prescriptions
45

5-
Scenario: I can return a prescription
6-
Given a prescription has been created and released using apim apis
6+
Scenario Outline: I can return a prescription
7+
Given a <Nomination> <Type> prescription has been created and released using apim apis
78
When I return the prescription
89
Then the response indicates a success
910
And the response body indicates a successful return action
11+
Examples:
12+
| Nomination | Type |
13+
| nominated | acute |
14+
| non-nominated | acute |
15+
| nominated | repeat |
16+
| non-nominated | repeat |

features/eps_fhir_dispensing/dispense_prescriptions.feature

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33
Feature: I can dispense prescriptions
44

55
@dispense
6-
Scenario: I can dispense a prescription
7-
Given a prescription has been created and released using proxygen apis
6+
@allure.tms:https://nhsd-jira.digital.nhs.uk/browse/AEA-4941
7+
Scenario Outline: I can dispense a prescription
8+
Given a <Nomination> <Type> prescription has been created and released using proxygen apis
89
When I dispense the prescription
910
Then the response indicates a success
1011
And the response body indicates a successful dispense action
12+
Examples:
13+
| Nomination | Type |
14+
| nominated | acute |
15+
| non-nominated | acute |
16+
| nominated | repeat |
17+
| non-nominated | repeat |
1118

1219
@amend
1320
Scenario: I can amend a single dispense notification

0 commit comments

Comments
 (0)