Skip to content

Conversation

@dprevost-LMI
Copy link
Contributor

@dprevost-LMI dprevost-LMI commented Dec 28, 2025

Fixes #1506. As noted in the issue, when using await + filter on $$(), we get the type Elements[] rather than ElementArray, so we cannot refetch.

This PR ensure that toBeElementsArrayOfSize is compliant with the type `WebdriverIO.Element[], so that the following works.

        const elems = await $$('div').filter(async el => await el.isDisplayed())
        await expect(elems).toBeElementsArrayOfSize(1)

`WebdriverIO.Element[]` needs to also be a `ElementArrayLike`
@dprevost-LMI dprevost-LMI marked this pull request as ready for review December 28, 2025 16:48
@dprevost-LMI dprevost-LMI force-pushed the make-type-elements-work-with-toBeElementsArrayOfSize branch from 64cf3f0 to ad039c1 Compare December 28, 2025 16:56
@dprevost-LMI
Copy link
Contributor Author

Need to merge #1980 first

@dprevost-LMI dprevost-LMI changed the title Make type elements work with to be elements array of size Make type Element[] work with to be elements array of size Dec 28, 2025
@dprevost-LMI dprevost-LMI changed the title Make type Element[] work with to be elements array of size Make type Element[] work with toBeElementsArrayOfSize Dec 28, 2025
Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@christian-bromann christian-bromann merged commit 9f14972 into webdriverio:main Jan 4, 2026
6 checks passed
@wdio-bot
Copy link
Contributor

wdio-bot commented Jan 4, 2026

Hey dprevost-LMI 👋

Thank you for your contribution to WebdriverIO! Your pull request has been marked as an "Expensable" contribution.

We've sent you an email with further instructions on how to claim your expenses from our development fund.
Please make sure to check your spam folder as well. If you have any questions, feel free to reach out to us at [email protected] or in the contributing channel on Discord.

We are looking forward to more contributions from you in the future 🙌

Have a nice day,
The WebdriverIO Team 🤖

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

elems.toBeElementsArrayOfSize(0) fails all the time

3 participants