Test that alazy_load correctly yields Document objects when using selenium backend.
(monkeypatch)
| 1210 | |
| 1211 | @pytest.mark.asyncio |
| 1212 | async def test_alazy_load_selenium_backend(monkeypatch): |
| 1213 | """Test that alazy_load correctly yields Document objects when using selenium backend.""" |
| 1214 | urls = ["http://example.com", "http://selenium.com"] |
| 1215 | loader = ChromiumLoader(urls, backend="selenium") |
| 1216 | |
| 1217 | async def dummy_selenium(url): |
| 1218 | return f"<html>dummy selenium backend content for {url}</html>" |
| 1219 | |
| 1220 | monkeypatch.setattr(loader, "ascrape_undetected_chromedriver", dummy_selenium) |
| 1221 | docs = [doc async for doc in loader.alazy_load()] |
| 1222 | for doc, url in zip(docs, urls): |
| 1223 | assert f"dummy selenium backend content for {url}" in doc.page_content |
| 1224 | assert doc.metadata["source"] == url |
| 1225 | |
| 1226 | |
| 1227 | @pytest.mark.asyncio |
nothing calls this directly
no test coverage detected