Skip to main content

Multi-driver E2E test framework: Playwright, pywinauto, httpx, subprocess — with full observability stack

Project description

Ankole Framework

Multi-driver E2E test framework with full observability stack. Supports 4 automation engines (Playwright, pywinauto, httpx, subprocess) with Protocol-based driver abstraction.


Architecture Highlights

  • Multi-driver: Web (Playwright), Desktop (pywinauto), API (httpx), CLI (subprocess)
  • Design patterns: Page Object Model, Flow/Step orchestration, Fixture factories, Strategy pattern
  • Observability: Grafana + Prometheus + Loki + Allure (all Dockerized)
  • Infrastructure: One docker-compose up for complete environment
  • CI/CD: GitHub Actions with matrix builds and artifact collection
  • Multi-layer testing: Unit, API, Web E2E, CLI, Desktop
  • TCMS integration: Bidirectional Kiwi TCMS sync

Quick Start

# 1. Start infrastructure + sample apps
docker-compose up -d

# 2. Install framework
pip install -e ".[all]"
playwright install chromium

# 3. Run tests
pytest tests/unit/ -v                    # Framework core tests
pytest tests/api/ -v                     # API tests
pytest tests/web/ -v                     # Web UI tests
pytest tests/cli/ -v                     # CLI tests
pytest tests/ -v --alluredir=evidence/allure-results  # Full suite

# 4. View results
# Grafana:  http://localhost:3000
# Allure:   http://localhost:5050 (with --profile reporting)

Project Structure

ankole/                           # Framework package
  driver/
    base.py                       # Protocol definitions (Driver, Web, API)
    ui_driver.py                  # pywinauto desktop driver
    web_driver.py                 # Playwright web driver
    api_driver.py                 # httpx API driver
    console_runner.py             # Subprocess CLI runner
    evidence.py                   # Screenshots & step tracking
    grafana_push.py               # Prometheus metrics push
    health_check.py               # Pre-execution environment checks
    kiwi_tcms.py                  # Kiwi TCMS integration
    ...
  plugin/                         # Pytest plugin (auto-registered)
    config.py, fixtures.py, hooks.py, metrics.py, kiwi_hooks.py
  pages/
    base_page.py                  # Generic page object base
    web/                          # Playwright page objects
      login_page.py, dashboard_page.py, member_management_page.py
      role_management_page.py, project_approval_page.py
  flows/
    base.py                       # FlowContext, Step, Flow engine
    workspace/                    # Pre-composed workspace flows
  steps/workspace/                # Reusable step factories
  testing/                        # Conftest utilities & fixture factories

tests/
  web/                            # Playwright web UI tests
  api/                            # httpx API tests
  cli/                            # CLI subprocess tests
  desktop/                        # pywinauto desktop tests
  unit/                           # Framework unit tests

sample_apps/                      # Docker target applications
  web_app/                        # Flask + Bootstrap 5
  api/                            # FastAPI REST API
  cli/                            # Click CLI tool
  db/init.sql                     # PostgreSQL schema + seeds

config/
  settings.yaml                   # Main configuration
  settings.docker.yaml            # Docker-specific overrides
  prometheus.yml, loki-config.yml, promtail-config.yml
  grafana-dashboard.json          # Pre-built Grafana dashboard

docker-compose.yml                # Full stack
.github/workflows/ci.yml          # GitHub Actions CI

Sample Applications

The sample_apps/ directory contains three target applications that share a PostgreSQL database:

App Technology Port Description
Web App Flask + Jinja2 + Bootstrap 5 5000 Workspace management UI
REST API FastAPI + JWT 8000 REST API with full CRUD
CLI Python Click N/A CLI calling the REST API

Domain: Workspace Management

  • Member Management: CRUD + Suspend/Reactivate
  • Role Management: CRUD with permissions
  • Project Approval Workflow: Multi-step approval (3 approvers)

Driver Architecture

           DriverProtocol              WebDriverProtocol          APIDriverProtocol
               (desktop)                    (web)                      (api)
                  |                          |                          |
              UIDriver                   WebDriver                  APIDriver
            (pywinauto)               (Playwright)                  (httpx)

All drivers follow the Protocol pattern for structural typing. Page objects accept any compatible driver.


Flow/Step Orchestration

from ankole.flows.base import FlowContext, Step, Flow

ctx = FlowContext(driver, evidence, test_data)
flow = Flow("Approve Project", [
    Step("Login", login_action),
    Step("Create Project", create_action),
    Step("Approve Step 1", approve_action, retries=2),
])
flow.run(ctx)

Flows compose with + operator:

combined = login_flow + create_member_flow + verify_flow
combined.run(ctx)

Configuration

Settings are loaded from config/settings.yaml with environment variable overrides:

workspace:
  web:
    base_url: "${WORKSPACE_WEB_URL}"
    browser: "chromium"
    headless: true
  api:
    base_url: "${WORKSPACE_API_URL}"
    timeout: 30

Override via env vars or ANKOLE_CONFIG_PATH:

export WORKSPACE_WEB_URL=http://localhost:5000
export WORKSPACE_API_URL=http://localhost:8000

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ankole_framework-1.0.0.tar.gz (106.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ankole_framework-1.0.0-py3-none-any.whl (116.3 kB view details)

Uploaded Python 3

File details

Details for the file ankole_framework-1.0.0.tar.gz.

File metadata

  • Download URL: ankole_framework-1.0.0.tar.gz
  • Upload date:
  • Size: 106.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for ankole_framework-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4c61b602c96ece200798c0cb036ac4dd53c762f61cc764a6410a1f0b41976332
MD5 c83959782591f5f8bfa98e0268823113
BLAKE2b-256 1aa15678317efd6e11e6ce1b1cc61c5ae3d8274afb18584ea93f0da353ad21a5

See more details on using hashes here.

File details

Details for the file ankole_framework-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ankole_framework-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6584dd93904113340e56ff7c2bab52e7358828d5ddc7220e519407e03694995
MD5 8e8dfce578c615da081fff1e72c3dfb5
BLAKE2b-256 0d5a3ac6702fc1c68986e8f29862b30207f535060010a58d92cdfca1babd4121

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page