"""Tests for browser_renderer.py (#321). Real end-to-end tests using actual Playwright + Chromium. """ from __future__ import annotations import pytest from skill_seekers.cli.browser_renderer import ( BrowserRenderer, _auto_install_chromium, _check_playwright_available, ) # Skip all real browser tests when Playwright is not installed _has_playwright = _check_playwright_available() requires_playwright = pytest.mark.skipif( not _has_playwright, reason="Playwright not installed (pip install 'skill-seekers[browser]')", ) @requires_playwright class TestPlaywrightAvailability: """Test that playwright is properly detected.""" def test_playwright_is_available(self): assert _check_playwright_available() is True def test_auto_install_succeeds(self): # Chromium is already installed, so this should be a no-op success assert _auto_install_chromium() is True @requires_playwright class TestBrowserRendererReal: """Real end-to-end tests with actual Chromium.""" def test_render_simple_page(self): """Render a real page and get HTML back.""" with BrowserRenderer() as renderer: html = renderer.render_page("https://example.com") assert " 500 assert "