bowser/tests
2026-01-12 16:05:14 +01:00
..
__init__.py Initial bowser project scaffold 2026-01-09 12:20:46 +01:00
conftest.py Add comprehensive test suite with pytest 2026-01-09 13:37:21 +01:00
README.md Add comprehensive test suite with pytest 2026-01-09 13:37:21 +01:00
test_browser.py Enhance font handling and layout rendering by supporting font-family in layout lines, improving CSS rule parsing for multi-selectors, and updating start page styles to include emoji support. 2026-01-12 16:05:14 +01:00
test_cookies.py Refactor test files to remove unnecessary imports and improve readability 2026-01-12 10:22:34 +01:00
test_css.py Implement CSS parsing, selector matching, and style resolution 2026-01-12 11:41:18 +01:00
test_dom_graph.py Refactor test files to remove unnecessary imports and improve readability 2026-01-12 10:22:34 +01:00
test_dom_graph_page.py Refactor test files to remove unnecessary imports and improve readability 2026-01-12 10:22:34 +01:00
test_frame.py Implement CSS parsing, selector matching, and style resolution 2026-01-12 11:41:18 +01:00
test_html_parsing.py Implement CSS parsing, selector matching, and style resolution 2026-01-12 11:41:18 +01:00
test_http.py Refactor test files to remove unnecessary imports and improve readability 2026-01-12 10:22:34 +01:00
test_layout.py Implement CSS parsing, selector matching, and style resolution 2026-01-12 11:41:18 +01:00
test_parser.py Refactor test files to remove unnecessary imports and improve readability 2026-01-12 10:22:34 +01:00
test_render.py Refactor test files to remove unnecessary imports and improve readability 2026-01-12 10:22:34 +01:00
test_styling_integration.py Implement CSS parsing, selector matching, and style resolution 2026-01-12 11:41:18 +01:00
test_templates.py Refactor test files to remove unnecessary imports and improve readability 2026-01-12 10:22:34 +01:00
test_url.py Refactor test files to remove unnecessary imports and improve readability 2026-01-12 10:22:34 +01:00
test_url_normalization.py Refactor test files to remove unnecessary imports and improve readability 2026-01-12 10:22:34 +01:00

Bowser Test Suite

This directory contains the test suite for the Bowser browser.

Running Tests

Run all tests:

uv run pytest

Run with verbose output:

uv run pytest -v

Run specific test file:

uv run pytest tests/test_browser.py

Run with coverage:

uv run pytest --cov=src --cov-report=html

View coverage report:

open htmlcov/index.html

Test Organization

  • test_url.py - URL parsing and resolution
  • test_parser.py - HTML/CSS parsing
  • test_browser.py - Browser and tab management
  • test_cookies.py - Cookie jar functionality
  • test_layout.py - Layout engine components
  • test_render.py - Rendering primitives
  • conftest.py - Shared fixtures and configuration

Writing Tests

Tests use pytest. Example:

def test_feature():
    # Arrange
    obj = MyClass()
    
    # Act
    result = obj.method()
    
    # Assert
    assert result == expected

Use mocks for GTK components:

@patch('src.browser.browser.Gtk')
def test_with_gtk(mock_gtk):
    browser = Browser()
    # test code