fix scrolling test (#4117)

Co-authored-by: Richard Kuo <rkuo@rkuo.com>
This commit is contained in:
rkuo-danswer 2025-02-25 10:23:04 -08:00 committed by GitHub
parent 60bd9271f7
commit 4aa8eb8b75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,6 +4,10 @@ from onyx.connectors.models import Document
from onyx.connectors.web.connector import WEB_CONNECTOR_VALID_SETTINGS
from onyx.connectors.web.connector import WebConnector
EXPECTED_QUOTE = (
"If you can't explain it to a six year old, you don't understand it yourself."
)
# NOTE(rkuo): we will probably need to adjust this test to point at our own test site
# to avoid depending on a third party site
@ -11,7 +15,7 @@ from onyx.connectors.web.connector import WebConnector
def web_connector(request: pytest.FixtureRequest) -> WebConnector:
scroll_before_scraping = request.param
connector = WebConnector(
base_url="https://developer.onewelcome.com",
base_url="https://quotes.toscrape.com/scroll",
web_connector_type=WEB_CONNECTOR_VALID_SETTINGS.SINGLE.value,
scroll_before_scraping=scroll_before_scraping,
)
@ -28,7 +32,7 @@ def test_web_connector_scroll(web_connector: WebConnector) -> None:
assert len(all_docs) == 1
doc = all_docs[0]
assert "Onegini Identity Cloud" in doc.sections[0].text
assert EXPECTED_QUOTE in doc.sections[0].text
@pytest.mark.parametrize("web_connector", [False], indirect=True)
@ -41,4 +45,4 @@ def test_web_connector_no_scroll(web_connector: WebConnector) -> None:
assert len(all_docs) == 1
doc = all_docs[0]
assert "Onegini Identity Cloud" not in doc.sections[0].text
assert EXPECTED_QUOTE not in doc.sections[0].text