This is a suite of automated end-to-end UI tests for the AODN Portal v2. The tests are implemented using pytest framework and Playwright for interactions with the web browser.
-
Prerequisites: Docker installed on your system.
-
Run playwright tests against the current local version of the aodn-portal-v2:
yarn playwright
Python 3.10.x is required. UNIX/MacOS users can use Pyenv for Python version management.
However, This guide provides instructions for setting up your working environment using Conda to create a virtual environment with the required Python version that should work on both UNIX/MacOS and Windows. Additionally, we'll utilize Poetry to manage packages within the conda
environment.
If you don't have Conda
and Poetry
installed, you'll need to install them before setting up the project.
Poetry
should be installed globally on your system, not within a Python virtual environment. We will utilizepipx
to ensure thatPoetry
remains isolated in the global scope while also being accessible from anywhere on your system.
To install Conda
, please refer to the official guide.
-
First, install
pipx
by following the instructions in the official repository. Ensure thatpipx
is added to your system's PATH variable after installation. -
For OSX and Z Shell users, open up
~/.zshrc
and add this:export PATH="$HOME/.local/bin:$PATH"
-
Then, proceed to install
Poetry
by running the following command:pipx install poetry
-
Open your terminal (Linux, MacOS) or the Miniconda/Anaconda Prompt (Windows).
-
Navigate to the
/playwright
directory. -
Create a
conda
environment using theenvironment.yml
file:conda env create -f environment.yml
This command creates a virtual environment with the name
aodn-portal-v2
and installs the required python version. -
Activate this
conda
environment:conda activate aodn-portal-v2
-
Install dependencies defined in
pyproject.toml
:poetry install
-
Install all supported browsers with system dependencies:
playwright install --with-deps
-
Configure project related settings:
a) Open the
settings.toml
fileb) Update the required values according to your environment.
-
Run all tests:
pytest
-
Run tests with visible browsers
pytest --headed
-
To run tests in parallel, use the
--numprocesses
flag:pytest --numprocesses auto
More configurable options can be found in the official documentation.
Test reports are generated using pytest-html. The generated report for the latest test run will be stored inside the /playwright/reports
directory.
The link to view the traces: https://trace.playwright.dev/
Install https://playwright.dev/docs/getting-started-vscode Playwright Test for VSCode