These tests will automate End-to-End regression testing for:
- Electronic Prescription Service (EPS-FHIR)
- Prescriptions for Patients (PfP)
- Prescription Status Update (PSU)
These tests are run automatically during deployment and shouldn't need to be touched unless performing debugging or
adding/removing/changing test cases
If there are any test failures, this will report a failed build
It is necessary to set some Environment variables in order to run any tests in your local environment. The tests will look for environment variables in the following order (For security, the values will not be displayed here):
.env
file- OS environment variable
The following environment variables need to be set for the correct environment you wish to test against:
- CLIENT_ID
- CLIENT_SECRET
- PRIVATE_KEY
- CERTIFICATE
To make this easier, a template.env
file is located on the root. Fill in the values and rename this to .env
Any file that begins with .env
is automatically ignored by Git
This test pack utilises the power of Docker to quickly and easily spin up a dev environment for you to work in
the Dockerfile is located in {project_root}/.devcontainer/Dockerfile
If you'd like to use your own machine without containerisation. You will need the following;
- Ubuntu (WSL)
- ASDF
- ASDF python plugin
asdf plugin add python
- ASDF poetry plugin
asdf plugin add poetry
- ASDF shellcheck plugin
asdf plugin add shellcheck
- ASDF nodejs plugin
asdf plugin add nodejs
asdf install
This will install the versions as described in .tool-versions
Now you can run make install
to install the virtualenv and packages
Run the runner.py
file located in the root of the project
This is the preferred method and allows you to include/exclude tags
a ~
before the tag name excludes it.
This is how the tests are run on the CI
This will run all tests with the tag @smoke
but skip any tests tagged with @slow
If your IDE supports it, you can directly run the .feature files within /features
Make sure that your behave run configuration includes the --product=
& --env=
These are mandatory
Run the tests by calling the Make command make run-tests
. This requires the parameters product=
and env=
to be passed in
- This will run the tests without tags so will run everything
Run the tests by running behave
in a command prompt or terminal window.
- This will run the tests and print the results to console
Example:
behave -D product=EPS-FHIR -D env=INT -f behave_cucumber_formatter:PrettyCucumberJSONFormatter -o reports/cucumber_json.json -f
allure_behave.formatter:AllureFormatter -o allure-results -f pretty features --no-capture --no-capture-stderr --no-skipped --expand --logging-level=DEBUG --tags eps_fhir
Change the env
variable accordingly to either INT
or INTERNAL-DEV
.
If you wish to test a different product i.e. PFP-APIGEE
then you must change product=
and --tags
respectively.
Run the tests by pushing changes to github in a pull request and running the regression tests job. You can do this by the browser or by running this
BRANCH=fix_tests_take_2
gh workflow run regression_tests.yml \
--ref ${BRANCH} \
-f tags=@regression \
-f environment=INTERNAL-DEV \
-f pull_request_id=pr-2877 \
-f github_tag=${BRANCH}
On the root of the project is a file get_token.py
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)
You will need a Client ID and Client Secret set as environment variables
Example:
This tool will allow you to generate a CIS2 authentication token. You can use this token to authenticate with APIs that support this service.
Please ensure the appropriate environment variables are set: CLIENT_ID, CLIENT_SECRET
User (dispenser or practitioner): dispenser
Env (INTERNAL-DEV-SANDBOX, SANDBOX, INT, INTERNAL-QA, INTERNAL-DEV, REF): int
Successfully Authenticated in INT
J6cdtaZa...
Pre commit hooks run checks on your code to ensure quality before being allowed to commit. You can perform this process by running:
make pre-commit
This process will stop after the first program detects an error or if Black modified any files. You may need to run this multiple times to ensure everything is ok before committing.
To generate and view the results of a GitHub test run, first authenticate to GitHub by running this and following instructions
gh auth login
Then download the allure results by noting the GitHub run ID in a browser and running this
GITHUB_RUN_ID=11523235428 make download-allure-report
This pack has recently been updated to include UI-based testing using Playwright for CPTS-UI. It will run headless using the Chrome browser
Playwright contains a handy (but not perfect) feature which will record actions you make and give you the code for them
to begin, run the command:
playwright codegen