[#664] Gated advisory accessibility violations out of JUnit failures.#666
Conversation
…s as JUnit failures. The renderer now gates '<failure>' output by the scenario's effective threshold, mirroring the pass/fail gate. Advisory violations (threshold 'never', e.g. '@accessibility:warning') are recorded as passing testcases carrying the finding in '<system-out>', so a passing advisory run writes a report with zero failures instead of one that reddens a JUnit-consuming CI check. The 'tests' and 'failures' counts now reflect the actual emitted '<testcase>' elements, one per affected node. Claude-Session: https://claude.ai/code/session_01JTm9W2rNMjgzxqPVD6BGFi
…ion deterministic. The two 'a file matching ... should (not) contain:' steps now delegate to one helper that sorts the glob matches before reading, so the inspected file is stable when several match. Claude-Session: https://claude.ai/code/session_01JTm9W2rNMjgzxqPVD6BGFi
…ng substrings. The renderer tests now load the output with SimpleXML and assert on '//failure' / '//testcase' counts and the 'tests' / 'failures' attributes, which also validates that the hand-built report is well-formed XML. Claude-Session: https://claude.ai/code/session_01JTm9W2rNMjgzxqPVD6BGFi
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Walkthrough
ChangesThreshold-aware JUnit rendering
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #666 +/- ##
=======================================
Coverage 96.85% 96.85%
=======================================
Files 46 46
Lines 3817 3819 +2
=======================================
+ Hits 3697 3699 +2
Misses 120 120 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Closes #664
Summary
AccessibilityTrait::accessibilityRenderJunit()wrote a<failure>for every raw violation regardless of the scenario's threshold, while the pass/fail gate filtered the same violations throughaccessibilityFilterViolations(). As a result, a@accessibility:warningscenario (thresholdnever) passed in Behat but its JUnit report still declared failures, turning JUnit-consuming CI reporters red. The renderer now consultsaccessibilityEffectiveThreshold()and gates<failure>output throughaccessibilityFilterViolations(), so advisory findings are recorded as passing<testcase>elements with the finding in<system-out>instead of a<failure>.Changes
src/AccessibilityTrait.php:accessibilityRenderJunit()resolves the scenario's effective threshold and filters each violation throughaccessibilityFilterViolations()before deciding whether it becomes a<failure>. Violations below the threshold are still emitted as<testcase>elements carrying the finding in<system-out>, keeping them visible without failing the report.testsandfailuresare now accumulated per emitted<testcase>(one per affected node) rather than derived up front fromcount($violations)andcount($passes), which also fixes a pre-existing mismatch for violations that affect multiple nodes.tests/behat/bootstrap/BehatCliContext.php: Addeda file matching :pattern should contain:andshould not contain:steps backed by a sharedassertFileMatchingContains()helper. Glob matches are sorted before the first one is inspected, so the assertion target is deterministic when several files match the pattern.tests/behat/features/accessibility.feature: Added a@trait:AccessibilityTraitscenario that runs a nested@accessibility:warningBehat scenario and asserts the generated JUnit report hasfailures="0", contains no<failure>element, and still contains a<system-out>entry for the advisory finding.tests/phpunit/src/AccessibilityTraitTest.php: Added coverage foraccessibilityRenderJunit()across thresholds (never/any/critical/serious/moderate), parsed withSimpleXMLrather than substring matching, plus a dedicated test for per-node failure counting and one confirming advisory findings surface in<system-out>without a<failure>.Before / After
I’m checking the repo’s contribution rules first so I can flag any step-definition issues accurately in the summary, especially since you asked for Critical marking on violations.