Skip to content

Commit 29290b2

Browse files
authored
Merge pull request #811 from NHSDigital/update-readme
Update README
2 parents 35a4208 + 97dfb6f commit 29290b2

File tree

3 files changed

+36
-24
lines changed

3 files changed

+36
-24
lines changed

.env.generic

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ BASIC_AUTH_USERNAME=
77
BASIC_AUTH_PASSWORD=
88
BASIC_AUTH_TOKEN=
99

10-
# set true to set the feature flags in the flipper page
10+
# all of the IMMS_* values need to be set to run imms api tests
11+
IMMS_BASE_URL=https://int.api.service.nhs.uk/
12+
IMMS_API_PEM=
13+
IMMS_API_KEY=
14+
IMMS_API_KID=
15+
16+
# set true to set feature flags in the flipper page
1117
# basic_auth, api and dev_tools will be set by default
18+
# additional feature flags can be provided as a comma separated list
1219
SET_FEATURE_FLAGS=false
1320
ADDITIONAL_FEATURE_FLAGS=
1421

1522
SCREENSHOT_ALL_STEPS=false
16-
17-
IMMS_API_PEM=
18-
IMMS_API_KEY=
19-
IMMS_API_KID=
20-
21-
IMMS_BASE_URL=https://int.api.service.nhs.uk/

README.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ There are two ways to run commands with `uv`
5757
$ pytest
5858
```
5959

60-
### CLI arguments
60+
### Playwright CLI arguments
6161

6262
Playwright offers many [CLI arguments] which can be used when running tests. Some useful ones are highlighted here:
6363

@@ -81,35 +81,38 @@ run the tests in headed mode, use the following command:
8181
```shell
8282
$ pytest --headed
8383
```
84+
#### Tracing
8485

85-
#### Slow motion
86-
87-
When running the tests locally in headed mode, it can be useful to make the
88-
steps artificially slower to see what's happening at each point. To introduce
89-
a 1-second delay, use the following command:
86+
There's an option available to run tests with tracing, allowing the test to be
87+
replayed in the Trace Viewer.
9088
9189
```shell
92-
$ pytest --slowmo 1000
90+
$ pytest --tracing on
91+
$ playwright show-trace test-results/.../trace.zip
9392
```
93+
### Pytest CLI arguments
94+
95+
Pytest also has some useful CLI arguments
9496
9597
#### Markers
9698
97-
Tests for individual endpoints can be executed using individual markers. For example:
99+
Some tests are grouped using markers. You can include/exclude groups with the `-m` flag:
98100
99101
```shell
100102
$ pytest -m log_in
103+
$ pytest -m "not imms_api and not accessibility"
101104
```
105+
#### Parallel test execution
102106
103-
#### Tracing
104-
105-
There's an option available to run tests with tracing, allowing the test to be
106-
replayed in the Trace Viewer.
107+
This repository uses [pytest-xdist] to run test modules in parallel. The number of available workers is equal to the number of CPUs that your system has. By default, when running tests locally, all available workers will be used when running multiple test modules. This behaviour can be configured with the `-n` flag.
107108
108109
```shell
109-
$ pytest --tracing on
110-
$ playwright show-trace test-results/.../trace.zip
110+
$ pytest -n 4 # only use 4 workers
111+
$ pytest -n 0 # disable pytest-xdist
111112
```
112113
114+
[pytest-xdist]:https://github.com/pytest-dev/pytest-xdist
115+
113116
### Reporting
114117
115118
While the tests are running, results are stored in `allure-results` which can
@@ -123,18 +126,25 @@ $ npx allure-commandline open
123126
124127
### Linting and formatting
125128
126-
Ruff is used as a linting and formatting tool in this repo:
129+
[Ruff] is used as a linting and formatting tool in this repo:
127130
128131
```shell
129132
$ ruff format
130133
$ ruff check --fix
131134
```
132135
136+
[Ruff]:https://github.com/astral-sh/ruff
137+
138+
### Playwright Page Object Model
139+
140+
The Playwright [Page Object Model] (or POM) approach is taken when developing this repository. Each page/wizard in Mavis should have its own Page object, storing all appropriate locators and methods. When multiple pages use the same locators/methods, a component should be created that extracts these. Then page objects can access this functionality via the component. See `mavis/test/pages/header_component.py` and its usages for an example.
141+
142+
[Page Object Model]:https://playwright.dev/docs/pom
143+
133144
### More information
134145
135146
Further details on the scope and approach of the automation are on the [NHSD Confluence page](https://nhsd-confluence.digital.nhs.uk/pages/viewpage.action?spaceKey=Vacc&title=Mavis+Test+Automation).
136147
137-
138148
## Performance tests
139149
140150
### Installation

mavis/test/pages/programmes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
from playwright.sync_api import Page
66

77
from mavis.test.annotations import step
8-
from mavis.test.constants import Child, DeliverySite, Programme, ReportFormat
8+
from mavis.test.constants import DeliverySite, Programme, ReportFormat
9+
from mavis.test.data_models import Child
910
from mavis.test.pages.header_component import HeaderComponent
1011
from mavis.test.utils import get_current_datetime_compact
1112

0 commit comments

Comments
 (0)