Skip to main content

CloudBeat Pytest Kit

Project description

CloudBeat Python Integrations

CloudBeat logo

Release Status Downloads

Learn more about CloudBeat at https://cloudbeat.io/

~ 🧾 Documentation – official documentation for CloudBeat
~ 🙋🏻 Contact and Support – contact us and we'd love to help
~ 📣 Blog – stay updated with our latest news
~ 💻 Demo – request a demo


Quick start

Make sure your requirements.txt includes:

cloudbeat-pytest
cloudbeat-selenium

Standard Installation

cd pytest-selenium
python -m venv env
env\Scripts\activate
pip install -r requirements.txt

Installation using UV

uv venv
uv pip install -r requirements.txt

Set up CloudBeat reporter in confitest.py

import uuid

import pytest
from selenium import webdriver
from cloudbeat_common.models import CbConfig
from cloudbeat_common.reporter import CbTestReporter
from cloudbeat_selenium.wrapper import CbSeleniumWrapper


@pytest.fixture(scope="module")
def cb_config():
    """Prepare configuration class for further CB reporter initialization."""
    config = CbConfig()
    config.run_id = str(uuid.uuid4())
    config.instance_id = str(uuid.uuid4())
    config.project_id = str(uuid.uuid4())
    config.capabilities = {"browserName": "chrome"}
    return config


@pytest.fixture(scope="module")
def cb_reporter(cb_config):
    reporter = CbTestReporter(cb_config)
    return reporter


@pytest.fixture()
def setup(cb_reporter):
    driver = webdriver.Chrome()
    wrapper = CbSeleniumWrapper(cb_reporter)
    wrapped_driver = wrapper.wrap(driver)
    yield wrapped_driver
    driver.quit()

Set python src path if necessary

set PYTHONPATH=src

Run your tests

Standard

cd pytest-selenium
env\Scripts\activate

All tests

pytest 

Parallel tests

pytest -n 4

Single test

pytest -v -s Tests/test_login.py 

Using UV

uv run pytest # run all tests
uv run pytest -n 4 # run parallel tests
uv run pytest -v -s Tests/test_login.py # run a single test

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

cloudbeat_pytest-1.0.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

cloudbeat_pytest-1.0.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file cloudbeat_pytest-1.0.1.tar.gz.

File metadata

  • Download URL: cloudbeat_pytest-1.0.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for cloudbeat_pytest-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1e3b3e3f029c175a7f6d1b1c3d4b3860e9e73cbfd458b87fa94af2c3de7dcbc8
MD5 521a819fd669877a48b03d6affec4a7a
BLAKE2b-256 13f2dd5d276736b10a2afa1ce6324e21cf862cdc39691c56e35a568c0f3cfea9

See more details on using hashes here.

File details

Details for the file cloudbeat_pytest-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cloudbeat_pytest-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 06045fa809acdf4e6b6437655b4438512506e9b4def07d92559d3aa4ff5e08b9
MD5 8a15dbc5066a9175473bb0a4a920b039
BLAKE2b-256 1cffd975cc5d96835b690a8bf7812d5ab0fa7145fb163a27f97f33acf302d3b1

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