Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

persona-dsl: фреймворк для автотестов на Python

persona-dsl — это библиотека для E2E-, API- и интеграционных тестов, построенная вокруг Screenplay-подхода и тесно связанная с runtime/discovery/tooling, которые использует TaaS.

Установка

pip install persona-dsl
python -m playwright install --with-deps

Базовая модель

Публичный слой строится вокруг:

  • Persona
  • Ops
  • Step
  • CombinedStep
  • алиасов Action, Fact, Expectation, Goal
  • Page и Element
from __future__ import annotations

from persona_dsl import Goal
from persona_dsl.ops.web import Click, CurrentPath, Fill, NavigateTo
from persona_dsl.expectations.generic import IsEqualTo
from persona_dsl.pages import Button, Page, TextField


class LoginPage(Page):
    expected_path = "/login"

    username = TextField(name="username", accessible_name="Логин")
    password = TextField(name="password", accessible_name="Пароль")
    submit_button = Button(name="submit_button", accessible_name="Войти")


def test_login_flow(persona) -> None:
    login_page = LoginPage()

    persona.make(
        NavigateTo(login_page),
        Fill(login_page.username, "admin"),
        Fill(login_page.password, "secret"),
        Click(login_page.submit_button),
    )

    current_path = persona.get(CurrentPath())
    persona.check(current_path, IsEqualTo("/dashboard"))

Страницы и элементы

Page наследуется от Element и добавляет:

  • expected_path
  • default_query_params
  • build_url(base_url=None)

Element поддерживает:

  • declarative class attrs
  • aria_ref
  • multi-strategy resolve
  • .using(...), .robust(), .resolve_or(...)
  • ElementList
  • Table и declarative table DSL

VirtualPage используется для динамической in-memory модели страницы.

Генерация page object'ов

PageGenerator и GeneratePageObject генерируют declarative page objects.

Для обычных generated страниц текущий контракт такой:

  • committed generated file не содержит def __init__(...)
  • не содержит self.add_element(...)
  • не содержит self.add_element_list(...)
  • хранит expected_path, snapshot/screenshot paths и aria_ref
  • для повторяющихся анонимных контролов может выпускать declarative group, доступную по индексу как page.otp_kod[0]
  • внутри таких групп item-level aria_ref может намеренно отсутствовать, чтобы resolve шёл через container scope и role + index
  • поддерживает merge/regeneration
  • использует footer-секции unresolved/archived diagnostics

CLI:

persona-page-gen --url http://localhost:8080 --output tests/pages/home_page.py

Из теста:

from persona_dsl.ops.web import GeneratePageObject, NavigateTo


def test_generate_home_page(persona) -> None:
    persona.make(NavigateTo("/"))
    persona.make(
        GeneratePageObject(
            class_name="HomePage",
            output_path="tests/pages/home_page.py",
            wait_for_state="networkidle",
            sleep_before=1,
        )
    )

Таблицы

Актуальный table contract включает:

  • Column(...)
  • TableColumn
  • table.filters.*
  • row.elements.*
  • row.element(column)
  • row.value(column)
  • row.details
  • table.select_all_checkbox

Generator использует этот DSL и для обычных, и для сложных таблиц.

Конфигурация

Конфигурация проекта живёт в config/{env}.yaml и tests/conftest.py. Для запуска:

pytest --env=dev tests/

Если нужен локальный генератор страниц или шаблонный проект, ориентируйтесь на example_template.

Где смотреть дальше

Metadata

Release files for persona-dsl 2026.4.8rc106

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for persona-dsl 2026.4.8rc106
File Size Uploaded Provenance Actions
persona_dsl-2026.4.8rc106.tar.gz 335.2 kB Without provenance Details for persona_dsl-2026.4.8rc106.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for persona-dsl 2026.4.8rc106
File Interpreter ABI Platform Actions
persona_dsl-2026.4.8rc106-py3-none-any.whl Python 3 none any Details for persona_dsl-2026.4.8rc106-py3-none-any.whl

Total release size: 758.1 kB

Release files / persona_dsl-2026.4.8rc106.tar.gz

Download URL persona_dsl-2026.4.8rc106.tar.gz
Size 335.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e6060b47cf3fc5f2484d274c58b6d0b7794c55b63f7ac9007512c5e2dce942c9
BLAKE2b-256 checksum
How to use checksums
e74b3c5a412cf69e1f6882795f074f36906253238857ed62c2d26d2da5ee595a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / persona_dsl-2026.4.8rc106-py3-none-any.whl

Download URL persona_dsl-2026.4.8rc106-py3-none-any.whl
Size 423.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9dbbe624e91bf337ea1993291a6b5a243ad9c443891db67f7a6afb91b5aba17d
BLAKE2b-256 checksum
How to use checksums
1af02a8836f613db3248d974ae08d07f4ac24b42106c5f857eda7cd2e7a72bd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Security for persona-dsl 2026.4.8rc106

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page