Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
85c3b48
Remove Example Tests CI Check (#4)
davethepunkyone Mar 18, 2025
ef3931d
Merge branch 'nhs-england-tools:main' into main
davethepunkyone Mar 18, 2025
25057fe
Merge branch 'nhs-england-tools:main' into main
davethepunkyone Mar 20, 2025
c16bc4e
Bump jinja2 in /scripts/docker/examples/python/assets/hello_world (#3)
dependabot[bot] Mar 20, 2025
7d0b923
Merge branch 'nhs-england-tools:main' into main
davethepunkyone Mar 20, 2025
9cdc583
Feature/migrate tests and utils from blueprint 1 (#5)
Andyg79 Mar 20, 2025
9311a0b
BCSS-20020: Compartment 1 Smokescreen Tests (#7)
Andyg79 Apr 7, 2025
0c03c0a
Feature/BCSS-20069 Rebase with Blueprint (#9)
davethepunkyone Apr 7, 2025
a040eb5
Formatting code using the Black Formatter extension in VSCode (#10)
adrianoaru-nhs Apr 7, 2025
b6c7c99
Feature/bcss 19935 refactor playwright project folder structure (#11)
adrianoaru-nhs Apr 7, 2025
5626da5
Feature/bcss 20062 compartment 3 (#12)
adrianoaru-nhs Apr 8, 2025
3900e96
Improve the reliability of a successful compartment 2 run (#13)
adrianoaru-nhs Apr 8, 2025
ef4d6ba
Updated the test and user.json-bcss 19933 (#14)
mepr1 Apr 8, 2025
bd1e98d
Making test_properties into its own util: BCSS-20024 (#15)
adrianoaru-nhs Apr 9, 2025
f1ca66b
Feature/bcss 20021 creating a new calendar picker util (#17)
adrianoaru-nhs Apr 10, 2025
b9e4bcb
Feature/bcss 20023–write an if statement for page title contains text…
victor-soares-ibm Apr 10, 2025
aaba148
Moving hard coded values from tests into the properties file (#20)
adrianoaru-nhs Apr 15, 2025
4f82c28
Refactoring reports_page and test_reports_page (2nd Attempt) (#19)
Andyg79 Apr 15, 2025
2970c30
Feature/bcss 20228 compartment 4 codegen (#22)
adrianoaru-nhs Apr 16, 2025
a9fc727
Feature/bcss 20022 add a table utility (#23)
mepr1 Apr 16, 2025
a028215
Updated DateTimeUtils to allow for bcss displaying timestamps in UTC …
Andyg79 Apr 16, 2025
ec77a67
Feature/bcss 20261 fix failing tests (#25)
Andyg79 Apr 24, 2025
89c63b2
Added vpn_required mark to ptest.ini (#26)
Andyg79 Apr 24, 2025
fb8264a
Further updates to POMs and methods for compartment 4 (#27)
victor-soares-ibm Apr 24, 2025
16c3438
BCSS-20316: Amend Workflows (#28)
davethepunkyone Apr 24, 2025
0a2f6d5
Feature/bcss 20230 compartment 4 utils (#29)
adrianoaru-nhs Apr 28, 2025
870ac35
Feature/bcss 19549 playwright compartment5 codegen (#30)
adrianoaru-nhs Apr 29, 2025
72e2b85
BCSS-20351: Test Runner Workflow (POC) (#31)
davethepunkyone Apr 29, 2025
ff94477
BCSS-20351: POC Test Runner Part 2 (#33)
davethepunkyone Apr 29, 2025
e3ab573
Adding POMs for Subject Screening Summary page (#32)
adrianoaru-nhs Apr 29, 2025
011f408
Feature/bcss 20326 compartment5 pom for screening practitioner day vi…
mepr1 Apr 29, 2025
c38edc6
Adding POMs for advance FOBT screening episode page (#34)
adrianoaru-nhs Apr 30, 2025
c51c018
Added POM for appointment detail page (#36)
adrianoaru-nhs Apr 30, 2025
9b38f44
Feature/bcss 20360 compartment 5 pom appointment detail page (#37)
adrianoaru-nhs Apr 30, 2025
98c6bf0
Added POM for appointment calendar page (#38)
adrianoaru-nhs Apr 30, 2025
abef415
Added POM for Subject Datasets and updated Compartment 5 tests accord…
Andyg79 May 1, 2025
628e560
BCSS-20351: Test Runner POC Amendments (#43)
davethepunkyone May 1, 2025
8f6c7e3
Added pom for Attend Diagnostic test (#40)
mepr1 May 1, 2025
c1d41de
Refactoring Batch Processing to allow obtaining subjects from PDF Fil…
adrianoaru-nhs May 1, 2025
acd42e4
Added pom for colonoscopy dataset (#44)
Andyg79 May 1, 2025
ffae33e
https://nhsd-jira.digital.nhs.uk/browse/BCSS-20365 - BCSS - Playwrig…
vidhya-chandra1 May 2, 2025
ed0bf2c
Added docstrings and renamed POM files and Classes to include 'Page' …
Andyg79 May 2, 2025
98e88de
BCSS-20400: Contribution Guidance (#45)
davethepunkyone May 6, 2025
0af1a97
Feature/bcss 20436 calendar picker util markdown doc and docstrings (…
adrianoaru-nhs May 7, 2025
be356ac
Feature/bcss 20327 compartment 5 utils (#46)
adrianoaru-nhs May 7, 2025
9458668
Merge remote-tracking branch 'upstream/main' into feature/BCSS-20460
davethepunkyone May 7, 2025
3b6ff88
Merge remote-tracking branch 'upstream/main' into feature/BCSS-20460
davethepunkyone May 7, 2025
414cb57
BCSS-20460: Rebase with playwright-python-blueprint (#50)
davethepunkyone May 7, 2025
367184e
Adding Oracle markdown doc and docstrings and fixing spelling (#49)
adrianoaru-nhs May 7, 2025
52f204b
Moving generic pytest fixtures to conftest (#52)
adrianoaru-nhs May 7, 2025
afb0e23
Adding markdown document and docstrings for Load Properties Util (#53)
adrianoaru-nhs May 8, 2025
f05e5a4
Feature/bcss 20441 tableutil markdown doc and doc strings (#51)
mepr1 May 8, 2025
8044806
Feature/bcss 20437 fit kit gen util markdown and docstring (#54)
Andyg79 May 8, 2025
3a3586f
Added logic to check and correct for duplicate records. (#55)
adrianoaru-nhs May 8, 2025
7a7e169
Compartment 6 codegen code (#56)
adrianoaru-nhs May 9, 2025
68c68d1
Feature/bcss 20438 fit kit logged docstrings and md (#57)
Andyg79 May 9, 2025
b11ecfa
BCSS - 20470 - playwright - refactor fit-kit utilities (#58)
vidhya-chandra1 May 12, 2025
9439b8f
Fixing the calendar util to select the correct day. (#61)
adrianoaru-nhs May 13, 2025
3cebb32
Feature/bcss 20479 compartment 6 pom investigation dataset page (#60)
adrianoaru-nhs May 13, 2025
bf6b575
Batch Processing Util Rework (#62)
adrianoaru-nhs May 13, 2025
6742386
Feature/bcss 20443 compartment 6 pom record diagnosis date (#63)
adrianoaru-nhs May 13, 2025
62ddfc5
Feature/bcss 20476 c6 pom advance fobt screening episode (#59)
mepr1 May 13, 2025
f87a688
Feature/bcss 20440 playwright utils markdown screening subject page s…
victor-soares-ibm May 14, 2025
98f135f
Feature/bcss 20478 c6 pom handover into symptomatic care page (#65)
vidhya-chandra1 May 14, 2025
f17510c
Fixed failing test (#66)
adrianoaru-nhs May 14, 2025
0af35f1
Merge branch 'nhs-england-tools:main' into main
davethepunkyone May 14, 2025
7f5f78a
Feature/bcss 20477 c6 pom diagnostic test outcome page (#67)
mepr1 May 14, 2025
4062f22
Docstring is newly added for POM - ContactWithPatientPage. (#68)
vidhya-chandra1 May 15, 2025
71d791a
Subject Demographic Util (#69)
adrianoaru-nhs May 15, 2025
276d1bf
Feature/bcss 20537 c6 pom subject datasets page (#70)
mepr1 May 15, 2025
074b567
Feature/bcss 20517 dynamic css locators (#71)
adrianoaru-nhs May 15, 2025
aac631e
Feature/bcss 20540 refactor main menu click (#72)
adrianoaru-nhs May 16, 2025
795a4db
Fixed all pytest warnings at the end of a test run (#73)
adrianoaru-nhs May 16, 2025
ea3bc92
BCSS - Playwright - Compartment 6 - Utils - Oracle Specific Functions…
victor-soares-ibm May 16, 2025
053efec
Feature/bcss 20521 c6 investigation dataset navigation util (#75)
Andyg79 May 19, 2025
c65617f
Fixing type checker errors (#76)
adrianoaru-nhs May 19, 2025
95a942d
BCSS-20562 - BCSS - Playwright - Review pytest markers (#77)
vidhya-chandra1 May 22, 2025
01bd025
Feature/bcss 20550 c6 logging (#78)
mepr1 May 23, 2025
0d689cd
Feature/bcss 20549–remove redundant page title verification methods f…
victor-soares-ibm May 27, 2025
a32218a
Feature/bcss 20633 subject demographics util updates (#80)
adrianoaru-nhs May 27, 2025
8cf9f20
Feature/bcss 20623 batch processing markdown improvements (#82)
mepr1 May 27, 2025
9b60997
Feature/bcss 20632 screening subject page searcher markdown updates (…
adrianoaru-nhs May 27, 2025
bfa4ed7
Updating markdown doc to address feedback comments (#84)
adrianoaru-nhs May 28, 2025
1980343
PDF Reader Markdown Doc Updates (#85)
adrianoaru-nhs May 28, 2025
794cc2c
BCSS-20629 - BCSS – Playwright - NHS Number Tools Markdown Improvemen…
vidhya-chandra1 May 28, 2025
ca445db
Feature/bcss 20627 investigation dataset markdown updates (#86)
adrianoaru-nhs May 28, 2025
64fecfe
Feature/bcss 20625 datetimeutils markdown updates (#88)
adrianoaru-nhs May 28, 2025
3da25d0
Feature/bcss 20624 calendar picker markdown updates (#87)
adrianoaru-nhs May 29, 2025
9fd9aba
Addressing feedback comments from reviews (#90)
adrianoaru-nhs May 29, 2025
cc54a4c
BCSS – Playwright - Load Properties Markdown Improvements (#89)
vidhya-chandra1 May 29, 2025
106c205
Feature/bcss 20626 fit kit markdown updates (#91)
adrianoaru-nhs May 30, 2025
00f6101
Feature/bcss 20622 oracle markdown improvements (#92)
mepr1 Jun 2, 2025
6d0a049
Merge branch 'nhs-england-tools:main' into main
davethepunkyone Jun 3, 2025
9f7531f
Feature/bcss 20580 selenium to playwright call and recall (create a p…
Andyg79 Jun 10, 2025
e41fb01
Selenium to Playwright non invitation days (#94)
Andyg79 Jun 11, 2025
4e12559
Feature/bcss 20580 selenium to playwright generate fobt invitations (…
Andyg79 Jun 12, 2025
7842110
Code Refactoring is Implemented for JIRA Ticket - https://nhsd-jira.d…
vidhya-chandra1 Jun 19, 2025
c09aa26
Feature/bcss 20679 selenium to playwright subject selection query bui…
adrianoaru-nhs Jun 26, 2025
6dcdfef
Feature/bcss 20600 selenium to playwright regression subject demograp…
adrianoaru-nhs Jun 30, 2025
d29325e
Feature/bcss 20593 regression tests user (#98)
vidhya-chandra1 Jul 3, 2025
eeafd72
Feature/bcss 20605 regression tests subject notes (#100)
mepr1 Jul 4, 2025
7a03be8
Merge remote-tracking branch 'upstream/main' into feature/BCSS-20899
davethepunkyone Jul 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# DO NOT COMMIT THIS FILE

BCSS_PASS=
31 changes: 18 additions & 13 deletions .github/actions/run-playwright-tests/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
name: "Run Util & Example Tests"
name: "Run Playwright Tests"
runs-on: ubuntu-latest
timeout-minutes: 3
timeout-minutes: 10

inputs:
bcss_cloud_environment:
description: "The environment to run against in lower case (e.g. bcss-1234)"
required: true
type: string
marker_to_use:
description: "The test marker to use when running tests (e.g. smoke)"
required: true
type: string

runs:
using: "composite"
steps:
Expand All @@ -16,18 +27,12 @@ runs:
- name: Ensure browsers are installed
shell: bash
run: python -m playwright install --with-deps
- name: Run util tests
- name: Run specified tests
shell: bash
run: pytest -m "utils" --ignore=tests/
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: result-output-utils
path: test-results/
retention-days: 3
- name: Run example tests
shell: bash
run: pytest --ignore=tests_utils/
run: |
URL_TO_USE="${URL_TO_USE_DEFAULT//<REPLACE>/${{ inputs.bcss_cloud_environment }}}"
ORACLE_DB="${ORACLE_DB_DEFAULT//<REPLACE>/${{ inputs.bcss_cloud_environment }}}"
pytest -m ${{ inputs.marker_to_use }} --base-url=https://$URL_TO_USE --ignore=tests_utils/
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
Expand Down
25 changes: 25 additions & 0 deletions .github/actions/run-util-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Run Util Tests"
runs-on: ubuntu-latest
timeout-minutes: 3
runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run util tests
shell: bash
run: pytest -m "utils" --ignore=tests/
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: result-output-utils
path: test-results/
retention-days: 3

40 changes: 40 additions & 0 deletions .github/workflows/execute-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "Test Runner"

# This workflow is triggered manually and allows the user to specify the environment and test marker to run.
# It is functional, however will not work against BCSS test environments until we configure some self-hosted
# GitHub runners, as the GitHub-hosted runners are based outside of the UK so get blocked by the WAF on the
# environments.

on:
workflow_dispatch:
inputs:
bcss_cloud_environment:
description: "The environment to run against in lower case (e.g. bcss-1234)"
required: true
type: string
default: "bcss-18680"
marker_to_use:
description: "The test marker to use when running tests (e.g. smokescreen)"
required: true
type: string

jobs:
run-tests:
name: "Run Specified Tests"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@v4
- name: "Run Tests"
id: run-tests
uses: ./.github/actions/run-playwright-tests
with:
bcss_cloud_environment: "${{ inputs.bcss_cloud_environment }}"
marker_to_use: "${{ inputs.marker_to_use }}"
env:
BCSS_PASS: ${{ secrets.BCSS_PASS }}
ORACLE_DB_DEFAULT: ${{ secrets.ORACLE_DB }}
ORACLE_USERNAME: ${{ secrets.ORACLE_USERNAME }}
ORACLE_PASS: ${{ secrets.ORACLE_PASS }}
URL_TO_USE_DEFAULT: ${{ vars.CLOUD_ENV_URL }}
6 changes: 3 additions & 3 deletions .github/workflows/stage-2-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ on:

jobs:
run-tests:
name: "Run Util & Example Tests"
name: "Run Util Tests"
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- name: "Checkout code"
uses: actions/checkout@v4
- name: "Run Playwright Tests"
uses: ./.github/actions/run-playwright-tests
- name: "Run Util Tests"
uses: ./.github/actions/run-util-tests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ __pycache__/
.pytest_cache/
test-results/
axe-reports/
.env
local.env

# Please, add your custom content below!
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"cSpell.words": [
"addopts",
"autouse",
"BCSS",
"behaviour",
"codegen",
"customisable",
"customised",
Expand Down
189 changes: 162 additions & 27 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,175 @@
# Contributing To This Project

With this project, we actively encourage anyone who may have any ideas or code that could make this repository better to contribute
in any way they can.
This document outlines the general guidance that should be applied when contributing new code to this project,
to ensure that coding standards and principles remain consistent throughout the project.

## How To Contribute
## Table of Contents

If you have an idea about something new that could be added, then please raise a
[Feature Request via the Issues tab](https://github.com/nhs-england-tools/playwright-python-blueprint/issues/new/choose) for this
repository. Even if you don't feel you have the technical ability to implement the request, please raise an issue regardless as
the maintainers of this project will frequently review any requests and attempt to implement if deemed suitable for this blueprint.
- [Contributing To This Project](#contributing-to-this-project)
- [Table of Contents](#table-of-contents)
- [General Principles](#general-principles)
- [Use Playwright and pytest documentation as our standard](#use-playwright-and-pytest-documentation-as-our-standard)
- [Proving tests work before raising a pull request](#proving-tests-work-before-raising-a-pull-request)
- [Evidencing tests](#evidencing-tests)
- [Example](#example)
- [Coding Practices](#coding-practices)
- [Tests](#tests)
- [Docstring](#docstring)
- [Example](#example-1)
- [Page objects](#page-objects)
- [Naming Conventions](#naming-conventions)
- [Docstring](#docstring-1)
- [Example](#example-2)
- [Utilities](#utilities)
- [Docstring](#docstring-2)
- [Example](#example-3)
- [Package management](#package-management)
- [Last Reviewed](#last-reviewed)

If you have some code you think could be implemented, please raise a Feature Request and
[create a fork of this repository](https://github.com/nhs-england-tools/playwright-python-blueprint/fork) to experiment and ensure
that the change you want to push back works as intended.
## General Principles

## Contribution Requirements
### Use Playwright and pytest documentation as our standard

For any contributions to this project, the following requirements need to be met:
When contributing to this project, we should be following the guidance outlined in the
[Playwright](https://playwright.dev/python/docs/api/class-playwright) and
[pytest](https://docs.pytest.org/en/stable/)
documentation in the first instance to ensure our code remains as close to the recommended standard as possible.
This will allow anyone contributing to this project to follow the code and when we use elements from either
Playwright or pytest, easily reference the implementation from their documentation.

- You must be a member of the [NHS England Tools](https://github.com/nhs-england-tools) organisation on GitHub.
- [Any commits must be signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits), so they show as verified once they reach GitHub. This checking serves as part of our CI/CD process, so unsigned commits will prevent a pull request from being merged.
- For any utility methods that are added to this framework in the `utils` directory, the following applies:
- Unit tests for the utility should be added to the `tests_utils` directory and need to be tagged with the `utils` mark.
- Documentation for these classes and how to use any methods should also be added to the `docs/utilities-guide` directory.
- Each method that is intended to be used as part of a class should have a correctly formatted docstring, to allow for developers using Intellisense within their IDE to understand what the code is intended to do.
- All CI/CD checks will need to pass before any code is merged to the `main` branch - this includes ensuring appropriate formatting of code and documentation, security checks and that all unit and example tests pass.
In the event we need to deviate away from this for any reason, we should clearly document the reasons why and explain
this in any pull request raised.

## Things We Want
### Proving tests work before raising a pull request

What we are particularly interested in is:
When creating or modifying any code, if tests in the framework have been impacted by the change we should ensure that
we execute the tests prior to raising a pull request (to ensure we are not asking for a code review for code that does
not work as intended). This can either be done locally or via a pipeline/workflow.

- Any utility classes that can uniformly applied to any project. This may be something that's been created for your own project and by doing some minor abstraction any other teams working in a similar way could adopt this functionality.
- Any development code that supports executing this project in a CI/CD fashion. This primarily covers any changes that support development principles outlined in the [Software Engineering Quality Framework](https://github.com/NHSDigital/software-engineering-quality-framework), and could include logic around how the test code is containerized.
- Any changes that allow for test reporting in a consistent, reliable, maintainable and interesting format for varying stakeholders. This includes logic that expands on from the reporting we generate, such as example scripts for how to generate dashboards using the data we generate.
### Evidencing tests

Examples:
When we create new tests, or significantly change the functionality of a test, we should demonstrate these tests work
by [recording the trace using Playwright](https://playwright.dev/python/docs/trace-viewer-intro) and attaching the
generated trace file to the associated ticket within `Jira`.

- Say you've created a utility for generating test patients within your application. Any elements of this code that could be universally applied and other teams are likely to use (e.g. NHS number, patient name) we would want in this blueprint. If there's something business specific to your project that exists as part of this code (e.g. a unique reference number that only applies to your service), then we would advise removing that logic from any code before raising a pull request here.
- If you do end up adding a utility class in this format in a more generic way to this project, you can subsequently [inherit the utility class](https://docs.python.org/3/tutorial/classes.html#inheritance) to include your additional business-specific requirements within your own version of the class.
> NOTE: If the trace file exceeds the maximum file attachment size for `Jira`, we should
> upload the file to a Confluence page instead and link this back to the ticket.

When we modify existing tests (including any page objects or utilities used by these tests) but the behaviour of the test
has not fundamentally changed, we should upload the generated HTML report from the Playwright execution to the
`Jira` ticket.

#### Example

We introduce a new test that covers the send a kit functionality for a single subject using `codegen` in the first instance.
To demonstrate this test has worked as intended, we should turn tracing on and generate a trace file from Playwright and
attach this to the ticket in `Jira`.

We then decide to refactor the test so that it uses a page object model for the send a kit page, but this does not change
the behaviour of the test in any way (just makes the elements reusable). In this instance, we should upload the HTML report
to the `Jira` ticket showing the test passing as the logic of the test has not changed in any way.

We then decide to create a utility that loops through several subjects at once and apply this to the previously created send
a kit test. In this instance, we should turn tracing on again and generate a trace file from Playwright and attach this to the
ticket in `Jira`, because the logic of the test has fundamentally changed.

## Coding Practices

### Tests

The following guidance applies to any files in the /tests directory.

#### Docstring

For any tests in the project, we should add a docstring that explains the test in a non-technical way, outlining the following
points:

- The steps undertaken as part of the test
- References to any applicable acceptance criteria this test covers

This information will be populated on the HTML report provided by the framework, allowing for non-technical stakeholders to
understand the purpose of a test without specifically needing to view the code directly.

This should always be done using a [multi-line docstring](https://peps.python.org/pep-0257/#multi-line-docstrings), even if
the test description is reasonably short.

##### Example

def test_example_scenario(page: Page) -> None:
"""
This test covers an example scenario whereby the user navigates to the subject search page,
selects a subject who is 70 years old and validates their age is correctly displayed on the
screening subject summary page.

This test is used for the following acceptance criteria:
- BCSS-1234 (A/C 1)
"""

### Page objects

The following guidance applies to any files in the /pages directory.

#### Naming Conventions

For any newly created page objects, we should apply the following logic:

- The filename should end with `_page` (Example: `send_a_kit_page.py`)
- The class name should end with `Page` (Example: `SendAKitPage`)

#### Docstring

For any page objects in the project, we need to ensure for any class methods or functions we give a
brief description of the intent of the function for the benefit of anyone reading the project or using
intellisense. This can be done using a [single-line docstring](https://peps.python.org/pep-0257/#one-line-docstrings)
where possible.

##### Example

class ExamplePage:

def __init__(page: Page) -> None:
self.page = page

def click_on_locator(locator: Locator) -> None:
"""Clicks on the provided locator."""
locator.click()

def get_text_from_locator(locator: Locator) -> str:
"""Returns the text from the locator as a string."""
return locator.inner_text()

### Utilities

The following guidance applies to any files in the /utils directory.

#### Docstring

For any utilities added to the project, we should add docstrings that outline the functionality including
any arguments and returns. These should be formatted as
[multi-line docstrings](https://peps.python.org/pep-0257/#multi-line-docstrings) with a description, Args and
Returns provided.

##### Example

def example_util(user: str) -> dict:
"""
Takes the user string and retrieves example information applicable to this user.

Args:
user (str): The user details required, using the record key from users.json.

Returns:
dict: A Python dictionary with the example details of the user requested.
"""

### Package management

If we need to introduce a new Python package (via requirements.txt) into this project to allow for
appropriate testing, we need to have critically reviewed the package and ensure the following:

- The package we intend to use is actively being maintained (e.g. has had recent updates or has a large active community behind it)
- The package has appropriate documentation that will allow us to easily implement and maintain the dependency in our code

## Last Reviewed

This document was last reviewed on 01/05/2025.
Loading