Skip to main content

Websites test framework for Igor

Project description

description

Ocarina

A Python browser test automation framework built on Railway Oriented Programming (ROP).

Overview

Ocarina is a pure-Python framework that provides a declarative DSL for composing browser tests.

Its defining characteristic is that every test step is a link in a Railway chain: on failure, the rest of the chain short-circuits and the error is captured as a value rather than propagated as an exception.

This keeps test code flat and the failure path explicit.

Notable features:

  • Railway-based action chains with first-class success/failure handlers.
  • Hierarchical test orchestration: TestTestSuiteTestCampaignTestCycle.
  • Parallel execution with a thread-safe WebDriver pool.
  • Automatic retries on transient errors.
  • Conditional branching via match_page for pages that can render in multiple states.
  • Fluent assertion chains via validate.
  • Built-in reporters: pretty-print (ANSI), JSON, DOCX proof documents, timing, screenshots.
  • Framework-agnostic POMBase; the Selenium integration is one of several possible adapters.
  • Ships its own test runner: Ocarina is NOT a pytest plugin.

Requirements

  • Python 3.14+
  • (SELENIUM) A matching WebDriver binary on disk (chromedriver, geckodriver, msedgedriver) for the browser you intend to use. Safari uses the native macOS safaridriver and needs no binary on disk.

Documentation

See The Ocarina Holy Book

Installation

pip install ocarina

Core concepts

  • POM — page objects subclass POMBase; the base class is browser-agnostic.
  • Scenario — a factory (driver, logger) -> Scenario(test_chain, setup, teardown, watchers) built from Scenario.
  • Railway chain — actions are wrapped with create_act, which returns a builder with .failure(...), .success(...), and .execute().
  • drive_pagedrive_page composes multiple acts into a single chain.
  • match_pagematch_page branches on which of several states a page is in.
  • validatevalidate is a fluent assertion chain with alternatives and aggregated errors.
  • Test orchestratorsTest (one case), TestSuite (parallel + retry policy), TestCampaign (sequential suites), TestCycle (smoke campaigns before main campaigns).

CLI flags (opinionated Selenium launcher)

Parsed by create_selenium_auto_cli_store. Headless mode is the default; use --not-headless to opt out.

Flag Default Notes
--driver-path "" Path to the WebDriver binary (not used on Safari).
--browser required chrome, firefox, edge (Windows), safari (macOS).
--not-headless off Shows the browser UI.
--workers 5 Parallel workers (size of the driver pool).
--wait-timeout 10 Selenium implicit wait seconds (max 60).
--profile-path None Browser profile directory (not supported on Safari).
--logger terminal+file One of terminal, file, terminal+file, muted.
--dont-force-delete-tmp-dirs off Skip the post-run cleanup of Selenium temp profiles on Windows.
--exclude [] Exclude tests by IDs.
--only [] Select tests by IDs.

Reporting

The opinionated/plugins/reports package ships four reporters that can be passed to bootstrap via run_plugins:

  • pretty-print — hierarchical ANSI summary on stdout.
  • JSON results — structured results.
  • DOCX proofs — Word document assembled from logs (requires FileLogger).
  • timing — context manager that prints total test duration.

Screenshots are captured automatically on failure (when autoscreen_on_fail=True on a suite) and can also be triggered explicitly through the ITakeScreenshot port.

Full example

For a complete, runnable project:

  • CI workflow,
  • Real page objects,
  • OTP-based login coordinated through Redis,
  • Data-driven suites,
  • File upload tests,
  • Chaos scenarios

See ocarina-example.

Full AI example

See ocarina-with-ai-example.

Development

From a clone of this repo:

make install              # create .venv and install with dev deps
make test                 # pytest + coverage + allure results
make check-coding-style   # mypy + ruff
make ruff-format          # apply formatting
make serve-htmlcov        # open the HTML coverage report
make serve-allure         # open the Allure report

Misc

Allure report

License

MIT — Igor Casanova.


Built by @mojo-molotov
Fueled by figatellu and Квас.

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

ocarina-1.0.4.tar.gz (695.2 kB view details)

Uploaded Source

Built Distribution

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

ocarina-1.0.4-py3-none-any.whl (109.1 kB view details)

Uploaded Python 3

File details

Details for the file ocarina-1.0.4.tar.gz.

File metadata

  • Download URL: ocarina-1.0.4.tar.gz
  • Upload date:
  • Size: 695.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for ocarina-1.0.4.tar.gz
Algorithm Hash digest
SHA256 adf4d82af5802f52978a4b9592f7236ba1d06a4a4aa2a740058067f1fb6476ee
MD5 a00be871cc6c9fd89512669fc91d96ac
BLAKE2b-256 d749044b9db57ebea8b61f8577c34b61fa497d35e45654ab563a3fae4aebd15c

See more details on using hashes here.

File details

Details for the file ocarina-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: ocarina-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 109.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for ocarina-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 44c36085e6f9b6268dc6ab9d4f55b70ec7193bf10be333612c7d8a824d2560cd
MD5 0b26509d2e9199a2f45a65d3ebf2764a
BLAKE2b-256 0b112dfb1452c8b66a8cd157beac8c54ae3133fbe10ac07b933f20764fc9b0b1

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