Skip to content

Commit d074e83

Browse files
AC - updated readme
1 parent 0679433 commit d074e83

File tree

6 files changed

+43
-125
lines changed

6 files changed

+43
-125
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ include scripts/init.mk
77

88
# Example CI/CD targets are: dependencies, build, publish, deploy, clean, etc.
99

10-
test: # run tests in a local podman container
10+
test:
11+
./run_tests.sh
12+
13+
podman-test: # run tests in a local podman container
1114
if podman inspect -f '{{.Name}}' playwright > /dev/null; then
1215
podman rm playwright --force
1316
fi

README.md

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,67 +21,63 @@ NOTE: This project is currently under initial development so isn't finalised, bu
2121

2222
## Setup
2323

24-
You can clone this whole repository using the code below:
25-
26-
```shell
27-
git clone https://github.com/nhs-england-tools/playwright-python-blueprint.git
28-
```
24+
You can clone this whole repository by clicking on the green `Code` button at near the top of the screen, then select either ssh or https, depending on if you have your ssh key setup
2925

3026
### Prerequisites
3127

32-
To utilise the blueprint code, you will need to have the following installed:
28+
#### Python3
3329

34-
- [Python](https://www.python.org/downloads/) 3.12 or greater
30+
To utilise the test for the BCSS app you will first of all require python3. The installation method changes based on operating systems but can usually be installed from a software store.
3531

36-
Whilst not required to get started, you may also want to [configure a Python virtual environment for your project](https://docs.python.org/3/library/venv.html) before proceeding with
37-
the configuration. If you are using an IDE such as Visual Studio Code or PyCharm, you will normally be prompted to do this automatically.
32+
#### Virtual Environment
3833

39-
### Configuration
34+
To avoid conflicts with the rest of the operating system it is reccomended to create a python virtual environment, this isolates any packages installed and makes your life easier. To do that run the following command:
4035

41-
There is a makefile which has common commands to interface with the repository, to check if the tests are working you can run the command `make test`
36+
`python -m venv .venv`
4237

43-
The first time you run this it will create a container using buildah and podman, it will then install the prerequisites onto it and copy over the code before executing `pytest` to run all the tests. This is the reccomended way to run the tests
38+
This will create a bunch of files under a directory called `.venv` if you are using Visual Studios Code then it should automatically detect this environment and use it, but you may need to restart VSCode to pick up this new virtual environment
4439

45-
If you prefer to run the tests locally you can do so by first assuming the python virtual environment, vscode should pick it up automatically in the `venv` directory but if you are using the terminal on linux or mac you can run `source venv/bin/activate` If you are using windows it may work the same for you or you may need to lookup how to assume a python virtual environment.
40+
#### Python Packages
4641

47-
Once that is done you can run the following commands to install the prerequisites:
42+
There are a bunch of packages that are required to run the tests in this repository, they have been tracked in the `requirements.txt` file. To install them run this command:
4843

4944
```bash
5045
pip install -r requirements.txt
51-
playwright install --with-deps
5246
```
5347

54-
> **Note** I found that trying to run this on fedora let to some errors, only Ubuntu seems to be supported which is why I have setup a container using ubuntu to support other environments
48+
This will then install all of the dependancies.
5549

56-
This will install all the necessary packages for executing Playwright tests, and install Playwright ready for use by the framework. You can test the configuration
57-
has worked by running our example tests, which can be done using the following command (this will run all tests with tracing reports turned on, and in headed mode
58-
so you can see the browser execution):
50+
#### Playwright
5951

60-
```shell
61-
pytest --tracing on --headed
52+
Once all the pre-requisites have been installed then you can install playwright with the following command:
53+
54+
```bash
55+
playwright install --with-deps
6256
```
6357

58+
This will take a while and will install playwright and its browsers which allow it to run the tests.
59+
60+
### Configuration
61+
62+
There is a makefile which has common commands to interface with the repository, to check if the tests are working you can run the command `make test`
63+
64+
There is also a dockerised version which will create a container using podman and run it there, if you dont have a compatible OS or you dont want to install the dependancies directly, however you will need to install podman and podman-build, you can run that with `podman-test`
65+
6466
## Getting Started
6567

6668
> NOTE: This section is currently under development and requires further work, so links to pages within this repository may not be very useful at this stage.
6769
6870
Once you've confirmed your installation is working, please take a look at the following guides on getting started with Playwright Python.
6971

70-
1. [Understanding Playwright Python](./docs/getting-started/1_Understanding_Playwright_Python.md)
71-
2. [Blueprint File Breakdown](./docs/getting-started/2_Blueprint_File_Breakdown.md)
72-
73-
We've also created a [Quick Reference Guide](./docs/getting-started/Quick_Reference_Guide.md) for common commands and actions you may regularly perform using this blueprint.
74-
75-
For additional reading and guidance on writing tests, we also recommend reviewing the [Playwright Python documentation](https://playwright.dev/python/docs/writing-tests).
72+
- [Quick Reference Guide](./docs/getting-started/Quick_Reference_Guide.md) for common commands and actions you may regularly perform using this blueprint.
73+
- [Playwright Python documentation](https://playwright.dev/python/docs/writing-tests) guidance on writing tests.
7674

7775
## Contacts
7876

79-
If you have any queries regarding this blueprint, please contact [[email protected]](mailto:[email protected]).
77+
If you have any queries regarding these tests, please contact [[email protected]](mailto:[email protected]). or [[email protected]](mailto:[email protected])
8078

8179
## Licence
8280

83-
> The [LICENCE.md](./LICENCE.md) file will need to be updated with the correct year and owner
84-
8581
Unless stated otherwise, the codebase is released under the MIT License. This covers both the codebase and any sample code in the documentation.
8682

8783
Any HTML or Markdown documentation is [© Crown Copyright](https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/) and available under the terms of the [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/).

pages/bcss_home_page.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,6 @@ def click_help_link(self):
5353

5454
def click_screening_pracitioners_appointments(self):
5555
self.screening_pracitioners_appointments.click()
56+
57+
def click_logout(self):
58+
self.log_out.click()

pages/screening_practitioner_appointments.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ def __init__(self, page: Page):
2828
"link", name="Patients that Require Colonoscopy Assessment Appointments"
2929
)
3030
)
31-
self.patients_that_require_colonoscopy_assessment_appointments_bowl_scope = (
32-
self.page.get_by_role(
33-
"link",
34-
name="Bowel Scope",
35-
)
31+
self.patients_that_require_colonoscopy_assessment_appointments_bowl_scope = self.page.get_by_role(
32+
"link",
33+
name="Patients that Require Colonoscopy Assessment Appointments - Bowel Scope",
3634
)
3735
self.patients_that_require_surveillance_appointments = self.page.get_by_role(
3836
"link", name="Patients that Require Surveillance Appointments"

tests/test_homepage_links.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,10 @@ def test_homepage_user_guide(page: Page) -> None:
8080
user_guide = popup_info.value
8181
# user_guide.screenshot(path="test-results/help_screen.png")
8282
expect(user_guide.get_by_text("Bowel Cancer Screening System"))
83+
84+
85+
def test_logout(page: Page) -> None:
86+
homepage = BcssHomePage(page)
87+
homepage.click_logout()
88+
page.screenshot(path="test-results/logout_screen.png")
89+
expect(page.get_by_role("link", name="Log in"))

tests/test_screening_practitioner_appointments.py

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -55,92 +55,3 @@ def test_patients_that_require_colonoscopy_assessment_appointments(page: Page) -
5555
table_locator = page.locator("table#booking tbody tr")
5656
child_count = table_locator.count()
5757
assert child_count > 0
58-
59-
60-
# def test_patients_that_require_colonoscopy_assessment_appointments_bowel_scope(
61-
# page: Page,
62-
# ) -> None:
63-
# get_to_screen(page)
64-
# # homepage = BcssHomePage(page)
65-
# screening_pracitioners_appointments = ScreeningPractitionerAppointments(page)
66-
# # homepage.click_screening_pracitioners_appointments()
67-
# # expect(page.get_by_role("link", name="View appointments")).to_be_visible()
68-
# screening_pracitioners_appointments.click_patients_that_require_colonoscopy_assessment_appointments_bowl_scope()
69-
# expect(
70-
# page.get_by_text(
71-
# "Patients that Require Colonoscopy Assessment Appointment Booking"
72-
# )
73-
# ).to_be_visible()
74-
# # table_locator = page.locator("table#displayInputParameters tbody tr")
75-
# # child_count = table_locator.count()
76-
# # assert child_count > 0
77-
78-
79-
# def test_patients_that_require_surveillance_appointments(
80-
# page: Page,
81-
# ) -> None:
82-
# get_to_screen(page)
83-
# screening_pracitioners_appointments = ScreeningPractitionerAppointments(page)
84-
# screening_pracitioners_appointments.click_patients_that_require_surveillance_appointments()
85-
# expect(
86-
# page.get_by_text("Patients that Require Surveillance Appointments")
87-
# ).to_be_visible()
88-
# table_locator = page.locator("table#displayInputParameters tbody tr")
89-
# child_count = table_locator.count()
90-
# assert child_count > 0
91-
92-
93-
# def test_view_appointments(page: Page) -> None:
94-
# homepage = BcssHomePage(page)
95-
96-
# # Check the show and hide sub menu works
97-
# homepage.click_sub_menu_link()
98-
# expect(page.get_by_role("link", name="Organisation Parameters")).to_be_visible()
99-
# homepage.click_hide_sub_menu_link()
100-
# expect(page.get_by_role("cell", name="Alerts", exact=True)).to_be_visible()
101-
102-
# def test_homepage_select_org(page: Page) -> None:
103-
# homepage = BcssHomePage(page)
104-
105-
# # check the select org link works and then go back to homepage
106-
# homepage.click_select_org_link()
107-
# expect(page.locator("form")).to_contain_text("Choose an Organisation")
108-
# homepage.click_back_button()
109-
# expect(page.get_by_role("cell", name="Alerts", exact=True)).to_be_visible()
110-
111-
# def test_homepage_release_notes(page: Page) -> None:
112-
# homepage = BcssHomePage(page)
113-
114-
# # Click release notes link
115-
# homepage.click_release_notes_link()
116-
# expect(page.locator("#page-title")).to_contain_text("Release Notes")
117-
118-
# def test_homepage_help(page: Page) -> None:
119-
# homepage = BcssHomePage(page)
120-
121-
# # check the help link works
122-
# with page.expect_popup() as popup_info:
123-
# homepage.click_help_link()
124-
# help_page = popup_info.value
125-
# expect(help_page.get_by_text("Bowel Cancer Screening System Help")).to_be_visible
126-
127-
128-
# <input type="button" id="BTN_VIEW_LIST"
129-
# value="View appointments on this day"
130-
# onclick="inhibitOnXXXXXFunctionFor2MonthCalendar = false;
131-
# return doSubmit();">
132-
133-
134-
# def test_homepage_select_org(page: Page) -> None:
135-
# homepage = BcssHomePage(page)
136-
137-
# # check the select org link works
138-
# homepage.click_select_org_link()
139-
# expect(page.locator("form[action*='/changeorg']")).to_contain_text("Choose an Organisation")
140-
# # Check there is at least one entry in the organisation list
141-
# table_locator = page.locator("table#organisations tr")
142-
# row_count = table_locator.count()
143-
# assert row_count > 0
144-
# # Go back to the home page and make sure it loaded
145-
# homepage.click_back_button()
146-
# expect(page.get_by_role("cell", name="Alerts", exact=True)).to_be_visible()

0 commit comments

Comments
 (0)