Files
AutoGPT/autogpt/tests/integration/test_web_selenium.py
Krzysztof Czerwinski 4c325724ec refactor(autogpt, forge): Remove autogpts directory (#7163)
- Moved `autogpt` and `forge` to project root
- Removed `autogpts` directory
- Moved and renamed submodule `autogpts/autogpt/tests/vcr_cassettes` to `autogpt/tests/vcr_cassettes`
- When using CLI agents will be created in `agents` directory (instead of `autogpts`)
- Renamed relevant docs, code and config references from `autogpts/[forge|autogpt]` to `[forge|autogpt]` and from `*../../*` to `*../*`
- Updated `CODEOWNERS`, GitHub Actions and Docker `*.yml` configs
- Updated symbolic links in `docs`
2024-05-22 13:08:54 +01:00

26 lines
796 B
Python

import pytest
from forge.components.web.selenium import BrowsingError, WebSeleniumComponent
from autogpt.agents.agent import Agent
@pytest.fixture
def web_selenium_component(agent: Agent):
return agent.web_selenium
@pytest.mark.vcr
@pytest.mark.requires_openai_api_key
@pytest.mark.asyncio
async def test_browse_website_nonexistent_url(
web_selenium_component: WebSeleniumComponent, cached_openai_client: None
):
url = "https://auto-gpt-thinks-this-website-does-not-exist.com"
question = "How to execute a barrel roll"
with pytest.raises(BrowsingError, match="NAME_NOT_RESOLVED") as raised:
await web_selenium_component.read_webpage(url=url, question=question)
# Sanity check that the response is not too long
assert len(raised.exconly()) < 200