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

Fluent chained queries doesn't work properly with multiple items #79

Closed
theKosh opened this issue Nov 2, 2020 · 4 comments
Closed

Fluent chained queries doesn't work properly with multiple items #79

theKosh opened this issue Nov 2, 2020 · 4 comments

Comments

@theKosh
Copy link

theKosh commented Nov 2, 2020

Summary

Fluent chained queries doesn't work properly with multiple items.

Precondition

macOS 10.15.7
Chrome 86.0
cypress@5.5.0
cypress-react-selector@ > 2.0.3 (checked on 2.0.4, 2.1.0, 2.2.0).

Steps to reproduce

  1. Have more than one identical element on the page that differs only in the parent element, for example:
    'button', { props: { type: 'submit' } }.
  2. Use the Fluent chained queries syntax to find a specific element through the parent, for example:
    cy.react('modal', { hooks: { Context: { modalParams: { type: 'fileCreateModal' } } } })
      .react('button', { props: { type: 'submit' } })
      .click();

Actual result

Cypress error:

cy.click() can only be called on a single element. Your subject contained 2 elements. Pass { multiple: true } if you want to serially click each element.

The same code works just fine in cypress-react-selector@2.0.3.

Expected result

The element is clicked, because we filtered out the extra elements by finding the parent element.

@issue-label-bot issue-label-bot bot added the bug Something isn't working label Nov 2, 2020
@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.97. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@abhinaba-ghosh
Copy link
Owner

abhinaba-ghosh commented Nov 3, 2020

Hi @theKosh , we do not allow a property called hooks in the commands. Allowed properties are props, state, and exact. I will throw an error going forward if other properties are passed.

@abhinaba-ghosh abhinaba-ghosh removed the bug Something isn't working label Nov 3, 2020
@theKosh
Copy link
Author

theKosh commented Nov 4, 2020

Hi, @abhinaba-ghosh. Why can't we use hooks like in version 2.0.3? Restrictions in a third-party library? It's just very useful in some cases.

@abhinaba-ghosh
Copy link
Owner

version 2.0.3 also does not support the hooks. I am not sure how it worked. if you need the support, feel free to open a feature request.

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

No branches or pull requests

2 participants