Repository navigation
feat: support WebdriverIO 10 and keep WebdriverIO 9 support - #270
Open
dprevost-LMI wants to merge 10 commits into
Open
dprevost-LMI wants to merge 10 commits into
dprevost-LMI wants to merge 10 commits into
Conversation
- Detect multiremote with isMultiRemote (v10) or isMultiremote (v9), and
get each instance with getInstance().
- Pass { attachToElement: true } to overwriteCommand, which works in v9
and v10.
- Run the CLI accessibility scripts with execute(), because v10 removed
executeAsync(). Patch executeAsync for BiDi executor routing only on v9.
- On WebdriverIO 10, set bstack:options.appiumVersion to 3.3.0 for App
Automate capabilities that do not set a version. App Automate uses
Appium 1.22.0 by default, and WebdriverIO 10 supports Appium 3 only.
Read the major version from @wdio/cli, because webdriverio can resolve
to the v9 copy that @percy/webdriverio installs.
- Use WebdriverIO 10 dev dependencies. Override the @percy/webdriverio
peer range in the private root package until Percy supports v10.
- Test WebdriverIO 10 on Node.js 24 and WebdriverIO 9 on Node.js 22 in CI,
with a check of the installed major version.
- Add a changeset and a README compatibility table.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WebdriverIO 10 does not store multiremote instances as properties of the browser object. getCloudProvider() read browser[instanceName], so it threw a TypeError for every multiremote session, first in the service before hook. AccessibilityHandler.isBidiSession() read the same properties and always returned false for multiremote. Both now use getInstance(), which works in WebdriverIO 9 and 10. The test fixtures use the v10 object shape, without instance properties. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mocha 12 (WebdriverIO 10) fails the tests that a failed before or beforeEach hook skipped (mochaOpts.failHookAffectedTests, true by default). The service reported them as skipped, so the dashboard and WebdriverIO did not agree. When the option is not false on WebdriverIO 10, the service now reports these tests as failed, with the Mocha 12 message "Test skipped due to failure in hook ...", on the legacy path (InsightsHandler.afterHook) and on the CLI path (reportSuiteFailed). WebdriverIO 9, afterEach failures and failHookAffectedTests: false keep the skipped status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- setDefaultAppiumVersion() added bstack:options to capabilities in the
legacy format (no x:y key). WebdriverIO rejects a capability that mixes
extension keys with legacy keys, so the session did not start. These
capabilities now get browserstack.appium_version.
- The CLI accessibility commandWrapper caught the error of the original
command, logged it as its own error, and ran the command again. In
WebdriverIO 10, every StrictSelectorError went through this path. The
command now runs once, outside the try, and its error goes to the
caller. A failed scan setup still logs and lets the command run.
- WebdriverIO 10 browser.url() and browser.newWindow() return browsing
contexts with their own commands, which a browser-level
overwriteCommand does not reach. overwriteBrowsingContextCommand() also
overwrites them with { attachToBrowsingContext: true }, only when
browser.browsingContexts exists (WebdriverIO 9 reads any third argument
as "attach to elements"). It routes browserstack_executor scripts from
context.execute(), and runs the accessibility scan before the Browser
commands of a context, on that context (legacy and CLI paths).
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 configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WebdriverIO 10.0.0 is released, so ^10.0.0-0 is no longer needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dprevost-LMI
commented
Oct 6, 2026
Comment on lines
+33
to
+35
| "@percy/webdriverio": { | ||
| "webdriverio": "^9.0.0 || ^10.0.0" | ||
| } |
Author
There was a problem hiding this comment.
To remove when percy/percy-webdriverio#1498 is merged and released
The service needs WebdriverIO 9 or 10: webdriverio, @wdio/types, @wdio/reporter and @wdio/logger are ^9 || ^10. The peer range still allowed @wdio/cli 5 to 8, so npm installed the service on those versions without an error, and it did not work at runtime. WebdriverIO 7 and 8 users have the v7 and v8 release lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The WebdriverIO 9 job did not build, so src/grpc/generated did not exist and 12 test files failed to load. Every job now builds before it installs another WebdriverIO major; the build still uses the WebdriverIO 10 types. The getWdioMajorVersion test expected 10. CI now sets WDIO_MAJOR for each job, and the test expects that major (10 for a local run). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 is this about?
Closes #268
This PR adds WebdriverIO 10 support to
@wdio/browserstack-service. WebdriverIO 9 stays supported: the runtime and peer ranges are^9 || ^10. The dev dependencies move to WebdriverIO 10, and CI tests both major versions.The changes follow the WebdriverIO v10 migration guide and the
wdio-v10-migrationskill. The code does not check the WebdriverIO version where it can test for a feature instead.Blocked by
WebdriverIO 10 API changes
isMultiRemote(v10) orisMultiremote(v9), and gets each instance withgetInstance(). In v10, the multiremote browser has no instance properties. Before this change,getCloudProvider()threw aTypeErrorfor every multiremote session in the servicebeforehook, and the BiDi detection for multiremote always returnedfalse.overwriteCommand: the third argument is{ attachToElement: true }, not a boolean. v10 throws on a boolean, and v9 accepts any truthy value.executeAsync()removed: the CLI accessibility scripts run throughexecute(). The BiDibrowserstack_executorrouting patchesexecuteAsynconly when the command exists (v9).RequestedMultiRemoteCapabilities.WebdriverIO 10 behavior changes
bstack:options.appiumVersion: '3.3.0'(Android 8+, iOS 15+). Capabilities in the legacy format getbrowserstack.appium_version, because WebdriverIO rejectsbstack:optionsnext to legacy keys. A version that the user sets stays. The service reads the WebdriverIO major version from@wdio/cli, becausewebdriveriocan resolve to the v9 copy that@percy/webdriverioinstalls.failHookAffectedTests: see the dashboard note below.browser.url()andbrowser.newWindow()return browsing contexts with their own commands, and a browser-leveloverwriteCommanddoes not reach them. The service now also uses the documented{ attachToBrowsingContext: true }option, only whenbrowser.browsingContextsexists. It is used for thebrowserstack_executorrouting ofcontext.execute()and for the accessibility auto-scan. See the note below.$: the CLI accessibilitycommandWrappercaught the error of the original command, logged it asError in commandWrapper, and ran the command again. In v10, everyStrictSelectorErrorwent through this path. The command now runs once, and its error goes to the test. This problem existed before v10.Build, CI and documentation
@wdio/clipeer range:^9.0.0 || ^10.0.0(onmain:^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0). The service needs WebdriverIO 9 or 10, but npm installed it on WebdriverIO 5 to 8 without an error, and it did not work at runtime. WebdriverIO 7 and 8 users have thev7andv8release lines.webdriverioand all@wdio/*packages are 10.0.1 (@wdio/logger10.0.0, its latest version), with@wdio/cli10 as a dev dependency. The lockfile is regenerated.package.json(private, not published): it overrides thewebdriveriopeer range of@percy/webdriverioto^9.0.0 || ^10.0.0, sonpm installworks in this repository. Remove it when Percy releases WebdriverIO 10 support..github/scripts/check-wdio-major.mjsfails the job when the installed WebdriverIO packages are not on the expected major version. Every job builds before it installs WebdriverIO 9, because the build also generates the gRPC client that the tests import (src/grpc/generated); the published build uses the WebdriverIO 10 types. The Test step setsWDIO_MAJOR, and thegetWdioMajorVersion()test expects that major..changeset/wdio-v10-support.md(minor). I added it manually, because the changeset workflow does not run for PRs from forks.Known limits
@percy/webdriverio3.3.4): its peer range stops at WebdriverIO 9, and it callsexecuteAsync(). On WebdriverIO 10, npm shows anERESOLVE overriding peer dependencywarning (not an error) and installs a secondwebdriverio@9under the service for Percy. Until Percy releases WebdriverIO 10 support, Percy snapshots lose the readiness gate and cross-origin iframes. Fix in progress: feat!: support WebdriverIO 8, 9 and 10 percy/percy-webdriverio#1498, to be released as 4.0.0. After that release, the service range becomes^4.0.0and the rootoverridesentry goes away. The service code does not change: 4.0.0 accepts thebrowserobject that the service passes.@percy/appium-app2.1.0): it finds ignore and consider regions withdriver.$(xpath)anddriver.$('~id'), which throw in v10 when more than one element matches. In a session with abrowserName(hybrid or mobile web), itsexecute('mobile: …')andexecute('browserstack_executor: …')calls go through BiDi, which cannot run them. Fix in progress: feat: support WebdriverIO 8, 9 and 10 percy/percy-appium-js#619. If Percy releases it as a new major, the@percy/appium-apprange changes too.engines.nodestays>=18.20.0, because WebdriverIO 9 users can still run Node.js 18.20. WebdriverIO 10 itself requires Node.js 22.19.0 or later.Notes for BrowserStack
Warning
BrowserStack: please validate AI self-heal on WebdriverIO 10.
In WebdriverIO 10,
$is strict by default (strictSelectors: true). A strict$sendsfindElements(POST /session/:id/elements), notfindElement, so it can count the matches.$$also sendsfindElements.the BrowserStack side. Please confirm that BrowserStack heals a failed
findElements, or$will not heal on WebdriverIO 10.
ai-handler.tsoverwritesfindElementonly. On WebdriverIO 10, healing and AI log data do not run for$. This PR doesnot change that. If the service also overwrites
findElements, an empty$$result (which isnormal) also starts a heal. That decision belongs to the BrowserStack AI team.
Workaround until then:
strictSelectors: falsein the config, or$(selector, { strict: false }).Note
Dashboard status change: Mocha tests after a failed hook.
On WebdriverIO 10, Mocha 12 fails the tests that a failed
beforeorbeforeEachhook skipped(
mochaOpts.failHookAffectedTests,trueby default). The service now reports these tests asfailed with the Mocha message
Test skipped due to failure in hook "<hook>": <error>, asWebdriverIO does. Before, it reported them as skipped. WebdriverIO 9,
afterEachfailures,and
failHookAffectedTests: falsekeep the skipped status. Please confirm that Test Reportingaccepts this status for these tests.
Warning
BrowserStack: please validate legacy capabilities on WebdriverIO 10.
WebdriverIO 9 accepted a JSON Wire Protocol new-session response (
sessionIdnext tovalue).WebdriverIO 10 accepts only the W3C response (
value.sessionIdandvalue.capabilities), andotherwise throws
WebDriver new session response is missing a session id or capabilities.The service still supports capabilities in the legacy format (no
bstack:options, for examplebrowserstack.local,os_version,device). Please confirm that the hub answers these sessionswith the W3C response body.
Note
BrowserStack: please confirm accessibility scans on WebdriverIO 10 browsing contexts.
In WebdriverIO 10,
browser.url()andbrowser.newWindow()return a browsing context with its owncommands. On WebdriverIO 10, the service now also wraps the
Browsercommands ofcommandsToWrapthat a browsing context has, and runs the scan on that context (not on the browser's current
page). Element commands were already wrapped. Note that the browser command
urlisnavigateona browsing context, so a
urlentry does not wrapcontext.navigate. Please confirm that this isthe scan behavior that you want, and whether
commandsToWrapshould listnavigate.Tip
BrowserStack: recommended Node.js changes, not part of this PR.
The dev dependencies are now WebdriverIO 10, which requires Node.js 22.19.0 or later. Two
repository settings still allow an older version.
engine-strictis off in.npmrc, so npm onlywarns, and the build or the tests can then fail with errors that do not point to the cause.
.nvmrcisv20.11.0. Consider24, as the WebdriverIO 10 job inci.yml.release.ymlusesnode-version: 22(comment: "resolves to >= 22.14") and runsnpm ci,npm run buildandnpm testbefore it publishes. Consider24, as the WebdriverIO 10 job inci.yml. npm 11 is installed in a separate step, so the OIDC publish is not affected.Testing
ci.yml:npm ci,npm run build,npm run lintandnpm testpass, 1446 tests.@wdio/logger9.29.1):npm ci, build, install of the v9 packages, version check andnpm testpass, 1446 tests.pull_requestjobs of a fork PR need a maintainer approval. Please approve the run.ENOENTerrors fromtests/uploadLogsArchive.test.ts, also onmain. This PR does not change that file, and the tests pass.bstack:options: service startup, session name and status, Test Reporting events.TypeErrorin the servicebeforehook, and a session status for each instance.beforehook: the affected tests show as failed on the dashboard.appiumVersion, withbstack:options: the session starts on Appium 3.3.0.browserstack.appium_version3.3.0.appiumVersionthere?selfHeal: trueon a BrowserStack session: does$heal?browser.newWindow():tab.execute('browserstack_executor: ...')works, and accessibility scans run on that tab.Related Jira task/s
None. This is a community contribution.
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)
beforeorbeforeEachhook skipped are now reported as failed, as WebdriverIO reports them.Release notes (internal): (required — engineer-facing; what actually changed / why)
isMultiRemoteandgetInstance(), theoverwriteCommandoptions object,execute()instead ofexecuteAsync(), renamed types.TypeErroringetCloudProvider()and a wrong BiDi detection for multiremote on v10 (instance properties were removed).appiumVersion3.3.0 for App Automate on v10; the WDIO major version comes from@wdio/cli.failHookAffectedTests: the affected tests are reported as failed (legacy path and CLI path).attachToBrowsingContextoverwrites for thebrowserstack_executorrouting and the accessibility auto-scan on v10 browsing contexts.commandWrapperno longer runs a failed command a second time.@wdio/clipeer range is^9.0.0 || ^10.0.0(onmain:^5to^9).@percy/webdriveriopeer override in the private rootpackage.json.Checklist
PR Validations
Run Tests: Comment RUN_TESTS to trigger sanity tests.
🤖 Generated with Claude Code