Skip to content

Commit 5dca7e8

Browse files
update tests
1 parent 86005ca commit 5dca7e8

File tree

4 files changed

+28
-14
lines changed

4 files changed

+28
-14
lines changed

.github/workflows/test.yml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ jobs:
106106
107107
- name: Run local integration tests
108108
run: |
109-
# Run integration tests marked as 'local' and not 'slow'
109+
# Run integration tests marked as 'integration' and 'local'
110110
xvfb-run -a pytest tests/integration/ -v \
111111
--cov=stagehand \
112112
--cov-report=xml \
113113
--junit-xml=junit-integration-local.xml \
114-
-m "local and not slow" \
114+
-m "integration and local" \
115115
--tb=short \
116116
--maxfail=5
117117
env:
@@ -190,14 +190,14 @@ jobs:
190190
name: integration-test-results-slow
191191
path: junit-integration-slow.xml
192192

193-
test-browserbase:
194-
name: Browserbase Integration Tests
193+
test-integration-api:
194+
name: API Integration Tests
195195
runs-on: ubuntu-latest
196196
needs: test-unit
197197
if: |
198198
github.event_name == 'schedule' ||
199-
contains(github.event.pull_request.labels.*.name, 'test-browserbase') ||
200-
contains(github.event.pull_request.labels.*.name, 'browserbase')
199+
contains(github.event.pull_request.labels.*.name, 'test-api') ||
200+
contains(github.event.pull_request.labels.*.name, 'api')
201201
202202
steps:
203203
- uses: actions/checkout@v4
@@ -215,26 +215,26 @@ jobs:
215215
# Install temporary Google GenAI wheel
216216
pip install temp/google_genai-1.14.0-py3-none-any.whl
217217
218-
- name: Run Browserbase tests
218+
- name: Run API integration tests
219219
run: |
220-
pytest tests/ -v \
220+
pytest tests/integration/ -v \
221221
--cov=stagehand \
222222
--cov-report=xml \
223-
--junit-xml=junit-browserbase.xml \
224-
-m "browserbase" \
223+
--junit-xml=junit-integration-api.xml \
224+
-m "integration and api" \
225225
--tb=short
226226
env:
227227
BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }}
228228
BROWSERBASE_PROJECT_ID: ${{ secrets.BROWSERBASE_PROJECT_ID }}
229229
MODEL_API_KEY: ${{ secrets.MODEL_API_KEY }}
230230
STAGEHAND_API_URL: ${{ secrets.STAGEHAND_API_URL }}
231231

232-
- name: Upload Browserbase test results
232+
- name: Upload API integration test results
233233
uses: actions/upload-artifact@v4
234234
if: always()
235235
with:
236-
name: browserbase-test-results
237-
path: junit-browserbase.xml
236+
name: api-integration-test-results
237+
path: junit-integration-api.xml
238238

239239
test-performance:
240240
name: Performance Tests
@@ -373,6 +373,11 @@ jobs:
373373
with:
374374
python-version: "3.11"
375375

376+
- name: Install system dependencies
377+
run: |
378+
sudo apt-get update
379+
sudo apt-get install -y xvfb
380+
376381
- name: Install dependencies
377382
run: |
378383
python -m pip install --upgrade pip
@@ -381,10 +386,11 @@ jobs:
381386
# Install temporary Google GenAI wheel
382387
pip install temp/google_genai-1.14.0-py3-none-any.whl
383388
playwright install chromium
389+
playwright install-deps chromium
384390
385391
- name: Run E2E tests
386392
run: |
387-
pytest tests/ -v \
393+
xvfb-run -a pytest tests/ -v \
388394
--cov=stagehand \
389395
--cov-report=xml \
390396
--junit-xml=junit-e2e.xml \
@@ -395,6 +401,7 @@ jobs:
395401
BROWSERBASE_PROJECT_ID: ${{ secrets.BROWSERBASE_PROJECT_ID || 'mock-project-id' }}
396402
MODEL_API_KEY: ${{ secrets.MODEL_API_KEY || 'mock-model-key' }}
397403
STAGEHAND_API_URL: ${{ secrets.STAGEHAND_API_URL || 'http://localhost:3000' }}
404+
DISPLAY: ":99"
398405

399406
- name: Upload E2E test results
400407
uses: actions/upload-artifact@v4

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ markers =
99
unit: marks tests as unit tests
1010
integration: marks tests as integration tests
1111
smoke: marks tests as smoke tests
12+
local: marks tests as local integration tests
13+
api: marks tests as API integration tests
14+
e2e: marks tests as end-to-end tests
1215

1316
log_cli = true
1417
log_cli_level = INFO

tests/integration/api/test_core_api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ async def stagehand_api():
3030

3131

3232
@skip_if_no_creds
33+
@pytest.mark.integration
34+
@pytest.mark.api
3335
@pytest.mark.asyncio
3436
async def test_stagehand_api_initialization(stagehand_api):
3537
"""Ensure that Stagehand initializes correctly against the Browserbase API."""

tests/integration/local/test_core_local.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ async def stagehand_local():
1414
await sh.close()
1515

1616

17+
@pytest.mark.integration
18+
@pytest.mark.local
1719
@pytest.mark.asyncio
1820
async def test_stagehand_local_initialization(stagehand_local):
1921
"""Ensure that Stagehand initializes correctly in LOCAL mode."""

0 commit comments

Comments
 (0)