-
-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Labels
Description
I'd like to add the missing "Missing support for attributes, properties and visible in waitForElement" for Chrome Recorder.
But it seems, that the underlying problem is, that toBeElementsArrayOfSize is the only matcher that properly handles WebdriverIO.ElementArrays (or ChainablePromiseArrays - what's the difference anyway?)
So we need a new matcher that works like this:
await expect($$(`input`)).toBeFilteredElementsArrayOfSize(async (el) => {
return await el.isDisplayed() && await el.getProperty("value") === "foo";
}, 1);The signature could look like this:
export async function toBeFilteredElementsArrayOfSize(
received: WdioElementsMaybePromise,
filterFunction: (element: WebdriverIO.Element) => boolean | Promise<boolean>,
expectedValue: number | ExpectWebdriverIO.NumberOptions,
options: ExpectWebdriverIO.StringOptions
)A simpler alternative could be, to add the filter function to the options for toBeElementsArrayOfSize.
export async function toBeElementsArrayOfSize(
received: WdioElementsMaybePromise,
expectedValue: number | ExpectWebdriverIO.NumberOptions,
options: (ExpectWebdriverIO.StringOptions & {filter?: (element: WebdriverIO.Element) => boolean | Promise<boolean>})
);To keep things DRY I think this should be the implementation anyway.
toBeFilteredElementsArrayOfSize can be added as an alias/facade with the signature from above.