| 36 | |
| 37 | |
| 38 | def test_scraper_enable_playwright(monkeypatch): |
| 39 | io = DummyIO() |
| 40 | # Simulate that playwright is available and should be used |
| 41 | scraper = Scraper(print_error=io.tool_error, playwright_available=True) |
| 42 | # Patch scrape_with_playwright to check it is called |
| 43 | called = {} |
| 44 | |
| 45 | def fake_playwright(url): |
| 46 | called["called"] = True |
| 47 | return "<html>hi</html>", "text/html" |
| 48 | |
| 49 | scraper.scrape_with_playwright = fake_playwright |
| 50 | content = scraper.scrape("http://example.com") |
| 51 | assert content.startswith("hi") or "<html>" in content |
| 52 | assert called["called"] |
| 53 | |
| 54 | |
| 55 | def test_commands_web_disable_playwright(monkeypatch): |