Skip to content

cbfacademy/ui-testing-best-practices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UI Testing Best Practices

Short overview: A Python-based Playwright + pytest example repository illustrating recommended patterns for reliable UI tests: page object; centralized locators, environment overlays, fixtures for per-test browser contexts, artifact collection, and CI-ready reporting.

Quick links

Repository layout

  • tests/ — test suites and parametrized cases.
  • test_client/ — helpers, page objects, locator resolution (e.g. test_client/util/util.py).
  • tests/fixtures/ — pytest fixtures (browser/page lifecycle).
  • docs/ — Markdown guides (linked above).
  • reports/ — Allure result json and generated HTML.
  • pytest.ini, conftest.py, pyproject.toml — config and dependency metadata.

Requirements

  • Python 3.12+
  • uv (project package manager) on PATH
  • Playwright browsers installed when prompted (uv run playwright install)

Quick start

Set required environment variables:

export APP_USER="standard_user"
export APP_PASSWORD="secret_sauce"

Create venv, sync deps and run tests:

uv venv --python 3.12 .venv
source .venv/bin/activate
uv sync --group dev
uv run pytest

Generate Allure HTML:

uv run task generate-report
# or
uv run allure generate reports/json -o test-results/html --clean

Notes

  • Sensitive credentials are supplied via APP_USER and APP_PASSWORD and referenced in pytest.ini via placeholders.
  • Use pytest --env=qa to pick environment overlays defined in pytest.ini.
  • Artifacts (videos/screenshots) are written to predictable folders for CI collection: test-results/videos, reports/json.

About

UBS - UI Testing Best Practices

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages