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

Shouldn't getReact search only among descendents of the resq node passed by the previous command? #137

Closed
matfer opened this issue Jan 29, 2021 · 2 comments

Comments

@matfer
Copy link
Contributor

matfer commented Jan 29, 2021

Reading the docs I understand that getReact searches only among the descendants of the resq node passed by the previous command. So for example cy.getReact('A').getReact('B') should search for B only among A's descendants. I got this right?

If yes, I added this test to calculator.spec.js, which is failing

  it('getReact should search only among descendants of the resq node passed by the previous command', () => {
    cy.getReact('t')
      .nthNode(2)
      .getReact('t')
      .nthNode(9)
      .getProps('name')
      .should('eq', '5');
  });

It should get the element at index 2, then among its descendants get the element at index 9 (the button '5'). Instead it gets the button '9', as if the second getReact searched for elements starting from the root component.

@abhinaba-ghosh
Copy link
Owner

Hi @matfer , you are correct. This is always the desired outcome in any test automation scenario. Currently, We are blocked due to this: #41

Happy to get help.

@abhinaba-ghosh
Copy link
Owner

Hi, this is now fixed with version 2.3.13 ( #251 )

Example - https://github.com/abhinaba-ghosh/cypress-react-chain-queries

Feel free to re-open the ticket if you find any issues.

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