"""Quick test: verify institutional cookie inheritance via Playwright."""

from src.browser_fetcher import BrowserSession, DomainRateLimiter, fetch_publisher_page

rate_limiter = DomainRateLimiter(min_delay=3.0)

with BrowserSession(headless=False) as ctx:
    page = ctx.new_page()
    result = fetch_publisher_page(page, "10.1056/NEJMoa2206038", rate_limiter)
    if result:
        print(f"Final URL: {result['url']}")
        print(f"Domain: {result['domain']}")
        print(f"HTML length: {len(result['html'])} chars")
        print(f"Status: {result['status']}")
    else:
        print("Navigation failed - check error logs")
