Skip to main content

Python-Playwright based testing framework for Bugster's e2e testing agent

Project description

Bugster Framework

Bugster is a powerful, flexible testing framework built on top of Playwright and pytest. It's designed to simplify the process of writing and managing end-to-end tests for web applications, with a focus on supporting multiple client configurations.

Features

  • Built on Playwright for robust, cross-browser testing
  • Seamless integration with pytest
  • Support for client-specific configurations and login strategies
  • Custom @login decorator for easy test marking
  • Flexible page object model with BugsterPage

Installation

If you want to test a specific version locally, use:

pip install -e /Users/nacho/Bugster/bugster-framework

Replacing with your current directory.

Otherwise, you can install Bugster using pip:

pip install bugster

This will install Bugster and its dependencies (including pytest and playwright).

After installation, you need to install the Playwright browsers:

playwright install

Usage

Basic Setup

  1. Create a client configuration repository with the following structure:
customer-configs/
├── customer1/
│   ├── config.py
│   └── login_strategy.py
├── customer2/
│   ├── config.py
│   └── login_strategy.py
└── ...
  1. In your test files, use the @login decorator to mark tests that require login:
from bugster.decorators import login

@login
def test_requires_login(page):
    assert page.is_visible("text=Welcome")

def test_does_not_require_login(page):
    assert page.is_visible("text=Login")

@login
class TestLoggedInFeatures:
    def test_feature_1(self, page):
        assert page.is_visible("text=Feature 1")

Running Tests

To run your tests, use pytest with the --customer-id option:

pytest --customer-id customer1 /path/to/your/tests

Writing Client Configurations

In each client's config.py:

from bugster.config.base_config import BaseConfig
from .login_strategy import CustomLoginStrategy

class CustomerConfig(BaseConfig):
    LOGIN_STRATEGY = CustomLoginStrategy
    CREDENTIALS = {
        "username": "customeruser",
        "password": "customerpass"
    }
    # Add any other customer-specific configuration here

In each client's login_strategy.py:

from bugster.login.base_login_strategy import BaseLoginStrategy

class CustomLoginStrategy(BaseLoginStrategy):
    def login(self, page, credentials):
        page.goto("https://customer.example.com/login")
        page.fill("#username", credentials["username"])
        page.fill("#password", credentials["password"])
        page.click("#login-button")
        page.wait_for_selector("#welcome-message")

Advanced Usage

Bugster provides a BugsterPage class that wraps Playwright's Page object, providing additional functionality. You can extend this class for custom page objects:

from bugster.core.bugster_page import BugsterPage

class MyCustomPage(BugsterPage):
    def custom_action(self):
        # Implement custom action here
        pass

Contributing

We welcome contributions to Bugster! Please see our CONTRIBUTING.md file for details on how to contribute.

License

Bugster is released under the MIT License. See the LICENSE file for details.

Changelog

See the CHANGELOG.md file for details on what has changed in each version of Bugster.

Support

If you encounter any issues or have questions, please file an issue on the GitHub issue tracker.

Acknowledgements

Bugster is built on top of the excellent Playwright and pytest projects. We're grateful to the maintainers and contributors of these projects for their fantastic work.

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

bugster-0.21.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

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

bugster-0.21.0-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file bugster-0.21.0.tar.gz.

File metadata

  • Download URL: bugster-0.21.0.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.11.8 Darwin/23.1.0

File hashes

Hashes for bugster-0.21.0.tar.gz
Algorithm Hash digest
SHA256 c63b4ee0df0ae19c08f55b1ce0f5686409a437322c936237cb494e7818e53da6
MD5 2f544ddd1af648a5f0d56466b82725a9
BLAKE2b-256 e31da02049c8d274bda8865c06b2d93ebba9b9d496122cbffb1bee2a072b01d0

See more details on using hashes here.

File details

Details for the file bugster-0.21.0-py3-none-any.whl.

File metadata

  • Download URL: bugster-0.21.0-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.11.8 Darwin/23.1.0

File hashes

Hashes for bugster-0.21.0-py3-none-any.whl
Algorithm Hash digest
SHA256 53a3b1bf7637d6f787534bf0733623afaa8c8c4bc31b4d2716138418268fe185
MD5 a4d2eb324234293bd500d84c4d8a2cd1
BLAKE2b-256 1d23187530f5727ba5299ed1544b0fdc413f4e016c2c82c2c14e88bdfc0a698c

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