Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elems.toBeElementsArrayOfSize(0) fails all the time #1506

Open
christian-bromann opened this issue Mar 19, 2024 · 0 comments
Open

elems.toBeElementsArrayOfSize(0) fails all the time #1506

christian-bromann opened this issue Mar 19, 2024 · 0 comments
Labels
Bug 🐛 help wanted Extra attention is needed

Comments

@christian-bromann
Copy link
Member

It is not possible to verify if a set of elements has 0 elements. Having the following assertion:

elems = $$('span');
await expect(elems).toBeElementsArrayOfSize(1);

will fail all the time due to:

 Failed to execute expect command "toBeElementsArrayOfSize": Error: selector needs to be typeof `string` or `function`
    at Browser.findElements (file:///path/to/project/test/wdio/node_modules/webdriverio/build/utils/index.js:308:11)
    at Browser.$$ (file:///path/to/project/test/wdio/node_modules/webdriverio/build/commands/browser/$$.js:46:30)
    at Browser.wrapCommandFn (file:///path/to/project/test/wdio/node_modules/@wdio/utils/build/shim.js:88:38)
    at async refetchElements (file:///path/to/project/test/wdio/node_modules/expect-webdriverio/lib/util/refetchElements.js:5:24)
    at async waitUntil (file:///path/to/project/test/wdio/node_modules/expect-webdriverio/lib/matchers/elements/toBeElementsArrayOfSize.js:25:20)
    at async waitUntil (file:///path/to/project/test/wdio/node_modules/expect-webdriverio/lib/utils.js:23:43)
    at async Object.toBeElementsArrayOfSize (file:///path/to/project/test/wdio/node_modules/expect-webdriverio/lib/matchers/elements/toBeElementsArrayOfSize.js:24:18)
    at async BrowserFramework.#handleExpectation (file:///path/to/project/test/wdio/node_modules/@wdio/runner/build/browser.js:297:28)
@christian-bromann christian-bromann added help wanted Extra attention is needed Bug 🐛 labels Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant