Skip to content

nhs-england-tools/playwright-python-blueprint

Repository files navigation

Playwright Python Blueprint

CI/CD Pull Request

This project is designed to provide a blueprint to allow for development teams to start quickly developing UI tests using Playwright Python, providing the base framework and utilities to allow for initial focus on writing tests, rather than configuration of the framework itself.

NOTE: This project is currently under initial development so isn't finalised, but should work if you want to experiment with Playwright Python.

NOTE: When considering this project, please be advised that currently Playwright is a "proposed" tool within the NHS England Tech Radar. Whilst we are taking steps to get Playwright moved to the "mainstream" section of the radar, as it has not yet been formally adopted it is possible that Playwright may not be fully endorsed by NHS England as a standard tool going forward, and using this framework for an NHS England project is currently at your own risk.

Table of Contents

Setup

You can clone this whole repository using the code below:

git clone https://github.com/nhs-england-tools/playwright-python-blueprint.git

Prerequisites

To utilise the blueprint code, you will need to have the following installed:

Whilst not required to get started, you may also want to configure a Python virtual environment for your project before proceeding with the configuration. If you are using an IDE such as Visual Studio Code or PyCharm, you will normally be prompted to do this automatically.

Configuration

To get started using Playwright and with the examples provided, use the following commands:

pip install -r requirements.txt
playwright install --with-deps

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 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 so you can see the browser execution):

pytest --tracing on --headed

Getting Started

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.

Once you've confirmed your installation is working, please take a look at the following guides on getting started with Playwright Python.

  1. Understanding Playwright Python
  2. Blueprint File Breakdown

We've also created a Quick Reference Guide for common commands and actions you may regularly perform using this blueprint.

For additional reading and guidance on writing tests, we also recommend reviewing the Playwright Python documentation.

Contacts

If you have any queries regarding this blueprint, please contact dave.harding1@nhs.net.

Licence

The LICENCE.md file will need to be updated with the correct year and owner

Unless stated otherwise, the codebase is released under the MIT License. This covers both the codebase and any sample code in the documentation.

Any HTML or Markdown documentation is © Crown Copyright and available under the terms of the Open Government Licence v3.0.

About

A blueprint for NHS England teams to use when adopting Playwright Python

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published