fix(wdio-browserstack-service): exclude action from a11y command wrapping (SDK-6265)#3
Closed
harshit-browserstack wants to merge 1 commit into
Closed
Conversation
…apping (SDK-6265) The accessibility command wrapper is declared async, so wrapping WebdriverIO's synchronous `browser.action()` turned its return value into a Promise — breaking `browser.action(...).move()` / `.down()`, and therefore `browser.moveTo()` and `browser.keys(Key.Tab)`, which are built on top of `action()`. With `accessibility: true` users saw "browser.action(...).move is not a function" / "keyAction.down is not a function"; the same code works with accessibility disabled. Exclude `action` (the only synchronous chainable command) from wrapping in both install sites (direct flow + CLI/gRPC flow). Already-async commands (`keys`, `actions`, `moveTo`) stay wrapped, so accessibility scan coverage is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
cbb6ed5 to
780e7a0
Compare
Owner
Author
|
Closing in favour of a backend-side fix: the A11y backend will drop the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
With
@wdio/browserstack-serviceandaccessibility: true, WebdriverIO's Actions API breaks at runtime:browser.action('pointer').move(...)→TypeError: browser.action(...).move is not a functionbrowser.keys(Key.Tab)→TypeError: keyAction.down is not a functionbrowser.moveTo()fails the same way.The identical code works with
accessibility: false. Reported by RS Components (SDK-6265 / A11Y-11325).Root cause
The accessibility command wrapper (
commandWrapper) is declaredasync, so it always returns aPromise. It is installed over every command in the server-suppliedcommandsToWraplist — which includesaction. But WebdriverIO'sbrowser.action()is synchronous: it returns a chainablePointerAction/KeyActionbuilder. Wrapping it in an async function makesbrowser.action('pointer')resolve toPromise<PointerAction>, so.move()/.down()areundefined.browser.moveTo()andbrowser.keys()are implemented on top ofaction(), so both break too. Already-async commands (keys,actions,moveTo) are unaffected.Fix
Exclude
action— the only synchronous chainable command — from a11y wrapping, in both install sites (direct flowaccessibility-handler.tsand CLI/gRPC flowaccessibilityModule.ts). Accessibility scan coverage is unchanged (already-async commands stay wrapped).Verification
@wdio/browserstack-servicewithaccessibility: true; control (accessibility: false) passes.userStatus: passed).🤖 Generated with Claude Code