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.2

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.2
File Size Uploaded Provenance Actions
sputnikqa-0.1.2.tar.gz 94.4 kB Without provenance Details for sputnikqa-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 248.4 kB

Release files / sputnikqa-0.1.2.tar.gz

Download URL sputnikqa-0.1.2.tar.gz
Size 94.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2d3fb606095e1451de6d1951cb29291643dc891a88dce344bc92fbb091466311
BLAKE2b-256 checksum
How to use checksums
99107cee9f137da42f8a32b4d80952fb55ad46cb21d98e5207531b891d2edf2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.13.18 Linux/5.15.0-144-generic

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

Download URL sputnikqa-0.1.2-py3-none-any.whl
Size 154.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d095fed7a128fda8d33900d3b5d1710c06a434bf79b7e58c13442cad964b988
BLAKE2b-256 checksum
How to use checksums
f857cf5a93cabce53cc485d72bfcfcf9c0a5b31d6e791d0b212ff5121b2361cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.13.18 Linux/5.15.0-144-generic

Security for sputnikqa 0.1.2

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