Repository navigation
fix(cli): 10.x follow-ups: end tests after TEST/POST observers, per-test a11y verdict, failed-hook tests reported as failed - #388
kamal-kaur04 wants to merge 11 commits into
Conversation
On the CLI flow, test_ended_at was stamped before the TEST/POST observers ran, so the accessibility pre-save scan and save landed after the test's finish time. Restamp ended_at once the observers have run; for cucumber, hold the TestRunFinished send until then and release it from a finally block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 7dd78e4) (cherry picked from commit 097625a) (cherry picked from commit 2ab2034)
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> (cherry picked from commit e2847bd)
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. The in-scope rule is computed by one helper for both the reported verdict and the scan gate, and a failure to set the verdict is logged at error level. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit ef1b7cc)
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> (cherry picked from commit 898a81f)
…ha fails them @wdio/mocha-framework 10 turns Mocha's failHookAffectedTests on by default, so tests behind a failed before/beforeEach hook are failed, not dropped. The hook cascade still reported them as skipped, and the reporter's later fail event for them is dropped, so Test Reporting showed skipped while CI showed failed. Report them as failed with the hook's error unless the user sets mochaOpts.failHookAffectedTests to false. afterEach failures and this.skip() hooks keep the skipped report. Applies to both the CLI cascade and the legacy insights cascade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 868b5bb)
…es one 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
|
Only the files above changed since the previous review (5c8e746) and were re-judged. The previously reported held-finish finding on Process integrityThe review gate could NOT certify this run — the verdict is held at
Change map (generated deterministically from the diff)graph LR
subgraph nwdio_service["wdio-service"]
npackages_browserstack_service_tests_cli_modules_testHubModule_deferredFinish_test_ts["⚠ testHubModule.deferredFinish.test.ts<br/>~93 lines"]
npackages_browserstack_service_src_cli_modules_testHubModule_ts["⚠ testHubModule.ts<br/>~83 lines"]
npackages_browserstack_service_src_cli_frameworks_wdioCucumberTestFramework_ts["wdioCucumberTestFramework.ts<br/>~55 lines"]
npackages_browserstack_service_tests_cli_wdioCucumberTestFramework_test_ts["wdioCucumberTestFramework.test.ts<br/>~55 lines"]
npackages_browserstack_service_src_cli_modules_accessibilityModule_ts["accessibilityModule.ts<br/>~53 lines"]
npackages_browserstack_service_tests_cli_modules_accessibilityModule_test_ts["accessibilityModule.test.ts<br/>~53 lines"]
npackages_browserstack_service_src_service_ts["service.ts<br/>~51 lines"]
npackages_browserstack_service_tests_service_test_ts["service.test.ts<br/>~51 lines"]
npackages_browserstack_service_src_cli_skipReporter_ts["skipReporter.ts<br/>~17 lines"]
npackages_browserstack_service_tests_cli_skipReporter_test_ts["skipReporter.test.ts<br/>~17 lines"]
npackages_browserstack_service_src_cli_frameworks_wdioMochaTestFramework_ts["wdioMochaTestFramework.ts<br/>~15 lines"]
npackages_browserstack_service_src_insights_handler_ts["insights-handler.ts<br/>~15 lines"]
npackages_browserstack_service_tests_cli_wdioMochaTestFramework_test_ts["wdioMochaTestFramework.test.ts<br/>~15 lines"]
npackages_browserstack_service_tests_insights_handler_test_ts["insights-handler.test.ts<br/>~15 lines"]
npackages_browserstack_service_src_cli_eventDispatcher_ts["⚠ eventDispatcher.ts<br/>~10 lines"]
npackages_browserstack_service_tests_cli_eventDispatcher_test_ts["⚠ eventDispatcher.test.ts<br/>~10 lines"]
n_changeset_pr_388_md["pr-388.md<br/>~7 lines"]
npackages_browserstack_service_src_cli_frameworks_testFramework_ts["testFramework.ts<br/>~5 lines"]
npackages_browserstack_service_src_constants_ts["constants.ts<br/>~2 lines"]
npackages_browserstack_service_src_cli_frameworks_constants_testFrameworkConstants_ts["testFrameworkConstants.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 |
…inish wait - Synthetic mocha rows (static skips, bail and failed-hook cascades) carry neverRan on TEST/PRE, so setTestAccessibility marks them as not accessibility tests, as the cucumber cascade already does. - The cucumber scenario end waits at most 5s for its held TestRunFinished; the gRPC send has no deadline, and a stalled binary must not hang the scenario's after-hook. The send itself keeps going. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Replies to the review findings: 🔴 Mocha never-run tests flagged as accessibility tests: fixed in 23cb3a1. 🟠 Held TestRunFinished on the afterTest path: fixed in 23cb3a1. Confirmed: 🟠 Prepended observer can block others / re-run during notify: not reachable. 🟠 Locally after 23cb3a1: build and lint pass, and the full suite passes (58 files / 1,520 tests). The 3 new tests fail without the fix. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reply to the new review finding: 🔴 Held TestRunFinished outlasting the release timeout is untracked at worker end ( Locally after 265384f: build and lint pass, and the full suite passes (58 files / 1,521 tests). |
|
🟢 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. |
|
RUN_TESTS |
|
[SDK Wdio Test] TRA build state: failed | Stability 83% — verdict: failure. Passed: 48, Failed: 10, Aggregate: 58. TRA: https://observability.browserstack.com/builds/l94bz4fxtm2xu8s3zxewqjyez2w0knnztofivm3y |
What is this about?
CLI-flow fixes for the 10.x line, combined into one PR. It replaces #384, #359 and #387. Two of the fixes are ports of
v9fixes that already shipped in 9.44.2 / 9.44.3; the third is new for WebdriverIO 10.1. End a test after its TEST/POST observers (port of #358, shipped in 9.44.2)
On the CLI flow, a test's
test_ended_atwas stamped before the TEST/POST observers ran. The accessibility pre-save scan and save run in those observers, so they landed after the test's reported finish. Scans attributed by the test's time window were dropped, which is most visible withincludeTagsInTestingScope.test_ended_atis restamped after the observers.TestHubModuleholdsTestRunFinishedwhile they run, and the framework releases it from afinally. The next-test / worker-end flush is the fallback.test_ended_atis restamped after the observers; the send was already deferred.51950d7,6c6591e.2. Send the per-test accessibility verdict on test events (port of #360, shipped in 9.44.3)
v9commits454f2f3,f01547band703b4d3.ff5b911,8e752b8,75d605e.3. Report tests behind a failed
before/beforeEachhook as failed (new)@wdio/mocha-framework10 turns on Mocha'sfailHookAffectedTestswhen the user leaves it unset. Mocha 12 then marks the tests behind a failedbefore/beforeEachhook as failed, but the service still reported them as skipped. Its cascade runs inside the hook wrapper, before Mocha marks the tests, and Mocha's laterfailwas dropped because the test never started.reportSuiteSkippedand the non-CLI insights handler) now reports BEFORE_ALL/BEFORE_EACH-affected tests as failed with the hook's error, unlessmochaOpts.failHookAffectedTestsisfalse.this.skip()hook, the bail cascade, Cucumber and Jasmine are unchanged.975612e.The per-fix changeset from #387 is dropped; this PR's template generates one changeset.
Verification
mainwithout conflicts.npm ci, build and lint pass, and the full package suite passes (58 files / 1,518 tests, including every fix's new tests).beforeEachthrows, with 2 tests;beforeEachfailing for a child suite,maxParallelContexts, and multiremote.mainqffjianrcxbd4nf3i2xdrulrbb1ww47qeg8ehh59cnxniqlqr4giogckdbaaygqzvymlezqazywlrqc8failHookAffectedTests: false0dwf0uec0f2i22op6vjeau14evhdddylx4r0ymatRelated Jira task/s
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.before/beforeEachhook showing as skipped in Test Reporting. They are now reported as failed with the hook's error, matching WebdriverIO 10's defaultfailHookAffectedTests.Release notes (internal): (required — engineer-facing; what actually changed / why)
v9fix(cli): end a test after its TEST/POST observers so a11y scan/save stay inside it #358 (CLItest_ended_atstamped after the TEST/POST observers; cucumberTestRunFinishedheld until they finish) and fix(cli): send the per-test accessibility verdict on test events (v9) #360 (per-test accessibility verdict on test events; cascade-skipped scenarios not accessibility tests; auto-scanning out of the verdict) to the 10.x line.mochaOpts.failHookAffectedTestsis notfalse.Checklist
PR Validations
Run Tests: Comment RUN_TESTS to trigger sanity tests.
🤖 Generated with Claude Code