From 125ba830f76b55219f139daeee486580de7a2298 Mon Sep 17 00:00:00 2001 From: Alan Buscaglia Date: Wed, 11 Mar 2026 15:38:18 +0100 Subject: [PATCH] fix(ci): prevent E2E auth setups from running on broad path matches (#10304) --- .github/test-impact.yml | 60 ++++++++++++++++++++++++--- .github/workflows/ui-e2e-tests-v2.yml | 14 +++++++ 2 files changed, 68 insertions(+), 6 deletions(-) diff --git a/.github/test-impact.yml b/.github/test-impact.yml index 7322fb61a7..3fab82c80b 100644 --- a/.github/test-impact.yml +++ b/.github/test-impact.yml @@ -224,8 +224,24 @@ modules: tests: - api/src/backend/api/tests/test_views.py e2e: - # API view changes can break UI - - ui/tests/** + # All E2E test suites (explicit to avoid triggering auth setups in tests/setups/) + - ui/tests/auth/** + - ui/tests/sign-in/** + - ui/tests/sign-up/** + - ui/tests/sign-in-base/** + - ui/tests/scans/** + - ui/tests/providers/** + - ui/tests/findings/** + - ui/tests/compliance/** + - ui/tests/invitations/** + - ui/tests/roles/** + - ui/tests/users/** + - ui/tests/integrations/** + - ui/tests/resources/** + - ui/tests/profile/** + - ui/tests/lighthouse/** + - ui/tests/home/** + - ui/tests/attack-paths/** - name: api-serializers match: @@ -234,8 +250,24 @@ modules: tests: - api/src/backend/api/tests/** e2e: - # Serializer changes affect API responses → UI - - ui/tests/** + # All E2E test suites (explicit to avoid triggering auth setups in tests/setups/) + - ui/tests/auth/** + - ui/tests/sign-in/** + - ui/tests/sign-up/** + - ui/tests/sign-in-base/** + - ui/tests/scans/** + - ui/tests/providers/** + - ui/tests/findings/** + - ui/tests/compliance/** + - ui/tests/invitations/** + - ui/tests/roles/** + - ui/tests/users/** + - ui/tests/integrations/** + - ui/tests/resources/** + - ui/tests/profile/** + - ui/tests/lighthouse/** + - ui/tests/home/** + - ui/tests/attack-paths/** - name: api-filters match: @@ -407,8 +439,24 @@ modules: - ui/components/ui/** tests: [] e2e: - # Shared components can affect any E2E - - ui/tests/** + # All E2E test suites (explicit to avoid triggering auth setups in tests/setups/) + - ui/tests/auth/** + - ui/tests/sign-in/** + - ui/tests/sign-up/** + - ui/tests/sign-in-base/** + - ui/tests/scans/** + - ui/tests/providers/** + - ui/tests/findings/** + - ui/tests/compliance/** + - ui/tests/invitations/** + - ui/tests/roles/** + - ui/tests/users/** + - ui/tests/integrations/** + - ui/tests/resources/** + - ui/tests/profile/** + - ui/tests/lighthouse/** + - ui/tests/home/** + - ui/tests/attack-paths/** - name: ui-attack-paths match: diff --git a/.github/workflows/ui-e2e-tests-v2.yml b/.github/workflows/ui-e2e-tests-v2.yml index 0e8a146b26..66e78db455 100644 --- a/.github/workflows/ui-e2e-tests-v2.yml +++ b/.github/workflows/ui-e2e-tests-v2.yml @@ -214,6 +214,20 @@ jobs: TEST_PATHS=$(echo "$TEST_PATHS" | sed 's|ui/||g' | sed 's|\*\*||g' | tr ' ' '\n' | sort -u) # Drop auth setup helpers (not runnable test suites) TEST_PATHS=$(echo "$TEST_PATHS" | grep -v '^tests/setups/') + # Safety net: if bare "tests/" appears (from broad patterns like ui/tests/**), + # expand to specific subdirs to avoid Playwright discovering setup files + if echo "$TEST_PATHS" | grep -qx 'tests/'; then + echo "Expanding bare 'tests/' to specific subdirs (excluding setups)..." + SPECIFIC_DIRS="" + for dir in tests/*/; do + [[ "$dir" == "tests/setups/" ]] && continue + SPECIFIC_DIRS="${SPECIFIC_DIRS}${dir}"$'\n' + done + # Replace "tests/" with specific dirs, keep other paths + TEST_PATHS=$(echo "$TEST_PATHS" | grep -vx 'tests/') + TEST_PATHS="${TEST_PATHS}"$'\n'"${SPECIFIC_DIRS}" + TEST_PATHS=$(echo "$TEST_PATHS" | grep -v '^$' | sort -u) + fi if [[ -z "$TEST_PATHS" ]]; then echo "No runnable E2E test paths after filtering setups" exit 0