-
Notifications
You must be signed in to change notification settings - Fork 159
Open
Description
cypress-testing-library
version: 6.0.0node
version: 12.14.1npm
(oryarn
) version: yarn 1.21.1
Relevant code or config
cy.findAllByTestId('test-id').findByText('mytext').parents('.parent');
What you did:
I want to chain commands from cypress-testing-library, so that they are executed in the same context. In the example above I want to retrieve the element which contains the text "mytext" but only for elements which have a parent (somewhere in the upper DOM) with a data-testid attribute with the value 'test-id'.
What happened:
The command doesn't find an element with the given text, even if there would be such an element (proof is being provided in the Hint below).
Hint:
If I run the same code as above, but with a contains
instead of the findByText
everything works as expected:
cy.findAllByTestId('test-id').contains('mytext').parents('.parent');
Thanks for this library and the whole testing-library
family in general! Cheers!
Metadata
Metadata
Assignees
Labels
No labels