Skip to content

[SDK-7898] Support WebdriverIO 10 in Accessibility Automation - #278

Open
Dalwin-Barnard wants to merge 12 commits into
mainfrom
SDK-7898_wdio_v10_compat
Open

Dalwin-Barnard wants to merge 12 commits into
mainfrom
SDK-7898_wdio_v10_compat

Conversation

@Dalwin-Barnard

@Dalwin-Barnard Dalwin-Barnard commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

What is this about?

Makes main the WebdriverIO 10 line and ships it as 10.0.0 (major). 9.x now lives on the v9 branch and 8.x on v8, so main drops the v8/v9 compatibility code and targets WebdriverIO 10 only. Current main is merged in.

WebdriverIO 10 removed browser.executeAsync and the boolean third argument of overwriteCommand (v10 migration guide). On a v10 project every accessibility scan failed with browser.executeAsync is not a function, and every per-command wrap was silently skipped.

  • accessibilityModule.ts: the scan, save-results, results and summary scripts (desktop and mobile) all run through executeAccessibilityScript, which wraps the callback-style scripts in a promise and runs them with execute.
  • util.ts: overwriteScanCommand registers per-command wraps with v10's { attachToElement } option. It refuses element overrides for commands v10 removed (touchAction): v10 validates those only when the first element is created, so the error would otherwise surface inside the user's test. Used by the CLI module and the legacy accessibility handler.
  • service.ts: the BiDi browserstack_executor routing patch overwrites execute only; there is no executeAsync to patch.
  • v10 renames: isMultiremote → isMultiRemote, Capabilities.RequestedMultiremoteCapabilities → RequestedMultiRemoteCapabilities (service.ts, util.ts, launcher.ts, accessibility-handler.ts, custom-tags-handler.ts, Percy/PercyHelper.ts).
  • package.json: webdriverio, @wdio/types, @wdio/logger, @wdio/reporter, @wdio/globals → ^10.0.0; the @wdio/cli peer range adds ^10.0.0 and keeps the older majors; engines.node → >=22.19.0 (WebdriverIO 10's floor). Root engines, .nvmrc and the CI matrix (Node 22, 24) follow.
  • .changeset/pr-278.md: hand-written major changeset with the upgrade notes; the PR has skip-changeset so the generator doesn't replace it.

Blocked on Percy: @percy/webdriverio (latest 3.3.4) declares peer webdriverio ~6 || ~7 || ~8 || ~9, so npm ci (here and in any WebdriverIO 10 project) stops with ERESOLVE until Percy releases WebdriverIO 10 support (percy/percy-webdriverio#1498, #1517). CI's install step fails until then; this PR doesn't merge or release before that.

Validation (v10-only version, Node 22.23.2, installed locally with legacy-peer-deps for the Percy peer only):

  • npm run build and npm run lint pass.
  • vitest: 1401 pass, 76 fail. The 76 are the same tests that fail on a clean main checkout on the same machine (network-dependent), so none come from this change.
  • Still to run: BStackAutomation WDIO regression on --wdio_versions v10 (all products, including App Accessibility, whose scans now use execute).

Earlier validation (v9/v10-compatible version of this PR, before the rework):

  • vitest: 61 files / 1388 tests pass, lint clean.
  • Service built and npm linked into the BStackAutomation automate/wdio_cucumber sample on webdriverio 10.0.2 / @wdio/local-runner 10.0.2: launcher and workers load the service and reach the hub.
  • BStackAutomation tests/a11y/wdio_mocha/wdio_mocha_wrapper/test_a11y_wdio_mocha_wrapper_default.py on --wdio_versions v10 --agent_install True --branch_name SDK-7898_wdio_v10_compat (final branch): 12/12 pass (0/12 in regression build WDIO SDK-QA Automation #47). Accessibility build created, WCAG / needs-review / framework / scanner-version assertions green, both sessions passed, and the text-log check sees the click-triggered scan. Against the first commit alone it was 11/12, the missing click scan is what led to overwriteCommandCompat.
  • Direct rerun of the chrome wdio_mocha a11y sample with the rebuilt service linked: spec passed, service log shows Accessibility scan performed after url command and ... after click command, Automate text log shows scan requests with method: url, method: click and the end-of-test scan, plus save-results success.

Related Jira task/s

https://browserstack.atlassian.net/browse/SDK-7898

Release (mandatory for every PR — required for the ready-for-review label)

Version bump: (required — tick exactly one)

  • minor (backwards-compatible feature) (the release is major via .changeset/pr-278.md; the template only offers minor/patch)
  • patch (bug fix or other small change)

Release notes type: (optional)

  • New Feature
  • Bug Fix
  • Other Improvement

Release notes (customer-facing): (optional but encouraged)

  • @wdio/browserstack-service 10.0.0 supports WebdriverIO 10, including Accessibility Automation with per-command auto-scans. It requires WebdriverIO 10 and Node.js 22.19 or later. WebdriverIO 9 projects stay on 9.x (@wdio/browserstack-service@v9), WebdriverIO 8 projects on 8.x (@v8).

Release notes (internal): (required — engineer-facing; what actually changed / why)

  • main is WebdriverIO 10 only: no v8/v9 compatibility paths. All accessibility scripts run via executeAccessibilityScript (execute); per-command wraps use overwriteScanCommand ({ attachToElement }, skips v10-removed touchAction); the BiDi patch no longer overwrites executeAsync; isMultiRemote / RequestedMultiRemoteCapabilities renames.
  • Dependencies move to ^10.0.0; the @wdio/cli peer range adds ^10.0.0; Node floor >=22.19.0; CI on Node 22/24.
  • Major release through the hand-written changeset (skip-changeset label). Blocked on a Percy release with WebdriverIO 10 support.

Checklist

  • Ready to review
  • Has it been tested locally? (unit tests + build; v10 regression pending)

PR Validations

Run Tests: Comment RUN_TESTS to trigger sanity tests.

🤖 Generated with Claude Code

“Dalwin and others added 2 commits October 9, 2026 21:35
webdriverio 10 removed browser.executeAsync, so the CLI accessibility
scan, save-results, results and summary calls now go through the
existing executeAccessibilityScript helper, which runs the same
callback-style scripts via execute. The BiDi executor patch skips the
executeAsync overwrite when the command does not exist, and the service
accepts @wdio/cli ^10 as a peer.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…O 10

webdriverio 10 rejects the boolean third argument of overwriteCommand,
so every command wrap was skipped and only the end-of-test scan ran.
overwriteCommandCompat retries with the options object the new API
expects, and refuses element overrides for commands v10 removed, since
v10 validates those only when the first element is created.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto (fallback from Default branch)
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML (base), Organization UI (inherited), Workspace UI (inherited); Enforced overrides: Organization
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 1c715e6b-fe12-404e-ae34-20f99f74278d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@plum117

plum117 commented Oct 13, 2026

Copy link
Copy Markdown

FYI: #270

Comment on lines +2137 to +2147
try {
return overwrite(name, fn, attachToElement)
} catch (err) {
if (!String(err).includes('removed in WebdriverIO v10')) {
throw err
}
if (attachToElement && WDIO_V10_REMOVED_ELEMENT_COMMANDS.has(name)) {
throw new Error(`overwriteCommand: no command to be overwritten: ${name}`)
}
return overwrite(name, fn, { attachToElement })
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v10 is detected only by wdio error text, so if a 10.x release rewords it, wraps fail silently at debug level and per-command scans stop again. Could we also retry when typeof browser.executeAsync !== 'function' (the same check service.ts uses), and add a test with a different error message?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, done in cc3d03e. overwriteCommandCompat now treats the failure as v10 when either the error text matches or typeof browser.executeAsync !== 'function' (same check as _routeBidiExecutorToHttp in service.ts), then retries with { attachToElement }.

Tests added in util.test.ts:

  • reworded error + no executeAsync → retries with the options object
  • v10 where the retry also fails → rethrows after two attempts
  • the existing "rethrows any other error" case now carries executeAsync so it still represents <= 9

util / service / accessibilityModule suites: 426 passed, lint clean.

…sing executeAsync too

The boolean-to-options retry was keyed only on the v10 error text, so a reworded
message in a later 10.x would make every per-command wrap fall through to the
callers' debug-level catch and silently stop auto-scans. Treat a browser without
executeAsync as v10 as well, matching the check in service.ts.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kamal-kaur04 kamal-kaur04 added the skip-changeset CI/docs/chore PRs that should not be released (skips changeset-from-pr) label Nov 10, 2026
kamal-kaur04 and others added 4 commits November 10, 2026 21:12
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@percy/webdriverio still declares peer webdriverio <= 9. Revert once the
WebdriverIO 10 regression has run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WebdriverIO 10 no longer attaches each instance to the multiremote object
by name, so getCloudProvider threw and isBidiSession always returned false.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kamal-kaur04 and others added 2 commits November 11, 2026 19:09
WebdriverIO 10's Jasmine adapter no longer passes the top-level suite
description to beforeSuite, so the suite title stayed unset and sessions
were left unnamed. Derive it from the test's fullName in that case too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kamal-kaur04

Copy link
Copy Markdown
Collaborator

⚠️ Needs human review

File Coverage
.changeset/pr-278.md ✅ All Clear
.github/workflows/ci.yml ✅ All Clear
.npmrc ✅ All Clear
.nvmrc ✅ All Clear
package.json ✅ All Clear
packages/browserstack-service/package.json ✅ All Clear
packages/browserstack-service/src/Percy/PercyHelper.ts ✅ All Clear
packages/browserstack-service/src/accessibility-handler.ts ✅ All Clear
packages/browserstack-service/src/cli/modules/accessibilityModule.ts ✅ All Clear
packages/browserstack-service/src/cli/modules/uploadAttachmentModule.ts ✅ All Clear
packages/browserstack-service/src/constants.ts ✅ All Clear
packages/browserstack-service/src/custom-tags-handler.ts ✅ All Clear
packages/browserstack-service/src/launcher.ts ✅ All Clear
packages/browserstack-service/src/service.ts ✅ All Clear
packages/browserstack-service/src/util.ts ✅ All Clear
packages/browserstack-service/tests/Percy-Handler.test.ts ✅ All Clear
packages/browserstack-service/tests/PercyHelper.test.ts ✅ All Clear
packages/browserstack-service/tests/accessibility-handler.test.ts ✅ All Clear
packages/browserstack-service/tests/cli/modules/accessibilityModule.test.ts ✅ All Clear
packages/browserstack-service/tests/insights-handler.test.ts ✅ All Clear
packages/browserstack-service/tests/service.test.ts ✅ All Clear
packages/browserstack-service/tests/util.test.ts ✅ All Clear

No findings in the reviewed source and test files. The package-lock.json hunks in this PR were not individually reviewed (generated lockfile, ~200 regions), so a reviewer should confirm the lockfile change matches the intended dependency bumps.

Process integrity

The review gate could NOT certify this run — the verdict is held at ⚠️ pending regardless of findings:

  • G3 — cross-cutting: no full read receipt for sdk-diff.md

Change map (generated deterministically from the diff)

graph LR
  subgraph nwdio_service["wdio-service"]
    npackages_browserstack_service_src_service_ts["service.ts<br/>~47 lines"]
    npackages_browserstack_service_tests_service_test_ts["service.test.ts<br/>~47 lines"]
    npackages_browserstack_service_src_cli_modules_accessibilityModule_ts["accessibilityModule.ts<br/>~42 lines"]
    npackages_browserstack_service_tests_cli_modules_accessibilityModule_test_ts["accessibilityModule.test.ts<br/>~42 lines"]
    npackages_browserstack_service_src_util_ts["util.ts<br/>~34 lines"]
    npackages_browserstack_service_tests_util_test_ts["util.test.ts<br/>~34 lines"]
    npackages_browserstack_service_package_json["package.json<br/>~22 lines"]
    npackages_browserstack_service_src_accessibility_handler_ts["accessibility-handler.ts<br/>~10 lines"]
    npackages_browserstack_service_tests_accessibility_handler_test_ts["accessibility-handler.test.ts<br/>~10 lines"]
    npackages_browserstack_service_src_launcher_ts["launcher.ts<br/>~8 lines"]
    n_npmrc[".npmrc<br/>~7 lines"]
    n_changeset_pr_278_md["pr-278.md<br/>~6 lines"]
    npackages_browserstack_service_src_constants_ts["constants.ts<br/>~4 lines"]
    n_github_workflows_ci_yml["ci.yml<br/>~2 lines"]
    n_nvmrc[".nvmrc<br/>~2 lines"]
    npackage_json["package.json<br/>~2 lines"]
    npackages_browserstack_service_src_Percy_PercyHelper_ts["PercyHelper.ts<br/>~2 lines"]
    npackages_browserstack_service_src_cli_modules_uploadAttachmentModule_ts["uploadAttachmentModule.ts<br/>~2 lines"]
    npackages_browserstack_service_src_custom_tags_handler_ts["custom-tags-handler.ts<br/>~2 lines"]
    npackages_browserstack_service_tests_Percy_Handler_test_ts["Percy-Handler.test.ts<br/>~2 lines"]
    npackages_browserstack_service_tests_PercyHelper_test_ts["PercyHelper.test.ts<br/>~2 lines"]
    npackages_browserstack_service_tests_insights_handler_test_ts["insights-handler.test.ts<br/>~2 lines"]
  end
Loading

↻ 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changeset CI/docs/chore PRs that should not be released (skips changeset-from-pr)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants