Skip to content

feat: Multi-remote number, size and object matchers and toBeElementsArrayOfSize - #2231

Merged
dprevost-LMI merged 8 commits into
webdriverio:mainfrom
dprevost-LMI:multi-remote-4-number-size-matchers
Sep 26, 2026
Merged

dprevost-LMI merged 8 commits into
webdriverio:mainfrom
dprevost-LMI:multi-remote-4-number-size-matchers

Conversation

@dprevost-LMI

@dprevost-LMI dprevost-LMI commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Part 4/4 of the multi-remote support split from #2172.

  • toHaveWidth, toHaveHeight and toHaveChildren support multi-remote elements, with one number or NumberMatcher for every instance or one per instance (expect.multiRemote() or plain object shorthand)
  • toHaveSize, toHaveStyle and toHaveElementProperty keep a plain object as a literal value: per-instance values require expect.multiRemote()
  • toBeElementsArrayOfSize counts the elements per instance, against a single size or one size per instance
  • A plain object passed as per-instance styles is a mismatch instead of a crash
  • Types, type tests, docs and multi-remote playground specs

Fixes #106
Fixes #1966

…rrayOfSize

Part 4/4 of the multi-remote support split from webdriverio#2172.

- `toHaveWidth`, `toHaveHeight` and `toHaveChildren` support multi-remote elements, with one
  number or NumberMatcher for every instance or one per instance (`expect.multiRemote()` or
  plain object shorthand)
- `toHaveSize`, `toHaveStyle` and `toHaveElementProperty` keep a plain object as a literal
  value: per-instance values require `expect.multiRemote()`
- `toBeElementsArrayOfSize` counts the elements per instance, against a single size or one size
  per instance
- A plain object passed as per-instance styles is a mismatch instead of a crash
- Types, type tests, docs and multi-remote playground specs

Fixes webdriverio#106

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dprevost-LMI
dprevost-LMI marked this pull request as ready for review September 25, 2026 23:05
Calling through the context resolves the matcher overloads, so the tests are type-checked
against the real signatures, and invalid inputs are flagged with @ts-expect-error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds multi-remote support to number and object matchers.

The PR appears safe to merge based on the reviewed changes.

Summary

The PR adds multi-remote support for number, size, style, property, and element-array-size assertions, with corresponding types, tests, and documentation.

  • Since the previous review, it labels per-instance values in assertion messages and updates the affected snapshots.
  • The previous findings are resolved or were withdrawn.

Reviews (7) · Last reviewed commit: "feat: label multi-remote per-instance va..."

Comment thread src/matchers/elements/toBeElementsArrayOfSize.ts Outdated
Comment thread src/matchers/elements/toBeElementsArrayOfSize.ts Outdated
Comment thread src/util/numberOptionsUtil.ts Outdated
dprevost-LMI and others added 3 commits September 25, 2026 19:34
…entsArrayOfSize

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e $$() in toBeElementsArrayOfSize

An empty regular ElementArray, or an empty array in a regular (non multi-remote) session,
now rejects per-instance sizes like a non-empty one, instead of passing against the
instance names taken from the expected value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…i-remote instance names

An object such as { eq: 2, firefox: 3 } was read as NumberOptions, silently dropping the
other keys. It now throws, pointing to expect.multiRemote(), which is also required when
instances are named like an option key. featureFlags is added to the NumberOptions keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dprevost-LMI

Copy link
Copy Markdown
Collaborator Author

@greptileai, can you review again thoroughly?

Comment thread src/util/multiRemoteUtils.ts
Comment thread src/utils.ts
…ber matchers

A plain object is a legacy NumberOptions for toHaveWidth, toHaveHeight, toHaveChildren and
toBeElementsArrayOfSize, so telling it apart from per-instance values relied on guessing from
the key names (instance names colliding with option keys, mixed objects, missing keys).
Per-instance numbers now require expect.multiRemote(), which is never ambiguous. The plain
object shorthand is kept for the other matchers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/util/numberOptionsUtil.ts
dprevost-LMI and others added 2 commits September 26, 2026 16:38
… assertions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The diff of a multi-remote failure now shows `Multi-remote values {` instead of `Object {`
for the per-instance values, so they are not mistaken for an object expected value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dprevost-LMI
dprevost-LMI merged commit 0169124 into webdriverio:main Sep 26, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expect reads all instances in multiremote mode Support for Multiremote

1 participant