Skip to main content

🛰️ SputnikQA — Test Automation Framework

PyPI version Python versions License

SputnikQA — фреймворк для автотестов на Python. Внутри два booster'а с общими принципами:

  • REST API — HTTP-клиент с middleware-пайплайном, декларативные API-секции (по аналогии с Page Object) и валидация ответов через pydantic-модели.
  • Web UI — единый интерфейс над Playwright и Selenium: страницы, элементы, списки, композитные виджеты. Синхронный и асинхронный варианты.

Сверху — интеграция с Allure и генератор API-клиента из OpenAPI 3.x.

Установка

pip install sputnikqa

Необязательные зависимости ставятся экстрами:

pip install sputnikqa[httpx]        # HTTP-транспорт на httpx
pip install sputnikqa[requests]     # HTTP-транспорт на requests
pip install sputnikqa[playwright]   # Web UI на Playwright
pip install sputnikqa[selenium]     # Web UI на Selenium
pip install sputnikqa[allure]       # Allure-отчёты

# типичный набор для API+UI проекта
pip install sputnikqa[allure,httpx,playwright]

Python 3.13+.

Пример: REST API

Модель ответа и секция API — по аналогии с Page Object:

from sputnikqa.boosters.restapi.clients import ApiClient
from sputnikqa.boosters.restapi.response_models import JsonResponse
from sputnikqa.boosters.restapi.sections import BaseApiSection
from sputnikqa.boosters.restapi.transports import HttpxTransport


class Pet(JsonResponse):
    id: int | None = None
    name: str
    status: str


class PetSection(BaseApiSection):
    base_url = "https://petstore.swagger.io/v2"

    def get_pet(self, pet_id: int) -> Pet:
        response = self.client.get(self.url_join(f"/pet/{pet_id}"))
        return (
            self.validator(response)
            .validate_status(200)
            .validate_response_model({200: Pet})
            .get_validated_model()
        )

В тесте:

def test_get_pet():
    section = PetSection(ApiClient(HttpxTransport()))
    pet = section.get_pet(1)

    assert pet.name == "doggie"

validate_status() проверяет статус-код, validate_response_model() парсит и валидирует тело pydantic-моделью, get_validated_model() возвращает готовый объект. Любое несовпадение — понятная ошибка с телом ответа, а не загадочный KeyError где-то в тесте.

Пример: Web UI

from sputnikqa.boosters.web_ui.locators import Locator, LocatorStrategy
from sputnikqa.boosters.web_ui.sync_api import (
    BasePage,
    Element,
    create_browser,
    BrowserContext,
)


class LoginPage(BasePage):
    def __init__(self):
        self.username = Element(Locator("#username", LocatorStrategy.CSS))
        self.password = Element(Locator("#password", LocatorStrategy.CSS))
        self.submit = Element(Locator("//button[@type='submit']"))


browser = create_browser("playwright")
with BrowserContext.use_browser(browser):
    browser.open_browser(headless=True)
    browser.navigate_to("https://example.com/login")

    page = LoginPage()
    page.username.fill("admin")
    page.password.fill("secret")
    page.submit.click()

Локаторы ленивые: элемент ищется в момент действия. При ошибке автоматически делается скриншот. Код страницы не меняется при смене бэкенда — create_browser("selenium") даёт тот же интерфейс.

Документация

Документ О чём
REST API booster клиенты, транспорты, middleware, секции, валидация, билдеры
Web UI booster браузеры, страницы, элементы, локаторы, ожидания
Генерация API-клиента из OpenAPI CLI-тулза sputnikqa-openapi
Интеграция с Allure шаги, аттачи запросов, скриншоты
Логирование настройка через стандартный logging
Расширение фреймворка свой транспорт, middleware, валидатор

Лицензия

MIT. Подробности — в LICENSE.


📌 PyPI: https://pypi.org/project/sputnikqa/ 📌 GitVerse: https://gitverse.ru/crenom/SputnikQA

Metadata

Release files for sputnikqa 0.1.0

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

Source distribution (sdist)

Source distribution for sputnikqa 0.1.0
File Size Uploaded Provenance Actions
sputnikqa-0.1.0.tar.gz 79.1 kB Without provenance Details for sputnikqa-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sputnikqa 0.1.0
File Interpreter ABI Platform Actions
sputnikqa-0.1.0-py3-none-any.whl Python 3 none any Details for sputnikqa-0.1.0-py3-none-any.whl

Total release size: 212.1 kB

Release files / sputnikqa-0.1.0.tar.gz

Download URL sputnikqa-0.1.0.tar.gz
Size 79.1 kB
Tags Source
SHA-256 checksum
How to use checksums
52291eb1d6b0645bfd5e367482c9f0f4ea2ee754bfacf41fa41b346008ef3fae
BLAKE2b-256 checksum
How to use checksums
559f55b80ce29fe5c6b5942ba9ac8376b38b59b2091c3d3efa20801ecafcdee2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.13.17 Linux/5.15.0-144-generic

Release files / sputnikqa-0.1.0-py3-none-any.whl

Download URL sputnikqa-0.1.0-py3-none-any.whl
Size 133.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b827a3c9b4567e949154ca12f1f5da1fa76e5021ebd44ddf46adbdf76e6ad9f5
BLAKE2b-256 checksum
How to use checksums
d1e496a844b608c3f54e4887f89f20aba12cc4dc02c2018fee37beb7c4a304af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.13.17 Linux/5.15.0-144-generic

Security for sputnikqa 0.1.0

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.

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