Repository navigation
fix(cli): send the per-test accessibility verdict on test events (v8) - #361
kamal-kaur04 wants to merge 5 commits into
Conversation
On the CLI flow the binary set product_map.accessibility from the platform check alone, so every test in a tag-scoped build was reported as an accessibility test. The accessibility module now sets test_accessibility (accessibility on, auto-scanning on, test in the include/exclude tag scope), matching the classic flow's setTestRunAccessibilityVar. Its TEST/PRE observer is prepended so the value is on the instance before TestRunStarted is sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
RUN_TESTS |
|
[SDK Wdio Test] TRA build state: failed | Stability 97% — verdict: success. Passed: 56, Failed: 2, Aggregate: 58. TRA: https://observability.browserstack.com/builds/fbahwjmcktja2ts1fgwjefn2tazv0canfi7lpyqa |
Scenarios abandoned by a failed BeforeAll are built straight into TEST/POST, so the TEST/PRE verdict never ran for them and the binary fell back to its platform check. They never ran or scanned, so they now carry test_accessibility: false. A failure to set the verdict is logged at error level. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With autoScanning off, tests scanned manually with performScan() still need their accessibility test row, so test_accessibility is now accessibility on and test in the include/exclude tag scope. Auto-scanning still gates the automatic scans. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
✅ Good to go
Change map (generated deterministically from the diff)graph LR
subgraph nwdio_service["wdio-service"]
npackages_browserstack_service_src_cli_modules_accessibilityModule_ts["accessibilityModule.ts<br/>~40 lines"]
npackages_browserstack_service_tests_cli_modules_accessibilityModule_test_ts["accessibilityModule.test.ts<br/>~40 lines"]
npackages_browserstack_service_src_cli_eventDispatcher_ts["⚠ eventDispatcher.ts<br/>~9 lines"]
npackages_browserstack_service_src_cli_frameworks_testFramework_ts["testFramework.ts<br/>~9 lines"]
npackages_browserstack_service_tests_cli_frameworks_testFramework_test_ts["testFramework.test.ts<br/>~9 lines"]
n_changeset_pr_361_md["pr-361.md<br/>~5 lines"]
npackages_browserstack_service_src_cli_frameworks_constants_testFrameworkConstants_ts["testFrameworkConstants.ts<br/>~1 lines"]
npackages_browserstack_service_src_cli_frameworks_wdioCucumberTestFramework_ts["wdioCucumberTestFramework.ts<br/>~1 lines"]
npackages_browserstack_service_tests_cli_frameworks_wdioCucumberTestFramework_test_ts["wdioCucumberTestFramework.test.ts<br/>~1 lines"]
end
↻ This verdict comment is the review anchor — it's updated in place on each run (the gate posts its status separately). — SDK PR Review Agent |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🟢 SDK PR Review gate is green — the SDK PR Review Agent has run on the current head commit (verdict: This gate confirms a review ran on the latest commit. The verdict itself is advisory — read the findings and use your judgement; it does not block merge. A native GitHub reviewer approval is still separately required by branch protection before this PR can merge. |
What is this about?
On the CLI flow, every test in a build that uses
accessibilityOptions.includeTagsInTestingScope/excludeTagsInTestingScopeis reported as an accessibility test, including tests outside the tag scope. The binary sets each test'sproduct_map.accessibilityfrom the platform check alone (accessibility on + supported browser), so every test gets an accessibility test-execution record. The classic flow sends the per-test verdict (Listener.setTestRunAccessibilityVar), so only in-scope tests are recorded there.This PR sends that verdict on the CLI flow:
AccessibilityModule.setTestAccessibilitysetstest_accessibilityon the test instance: accessibility on and the test in the tag scope (sameshouldScanTestForAccessibilitycall the scan gate makes, so cucumber uses the gherkin tags and mocha the title match). Auto-scanning is deliberately left out, so tests scanned manually withperformScan()keep their accessibility row; it still gates the automatic scans.BeforeAllfailed are built straight into TEST/POST and never pass TEST/PRE, so they are created withtest_accessibility: false(they never ran or scanned).prependoption (EventDispatcher.registerObserver/TestFramework.registerObserver), so it runs beforeTestHubModuleserializes TestRunStarted. Without that, TestRunStarted would still carry the platform-only value.test_accessibilitywhen it is a boolean and keeps the platform check otherwise (paired binary PR). Older binaries ignore the extra key.Effect: in a tag-scoped build, out-of-scope tests no longer get accessibility test-execution records, matching the classic flow. Scanning behaviour is unchanged.
Backport of #359 to
v8.eventDispatcher.test.tson v8 tests a local copy of the dispatcher, not the real class, so the prepend-ordering test is not carried here; the accessibility-module tests are.Related Jira task/s
N/A (tracked internally)
Release (mandatory for every PR — required for the
ready-for-reviewlabel)Version bump: (required — tick exactly one)
Release notes type: (optional)
Release notes (customer-facing): (optional but encouraged)
includeTagsInTestingScope/excludeTagsInTestingScopebeing reported as accessibility tests when using the CLI.Release notes (internal): (required — engineer-facing; what actually changed / why)
test_accessibilityverdict (a11y on and test in tag scope; auto-scanning excluded so manual-scan tests keep their row) on test events, set by a TEST/PRE observer prepended ahead of TestHubModule so TestRunStarted carries it; cucumber cascade-skipped scenarios send false. Restores tag scoping for product_map.accessibility; requires the paired binary change to take effect.Checklist
Unit tests:
accessibilityModule.test.tscovers the verdict (in scope / out of scope / auto-scanning off keeps an in-scope test / platform unsupported / mocha title match) and cascade-skipped scenarios carryingfalse, plus the prepended registration.eventDispatcher.test.tscovers prepend ordering (main and v9 only).tsc --noEmitis clean.End to end (WDIO 9 + cucumber, Chrome latest / Windows 11,
includeTagsInTestingScope: ['@accessibility'], CLI flow; 1 tagged scenario + 2 untagged),product_map.accessibilityon TestRunStarted / TestRunFinished:PR Validations
Run Tests: Comment RUN_TESTS to trigger sanity tests.