Bugster-framework
Bugster is a comprehensive testing and debugging framework designed to streamline end-to-end testing with Playwright. It provides a robust infrastructure for test automation, authentication handling, and detailed test reporting.
Features
- Playwright Integration: Built on top of Playwright for reliable browser automation
- Flexible Authentication: Support for multiple authentication strategies and credential management
- Advanced Test Runner: Custom pytest plugin with dependency management between tests
- Comprehensive Reporting: Automated screenshots, traces, and detailed test reports
- Mouse and Keyboard Simulation: Enhanced input simulation with visual feedback
- Test Metadata Management: Centralized configuration for test environments and settings
Installation
# Install using pip
pip install bugster
# Or if using Poetry
poetry add bugster
Usage
Basic Test Setup
import pytest
from bugster.core.bugster_expect import expect
def test_login_flow(page):
# Navigate to login page
page.goto("/login")
# Fill login form
page.get_by_placeholder("Email").fill("user@example.com")
page.get_by_placeholder("Password").fill("password")
page.get_by_role("button", name="Sign In").click()
# Verify successful login
expect(page.get_by_text("Welcome")).to_be_visible()
Authentication Strategies
Bugster supports flexible authentication methods:
from bugster.auth import UserInputLoginStrategy
# Define login steps
login_instructions = [
{"action": "goto", "url": "/auth/sign-in"},
{"action": "fill", "method": "placeholder", "value": "email", "text": "{email}"},
{"action": "fill", "method": "placeholder", "value": "password", "text": "{password}"},
{"action": "click", "method": "role", "value": "button", "kwargs": {"name": "Sign In"}}
]
# Create login strategy
auth_strategy = UserInputLoginStrategy(login_instructions)
Test Dependencies
@pytest.mark.depends(on=["test_login"])
def test_dashboard(page):
# This test will only run if test_login passes
page.goto("/dashboard")
expect(page.get_by_text("Dashboard")).to_be_visible()
Trace Capture
from bugster.reporting.trace_viewer import start_trace, stop_and_save_trace
def test_with_trace(page, context):
# Start recording trace
start_trace(context)
# Test steps...
# Save trace for debugging
trace_path = stop_and_save_trace(context, "my_test")
print(f"Trace saved to: {trace_path}")
Configuration
Bugster uses a JSON configuration file for test settings:
{
"settings": {
"browser": "chromium",
"headless": true,
"viewport": {"width": 1920, "height": 1080}
},
"environment": {
"dev": {
"base_url": "https://dev.example.com",
"auth_url": "https://dev.example.com/login"
},
"prod": {
"base_url": "https://example.com",
"auth_url": "https://example.com/login"
}
},
"auth": {
"credentials": [
{
"id": "admin",
"email": "admin@example.com",
"password": "admin_password"
},
{
"id": "user",
"email": "user@example.com",
"password": "user_password"
}
],
"instructions": [
{"action": "goto", "url": "/login"},
{"action": "fill", "method": "placeholder", "value": "email", "text": "{email}"},
{"action": "fill", "method": "placeholder", "value": "password", "text": "{password}"},
{"action": "click", "method": "role", "value": "button", "kwargs": {"name": "Sign In"}}
]
}
}
Running Tests
# Run tests with specific environment
pytest --env=dev
# Specify Bugster directory for credentials and reports
pytest --bugster-dir=/path/to/bugster
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.
Metadata
Release files for bugster 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bugster-1.0.1.tar.gz | 17.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bugster-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.9 kB
Release files / bugster-1.0.1.tar.gz
| Download URL | bugster-1.0.1.tar.gz |
|---|---|
| Size | 17.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fbb2f9fe42f01fe986201ed249141cfb75917e81e4fab76c4f98a3900c850ee6
|
|
BLAKE2b-256 checksum How to use checksums |
cb14ea6edf55ee76282aa27811eec9835f5e6970c80c6f7b72a5d077be655fea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.11.8 Darwin/23.1.0
|
Release files / bugster-1.0.1-py3-none-any.whl
| Download URL | bugster-1.0.1-py3-none-any.whl |
|---|---|
| Size | 23.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fed3acac19e26ee7b940ad6a0b9044280f7cf371b5eebe675276e7b1205b458c
|
|
BLAKE2b-256 checksum How to use checksums |
684a8c8a82521210ce3a362da746311fd79056987e5b93b6e9367a710fceb5fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.11.8 Darwin/23.1.0
|