Silver1713/public/: automata-core-0.4.0 metadata and description

Simple index

A YAML-driven browser testing framework powered by Selenium, with structured results and extensible reporting.

author Jia Hao
author_email Jia Hao <[email protected]>
description_content_type text/markdown
requires_dist
  • faker>=40.44.0,<41
  • pyyaml>=6.0.3,<7
  • replion>=1.1.0
  • selenium>=4.52.0,<5
requires_python >=3.14

Because this project isn't in the mirror_whitelist, no releases from root/pypi are included.

File Tox results History
automata_core-0.4.0-py3-none-any.whl
Size
26 KB
Type
Python Wheel
Python
3
automata_core-0.4.0.tar.gz
Size
18 KB
Type
Source

Automata Core

Automata Core runs browser actions, assertions, and waits through Selenium. The browser integration suite uses NORTHLINE, a six-page outdoor storefront fixture, to exercise those handlers against realistic navigation and interaction flows.

Public API

Import Automata from the root of the installed library:

from automata.core import Automata

result = Automata.run("suite.yml")  # Chrome by default
print(result.success)

Each case runs in a fresh browser session, which Automata closes after execution, including failed cases. Loading and parsing errors raise before a browser starts. Execution failures are returned in result; output is silent unless an adapter is supplied.

Suite and case results include started_at and finished_at as timezone-aware UTC datetimes, plus duration_seconds measured with a monotonic performance counter. Case timing starts before browser creation and ends after cleanup, including failures. Suite timing includes all cases and reporting overhead up to the final suite callback; it is measured independently of case durations. Completion callbacks receive finalized timing. JSON and XML reports serialize timestamps in ISO 8601 format and include durations in seconds.

Choose Chrome, Edge, or Firefox, with optional headless mode:

result = Automata.run("suite.yml", browser="firefox", headless=True)
result = Automata.run("suite.yml", browser="edge")

Pass Selenium options for further browser configuration:

from selenium import webdriver
from automata.core import Automata
from automata.core.runtime.adapters import ConsoleAdapter

options = webdriver.ChromeOptions()
options.add_argument("--window-size=1440,900")
result = Automata.run(
    "suite.yml", browser="chrome", headless=True, options=options, adapter=ConsoleAdapter()
)

For Selenium Remote, a custom service, or another browser, pass a factory that creates a new WebDriver on each call:

result = Automata.run("suite.yml", create_driver=webdriver.Firefox)

Use either a custom factory or browser/headless/options. For manual browser work, Automata.create_driver() forwards keyword arguments to Selenium. You own that browser and must close it:

driver = Automata.create_driver("chrome", headless=True, options=options)
try:
    driver.get("https://example.com")
finally:
    driver.quit()

The same helper supports Automata.create_driver("firefox", headless=True) and Automata.create_driver("edge", headless=True). Headless mode preserves supplied options and adds its browser-specific argument to a separate copy.

Output adapters

Execution is silent by default and always returns the same result objects. Choose a built-in adapter when running a suite:

from automata.core import Automata
from automata.core.runtime.adapters import ConsoleAdapter, JsonAdapter, XmlAdapter

result = Automata.run("suite.yml", create_driver=create_driver, adapter=ConsoleAdapter())
# Alternatively: adapter=JsonAdapter("results.json")
# Alternatively: adapter=XmlAdapter("results.xml")

Console output is plain text, with case statuses, errors, and a final summary. JSON and XML adapters overwrite their destination at suite completion, including case and executed-step results. Parent directories must already exist. JSON uses the result field names; XML uses Automata's suite/case/step format, not JUnit. File errors propagate to the caller. Direct Runner.run_test calls only emit case callbacks; file adapters write reports when Runner.run_suite, Core.run, or Automata.run completes. Extend automata.core.runtime.adapter.Adapter to provide custom CLI formatting.

Explore the test site

From the repository root, start a local server:

.venv\Scripts\python.exe -m http.server 8000 --directory tests/fixtures

Open http://127.0.0.1:8000/index.html. The site contains Home, Shop, Trail field kit, Your kit, Route desk, and Journal pages. Shop quick view and the product detail page both add to the same browser-local kit; the Route desk contains the profile form, interaction controls, 3D compass, and gear planner; Journal contains the field film.

Run browser integration tests

.venv\Scripts\python.exe -m unittest tests.test_integration -v

The suite starts its own HTTP server on a free localhost port and opens Chrome. It checks cross-page navigation and cart persistence in addition to the individual action, assertion, and wait handlers. The fixture pages and shared CSS/JavaScript live in tests/fixtures/.