Skip to content

Commit 1c3553b

Browse files
skip api tests if no api url provided
1 parent 2116962 commit 1c3553b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tests/integration/api/test_core_api.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def browserbase_config(self):
3333
@pytest_asyncio.fixture
3434
async def stagehand_api(self, browserbase_config):
3535
"""Create a Stagehand instance for BROWSERBASE API testing"""
36-
if not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID")):
37-
pytest.skip("Browserbase credentials not available")
36+
if not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID") and os.getenv("STAGEHAND_URL_API")):
37+
pytest.skip("Browserbase credentials and API URL not available")
3838

3939
stagehand = Stagehand(config=browserbase_config)
4040
await stagehand.init()
@@ -45,8 +45,8 @@ async def stagehand_api(self, browserbase_config):
4545
@pytest.mark.integration
4646
@pytest.mark.api
4747
@pytest.mark.skipif(
48-
not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID")),
49-
reason="Browserbase credentials are not available for API integration tests",
48+
not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID") and os.getenv("STAGEHAND_URL_API")),
49+
reason="Browserbase credentials and API URL are not available for API integration tests",
5050
)
5151
async def test_stagehand_api_initialization(self, stagehand_api):
5252
"""Ensure that Stagehand initializes correctly against the Browserbase API."""
@@ -56,8 +56,8 @@ async def test_stagehand_api_initialization(self, stagehand_api):
5656
@pytest.mark.integration
5757
@pytest.mark.api
5858
@pytest.mark.skipif(
59-
not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID")),
60-
reason="Browserbase credentials are not available for API integration tests",
59+
not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID") and os.getenv("STAGEHAND_URL_API")),
60+
reason="Browserbase credentials and API URL are not available for API integration tests",
6161
)
6262
async def test_api_observe_and_act_workflow(self, stagehand_api):
6363
"""Test core observe and act workflow in API mode - replicated from local tests."""
@@ -97,8 +97,8 @@ async def test_api_observe_and_act_workflow(self, stagehand_api):
9797
@pytest.mark.integration
9898
@pytest.mark.api
9999
@pytest.mark.skipif(
100-
not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID")),
101-
reason="Browserbase credentials are not available for API integration tests",
100+
not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID") and os.getenv("STAGEHAND_URL_API")),
101+
reason="Browserbase credentials and API URL are not available for API integration tests",
102102
)
103103
async def test_api_basic_navigation_and_observe(self, stagehand_api):
104104
"""Test basic navigation and observe functionality in API mode - replicated from local tests."""
@@ -123,8 +123,8 @@ async def test_api_basic_navigation_and_observe(self, stagehand_api):
123123
@pytest.mark.integration
124124
@pytest.mark.api
125125
@pytest.mark.skipif(
126-
not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID")),
127-
reason="Browserbase credentials are not available for API integration tests",
126+
not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID") and os.getenv("STAGEHAND_URL_API")),
127+
reason="Browserbase credentials and API URL are not available for API integration tests",
128128
)
129129
async def test_api_extraction_functionality(self, stagehand_api):
130130
"""Test extraction functionality in API mode - replicated from local tests."""

0 commit comments

Comments
 (0)