Repository navigation
fix: the element commands and toMatchElementSnapshot in a multiremote session (#1238), and use the WebdriverIO 10.0.0 release (#1239) - #1240
Merged
Conversation
… session (#1238), and use the WebdriverIO 10.0.0 release (#1239) * fix: the element commands and toMatchElementSnapshot in a multiremote session (#1238) - Add the multiremote element commands before the commands of each instance. The multiremote addCommand() of WebdriverIO v9 and v10 also adds the command to each instance, so the multiremote command replaced the command of each instance (#997 fixed this for the page commands only). - Give the element of each instance to the multiremote element command. - toMatchElementSnapshot on a multiremote element compares the element on each instance. - Accept a multiremote element in the types of the multiremote checkElement and saveElement commands. - Tests: the unit test mock adds a multiremote command to each instance, as WebdriverIO does; e2e element tests in the multiremote spec (CI). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: use the WebdriverIO 10.0.0 release instead of 10.0.0-alpha.150 - Root dev dependencies: ^10.0.0-0 -> ^10.0.0, so the lockfile cannot keep an alpha version. - image-comparison-core dev dependency webdriverio: ^10.0.0-0 -> ^10.0.0. - The published ranges of the packages (^9.29.1 || ^10.0.0-0) do not change, so WebdriverIO v9 is still supported. - expect-webdriverio stays on 8.0.0-alpha.3, which WebdriverIO 10.0.0 uses (there is no 8.0.0 release yet). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 4de63a1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
dprevost-LMI
marked this pull request as ready for review
October 5, 2026 16:40
|
…t the WebdriverIO 10 releases instead of the 10.0.0 prereleases (#1241) * fix: await the element of the multiremote element commands On a multiremote element that is not awaited (`multiRemoteBrowser.$()` without `await`), a property is a chained command, so `isMultiRemote` is a function. The multiremote command then gave the chainable to each instance and failed with `Unsupported type: function`. The command now awaits the element first. Tests: a unit test with a chainable mock, and an e2e test that calls `multiRemoteBrowser.checkElement(multiRemoteBrowser.$(selector), ...)`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: accept the WebdriverIO 10 releases instead of the 10.0.0 prereleases The @wdio/globals, @wdio/logger and @wdio/types ranges of the packages change from `^9.29.1 || ^10.0.0-0` to `^9.29.1 || ^10.0.0`. WebdriverIO v9 is still supported. The `10.0.0-0` ranges left in the lockfile are peer ranges of the WebdriverIO packages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: run the OCR tests on the v9 website The v10 website revamp (webdriverio/webdriverio#15700), deployed to webdriver.io on 2026-10-05 with the WebdriverIO 10.0.0 release, removed the home page that the OCR tests use (`.hero__title`, `.hero__subtitle`, `.buttons_pzbO`). All OCR tests failed in the `beforeEach` hook with `element (".hero__title") still not displayed after 15000ms`. v9.webdriver.io keeps this page, so the tests and the URL checks use it. 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.
Description
Fixes #1238.
In a multiremote session,
checkElement,saveElementandtoMatchElementSnapshotfailed. This PR fixes the causes and adds tests that find each cause. It also:10.0.0-alpha.150to the10.0.0release, and the published ranges from^10.0.0-0to^10.0.0https://v9.webdriver.io, because the new v10 website removed the page that they useThis is not a v10 regression: the bug was already in v9 (see below).
The causes and the fixes
expect(multiRemoteBrowser.$('#el')).toMatchElementSnapshot('tag')The visual service did not add the "checkElement" command to this sessionparent, sogetBrowserObject()did not find a browser.toMatchElementSnapshotcompares the element of each instance (element.getInstance(name)) with the browser of that instance, and gives the result of each instance, astoMatchScreenSnapshotdoes.multiRemoteBrowser.getInstance('chrome').checkElement(element, 'tag'), andtoMatchElementSnapshoton the element of an instanceno such nodeaddCommand()of WebdriverIO v9 and v10 also adds the command to each instance. The service added the multiremote element commands last, so they replaced the commands of each instance. #997 fixed this order for the page commands only.multiRemoteBrowser.checkElement(await multiRemoteBrowser.$('#el'), 'tag')Unsupported type: functionelement.getInstance(browserName)).multiRemoteBrowser.checkElement(multiRemoteBrowser.$('#el'), 'tag')(not awaited, found in the review)Unsupported type: functionisMultiRemoteis a function, nottrue.Other changes:
isMultiRemoteElement(): a new type guard for the multiremote elements of v9 (isMultiremote) and v10 (isMultiRemote).multiRemoteBrowser.checkElement()andmultiRemoteBrowser.saveElement()accept a multiremote element. Before, the example of the issue failed the type check.compareResult()parameter type accepts the result of each instance. This removes anas unknown ascast.Not a v10 regression
The three calls of the issue, on WebdriverIO 9.29.1 (standalone multiremote, two headless Chrome sessions):
@wdio/visual-service@10.1.0(before the v10 work)toMatchElementSnapshoton a multiremote elementbrowser.checkElement is not a functiongetInstance('one').checkElement(element of one)no such nodemultiRemoteBrowser.checkElement(multiremote element)Unsupported type: functionmultiRemoteBrowser.checkElement(multiremote element), not awaitedThe multiremote element commands come from #423 (July 2024). In v10, only the error text of the first call changed.
Why the tests did not find it
addCommand()was a plainvi.fn(). It did not add the command to each instance, so the order problem could not show. The mock now does this, as WebdriverIO does.saveScreen. It had no element command and no matcher. Its config hadautoSaveBaseline: false, so a check command would fail in CI, which has no baselines.WebdriverIO 10.0.0
^10.0.0-0→^10.0.0, so the lockfile cannot keep an alpha version. Thewebdriveriodev dependency ofimage-comparison-corechanges in the same way.@wdio/globals,@wdio/loggerand@wdio/typesranges of@wdio/visual-service,@wdio/ocr-serviceand@wdio/image-comparison-corechange from^9.29.1 || ^10.0.0-0to^9.29.1 || ^10.0.0. WebdriverIO v9 (9.29.1 and later) is still supported.expect-webdriveriostays on^8.0.0-0. WebdriverIO 10.0.0 uses8.0.0-alpha.3, and there is no 8.0.0 release yet.ansi-regexandstrip-ansi). It has no alpha version of WebdriverIO now. The10.0.0-0ranges left in it are peer ranges of the WebdriverIO packages.OCR e2e tests on the v9 website
The OCR job failed in the
beforeEachhook, and it fails in the same way on every PR:element (".hero__title") still not displayed after 15000ms(run).The code of this PR does not cause it, because the hook fails before the service runs. The OCR spec uses the live home page of
https://webdriver.io/, and the v10 website revamp (webdriverio/webdriverio#15700) removed this page (.hero__title,.hero__subtitle,.buttons_pzbO). The new site was deployed on 2026-10-05, with the WebdriverIO 10.0.0 release:.hero__title. The live page does not.https://v9.webdriver.io/still has the old page.The OCR spec now uses
https://v9.webdriver.iofor the page and for the two URL checks. Next step (separate PR): move the OCR tests to a static page on guinea-pig.webdriver.io, as webdriverio/guinea-pig#14 did for the webdriverio e2e tests.Tests
isMultiRemoteElement()test.local.desktop.multi): 5 new tests intests/specs/multiremote.spec.ts. The config now hasautoSaveBaseline: true.Local runs on WebdriverIO 10.0.0:
pnpm test(lint, types, 1084 unit tests): passtest.local.chrome.v10,test.local.chrome.v10.jasmine,test.local.desktop.multi(7 tests),test.local.chrome.v10.emulation: passtest.ocr.local.desktop(local only): 7 passing (before: all fail in thebeforeEachhook)test.local.desktop(local only): one failure, the alwaysSaveActualImage: false does not respect browser.checkElement/Screen/FullPageScreen #1115 test, because of stale local baselines. This failure is not related to this PR.test.local.multi.web.app(local only): not run, because no Appium and no Android 14 emulator were available. Its spec uses no element command.Changesets
.changeset/fix-multiremote-element-commands.md:@wdio/visual-servicepatch.changeset/webdriverio-10-release-ranges.md: patch for@wdio/visual-service,@wdio/ocr-serviceand@wdio/image-comparison-core🤖 Generated with Claude Code