Skip to content

Commit c754f30

Browse files
committed
Merge branch 'aea-4506-migrate-qc' of github.com:NHSDigital/electronic-prescription-service-api-regression-tests into aea-4506-migrate-qc
2 parents f56125a + 9048f6e commit c754f30

27 files changed

+460
-41
lines changed

.devcontainer/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ ENV PATH="$PATH:/home/vscode/.asdf/bin/"
2525
RUN asdf plugin add python; \
2626
asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git; \
2727
asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git; \
28-
asdf plugin add nodejs;\
29-
asdf plugin add actionlint;
28+
asdf plugin add nodejs; \
29+
asdf plugin add actionlint; \
30+
asdf plugin add allure
3031

3132
WORKDIR /workspaces/electronic-prescription-service-api-regression-tests
3233
ADD .tool-versions /workspaces/electronic-prescription-service-api-regression-tests/.tool-versions

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"version": "latest",
1919
"moby": "true",
2020
"installDockerBuildx": "true"
21-
}
21+
},
22+
"ghcr.io/devcontainers/features/github-cli:1": {}
2223
},
2324
"customizations": {
2425
"vscode": {

.github/workflows/pr-link.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ jobs:
3737
- name: Comment on PR with link to JIRA ticket
3838
if: contains(github.event.pull_request.head.ref, 'aea-') || contains(github.event.pull_request.head.ref, 'AEA-') || contains(github.event.pull_request.head.ref, 'apm-') || contains(github.event.pull_request.head.ref, 'APM-') || contains(github.event.pull_request.head.ref, 'apmspii-') || contains(github.event.pull_request.head.ref, 'APMSPII-') || contains(github.event.pull_request.head.ref, 'adz-') || contains(github.event.pull_request.head.ref, 'ADZ-') || contains(github.event.pull_request.head.ref, 'amb-') || contains(github.event.pull_request.head.ref, 'AMB-')
3939
continue-on-error: true
40-
uses: unsplash/comment-on-pr@master
40+
uses: unsplash/comment-on-pr@b5610c6125a7197eaec80072ea35ef53e1fc6035
4141
env:
4242
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4343
with:
4444
msg: |
45-
This branch is work on a ticket in an NHS Digital JIRA Project. Here's a handy link to the ticket:
45+
This branch is work on a ticket in an NHS England JIRA Project. Here's a handy link to the ticket:
4646
# [${{ env.TICKET_NAME }}](https://nhsd-jira.digital.nhs.uk/browse/${{ env.TICKET_NAME }})

.github/workflows/regression_tests.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ on:
1717
type: choice
1818
options:
1919
- EPS-FHIR
20+
- EPS-FHIR-PRESCRIBING
21+
- EPS-FHIR-DISPENSING
2022
- PFP-APIGEE
2123
- PFP-AWS
2224
- PSU
@@ -128,13 +130,10 @@ jobs:
128130
owner: "NHSDigital"
129131
repositories: "electronic-prescription-service-api-regression-tests,eps-test-reports"
130132

131-
- name: Send Results
132-
run: |
133-
poetry run python scripts/send_test_results.py --token=${{ steps.generate-token.outputs.token }} --run_id ${{GITHUB.RUN_ID}}
134-
135133
- name: Report failure on test failure
136134
if: steps.tests.outcome != 'success'
137135
run: |
136+
poetry run python scripts/send_test_results.py --token=${{ steps.generate-token.outputs.token }} --run_id ${{GITHUB.RUN_ID}}
138137
echo The regression tests step failed, this likely means there are test failures.
139-
echo The report will be generated shortly
138+
echo A test report will be generated shortly and can be viewed at: https://nhsdigital.github.io/eps-test-reports
140139
exit 1

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ poetry 1.8.3
33
shellcheck 0.10.0
44
nodejs 22.9.0
55
actionlint 1.7.1
6+
allure 2.31.0

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,10 @@ deep-clean-install:
6868

6969
pre-commit:
7070
poetry run pre-commit run --all-files
71+
72+
download-allure-report: guard-GITHUB_RUN_ID
73+
rm -rf allure-report
74+
rm -rf allure-results
75+
gh run download ${GITHUB_RUN_ID}
76+
allure generate
77+
allure open

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,19 @@ allure_behave.formatter:AllureFormatter -o allure-results -f pretty features --n
8181
Change the `env` variable accordingly to either `INT` or `INTERNAL-DEV`.
8282
If you wish to test a different product i.e. `PFP-APIGEE` then you must change `product=` and `--tags` respectively.
8383

84+
### Method 5:
85+
Run the tests by pushing changes to github in a pull request and running the regression tests job.
86+
You can do this by the browser or by running this
87+
```
88+
BRANCH=fix_tests_take_2
89+
gh workflow run regression_tests.yml \
90+
--ref ${BRANCH} \
91+
-f tags=@regression \
92+
-f environment=INTERNAL-DEV \
93+
-f pull_request_id=pr-2877 \
94+
-f github_tag=${BRANCH}
95+
```
96+
8497
### Getting the token to check the endpoint calls on Postman
8598
On the root of the project is a file `get_token.py` <br>
8699
This interactive Python script will assist you in generating a CIS2 authentication token that you can use elsewhere to make API calls (e.g. in Postman)
@@ -99,3 +112,14 @@ Pre commit hooks run checks on your code to ensure quality before being allowed
99112

100113
This process will stop after the first program detects an error or if Black modified any files.
101114
You may need to run this multiple times to ensure everything is ok before committing.
115+
116+
117+
### Generating the allure report from a github test run
118+
To generate and view the results of a github test run, first authenticate to github by running this and following instructions
119+
```
120+
gh auth login
121+
```
122+
Then download the alluere results by noting the github run id in a browser and running this
123+
```
124+
GITHUB_RUN_ID=11523235428 make download-allure-report
125+
```

features/environment.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,23 @@
66
from behave.model import Scenario
77
from dotenv import load_dotenv
88

9+
from methods.api import eps_api_methods
10+
911
load_dotenv(override=True)
1012

1113
INTERNAL_QA_BASE_URL = "https://internal-qa.api.service.nhs.uk/"
1214
INTERNAL_DEV_BASE_URL = "https://internal-dev.api.service.nhs.uk/"
13-
PFP_AWS_PR_URL = "https://pfp-{{aws_pull_request_id}}.dev.eps.national.nhs.uk/"
14-
PFP_AWS_SANDBOX_PR_URL = (
15-
"https://pfp-{{aws_pull_request_id}}-sandbox.dev.eps.national.nhs.uk/"
16-
)
1715
INT_BASE_URL = "https://int.api.service.nhs.uk/"
1816
SANDBOX_DEV_BASE_URL = "https://internal-dev-sandbox.api.service.nhs.uk/"
1917
SANDBOX_INT_BASE_URL = "https://sandbox.api.service.nhs.uk/"
2018
REF_BASE_URL = "https://ref.api.service.nhs.uk/"
2119

20+
PFP_AWS_PR_URL = "https://pfp-{{aws_pull_request_id}}.dev.eps.national.nhs.uk/"
21+
PFP_AWS_SANDBOX_PR_URL = (
22+
"https://pfp-{{aws_pull_request_id}}-sandbox.dev.eps.national.nhs.uk/"
23+
)
24+
25+
2226
ENVS = {
2327
"INTERNAL-DEV": INTERNAL_DEV_BASE_URL,
2428
"INTERNAL-QA": INTERNAL_QA_BASE_URL,
@@ -36,6 +40,7 @@
3640

3741
REPOS = {
3842
"EPS-FHIR": "https://github.com/NHSDigital/electronic-prescription-service-api",
43+
# TODO Add EPS Dispensing and Prescribing repo URLs
3944
"PFP-APIGEE": "https://github.com/NHSDigital/prescriptions-for-patients",
4045
"PFP-AWS": "https://github.com/NHSDigital/prescriptionsforpatients",
4146
"PSU": "https://github.com/NHSDigital/eps-prescription-status-update-api",
@@ -50,6 +55,8 @@
5055
JWT_KID = os.getenv("JWT_KID")
5156

5257
EPS_FHIR_SUFFIX = "electronic-prescriptions"
58+
EPS_FHIR_PRESCRIBING_SUFFIX = "fhir-prescribing"
59+
EPS_FHIR_DISPENSING_SUFFIX = "fhir-dispensing"
5360
PFP_SUFFIX = "prescriptions-for-patients"
5461
PSU_SUFFIX = "prescription-status-update"
5562

@@ -73,6 +80,12 @@ def before_all(context):
7380
env = context.config.userdata["env"].upper()
7481
product = context.config.userdata["product"].upper()
7582
context.eps_fhir_base_url = os.path.join(select_base_url(env), EPS_FHIR_SUFFIX)
83+
context.eps_fhir_prescribing_base_url = os.path.join(
84+
select_base_url(env), EPS_FHIR_PRESCRIBING_SUFFIX
85+
)
86+
context.eps_fhir_dispensing_base_url = os.path.join(
87+
select_base_url(env), EPS_FHIR_DISPENSING_SUFFIX
88+
)
7689
context.pfp_base_url = os.path.join(select_base_url(env), PFP_SUFFIX)
7790
context.psu_base_url = os.path.join(select_base_url(env), PSU_SUFFIX)
7891
if PULL_REQUEST_ID:
@@ -81,7 +94,10 @@ def before_all(context):
8194
get_url_with_pr(context, env, product)
8295
else:
8396
raise RuntimeError("no tests to run. Check your tags and try again")
97+
eps_api_methods.calculate_eps_fhir_base_url(context)
8498
print("EPS: ", context.eps_fhir_base_url)
99+
print("EPS-PRESCRIBING: ", context.eps_fhir_prescribing_base_url)
100+
print("EPS-DISPENSING: ", context.eps_fhir_dispensing_base_url)
85101
print("PFP: ", context.pfp_base_url)
86102
print("PSU: ", context.psu_base_url)
87103

@@ -92,6 +108,14 @@ def get_url_with_pr(context, env, product):
92108
context.eps_fhir_base_url = os.path.join(
93109
INTERNAL_DEV_BASE_URL, f"{EPS_FHIR_SUFFIX}-{PULL_REQUEST_ID}"
94110
)
111+
if product == "EPS-FHIR-PRESCRIBING":
112+
context.eps_fhir_prescribing_base_url = os.path.join(
113+
INTERNAL_DEV_BASE_URL, f"{EPS_FHIR_PRESCRIBING_SUFFIX}-{PULL_REQUEST_ID}"
114+
)
115+
if product == "EPS-FHIR-DISPENSING":
116+
context.eps_fhir_dispensing_base_url = os.path.join(
117+
INTERNAL_DEV_BASE_URL, f"{EPS_FHIR_DISPENSING_SUFFIX}-{PULL_REQUEST_ID}"
118+
)
95119
if product == "PFP-APIGEE":
96120
context.pfp_base_url = os.path.join(
97121
INTERNAL_DEV_BASE_URL, f"{PFP_SUFFIX}-{PULL_REQUEST_ID}"
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)