Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

autodetect tests for ci by looking in folder

Nick Sweeting18554e2834c4
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 74bcd8ac3..e77f038fd 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -12,6 +12,16 @@ on:
workflow_dispatch:
jobs:
+ find_tests:
+ runs-on: ubuntu-latest
+ outputs:
+ matrix: ${{ steps.set-matrix.outputs.matrix }}
+ steps:
+ - uses: actions/checkout@v4
+ - id: set-matrix
+ run: echo "::set-output name=matrix::$(ls tests/ci/*.py | jq -R -s -c 'split("\n")[:-1]')"
+ # https://code.dblock.org/2021/09/03/generating-task-matrix-by-looping-over-repo-files-with-github-actions.html
+
tests:
name: ${{matrix.test}}
runs-on: ubuntu-latest
@@ -19,7 +29,14 @@ jobs:
IN_DOCKER: 'True'
strategy:
matrix:
- test:
+ test: ${{ fromJson(needs.find_tests.outputs.matrix) }}
+ # should be working in matrix ^
+ # - test_browser
+ # - test_controller
+ # - test_browser_session
+ # - test_tab_management
+ # - test_sensitive_data
+ # - test_url_allowlist_security
# TODO:
# - browser/patchright
# - browser/playwright
@@ -42,12 +59,6 @@ jobs:
# - functionality/memory
# - functionality/planner
# - functionality/hooks
- - test_browser
- - test_controller
- - test_browser_session
- - test_tab_management
- - test_sensitive_data
- - test_url_allowlist_security
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
diff --git a/tests/test_browser.py b/tests/ci/test_browser.py
similarity index 100%
rename from tests/test_browser.py
rename to tests/ci/test_browser.py
diff --git a/tests/test_browser_session.py b/tests/ci/test_browser_session.py
similarity index 100%
rename from tests/test_browser_session.py
rename to tests/ci/test_browser_session.py
diff --git a/tests/test_controller.py b/tests/ci/test_controller.py
similarity index 100%
rename from tests/test_controller.py
rename to tests/ci/test_controller.py
diff --git a/tests/test_sensitive_data.py b/tests/ci/test_sensitive_data.py
similarity index 100%
rename from tests/test_sensitive_data.py
rename to tests/ci/test_sensitive_data.py
diff --git a/tests/test_tab_management.py b/tests/ci/test_tab_management.py
similarity index 100%
rename from tests/test_tab_management.py
rename to tests/ci/test_tab_management.py
diff --git a/tests/test_url_allowlist_security.py b/tests/ci/test_url_allowlist_security.py
similarity index 100%
rename from tests/test_url_allowlist_security.py
rename to tests/ci/test_url_allowlist_security.py