Skip to content

Commit 958ebf0

Browse files
committed
test: discover a11y scan specs
1 parent 3618b16 commit 958ebf0

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

.github/workflows/a11y-scan.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,13 @@ jobs:
126126
LANGFLOW_DEACTIVATE_TRACING: "true"
127127
run: |
128128
cd src/frontend
129-
npx playwright test --grep @a11y --project=chromium --workers=1 --retries=2
129+
# Only specs that call runA11yScan produce reports; discover them
130+
# so new scan hosts are picked up without editing this workflow.
131+
SCAN_SPECS=$(grep -rl "runA11yScan(" tests --include="*.spec.ts" | sort)
132+
echo "Specs with a11y scans:"
133+
echo "$SCAN_SPECS"
134+
test -n "$SCAN_SPECS"
135+
npx playwright test $SCAN_SPECS --project=chromium --workers=1 --retries=2
130136
131137
- name: Build Aggregated A11y Summary
132138
if: always()

Makefile.frontend

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ else
7878
endif
7979

8080
test_frontend_a11y_e2e: frontend_deps_check ## run non-blocking Playwright a11y scans and reports
81-
@cd $(FRONTEND_DIR) && RUN_A11Y=true RUN_A11Y_ASSERT=false npx playwright test --grep @a11y --project=chromium --workers=1
81+
@cd $(FRONTEND_DIR) && SCAN_SPECS="$$(grep -rl "runA11yScan(" tests --include="*.spec.ts" | sort)" && echo "Specs with a11y scans:" && echo "$$SCAN_SPECS" && test -n "$$SCAN_SPECS" && RUN_A11Y=true RUN_A11Y_ASSERT=false npx playwright test $$SCAN_SPECS --project=chromium --workers=1
8282

8383
test_frontend_a11y_e2e_blocking: frontend_deps_check ## run blocking Playwright a11y scans against baselines
84-
@cd $(FRONTEND_DIR) && RUN_A11Y=true RUN_A11Y_ASSERT=true npx playwright test --grep @a11y --project=chromium --workers=1
84+
@cd $(FRONTEND_DIR) && SCAN_SPECS="$$(grep -rl "runA11yScan(" tests --include="*.spec.ts" | sort)" && echo "Specs with a11y scans:" && echo "$$SCAN_SPECS" && test -n "$$SCAN_SPECS" && RUN_A11Y=true RUN_A11Y_ASSERT=true npx playwright test $$SCAN_SPECS --project=chromium --workers=1
8585

8686
test_frontend_a11y_e2e_update: frontend_deps_check ## refresh Playwright a11y reports used as baselines
87-
@cd $(FRONTEND_DIR) && rm -rf coverage/accessibility-reports && RUN_A11Y=true RUN_A11Y_ASSERT=false npx playwright test --grep @a11y --project=chromium --workers=1
87+
@cd $(FRONTEND_DIR) && rm -rf coverage/accessibility-reports && SCAN_SPECS="$$(grep -rl "runA11yScan(" tests --include="*.spec.ts" | sort)" && echo "Specs with a11y scans:" && echo "$$SCAN_SPECS" && test -n "$$SCAN_SPECS" && RUN_A11Y=true RUN_A11Y_ASSERT=false npx playwright test $$SCAN_SPECS --project=chromium --workers=1
8888
@mkdir -p $(FRONTEND_DIR)/tests/baselines
8989
@cp $(FRONTEND_DIR)/coverage/accessibility-reports/chromium__*.json $(FRONTEND_DIR)/tests/baselines/
9090

0 commit comments

Comments
 (0)