Open
Description
cypress-testing-library
version: 7.0.3node
version: 14.14.0npm
(oryarn
) version: yarn 1.22.5
Relevant code or config
// In the test file
findByLabelText('Label 1');
// In the HTML
<label for="by-text-input">Label 1</label>
<input type="text" placeholder="Input 1" id="by-text-input" />
<label for="by-text-input-1">Label 1</label>
<input type="text" placeholder="Input 1" id="by-text-input-1" />
What you did:
Run a Cypress test using the query cy.findByLabelText('Label 1')
where more than one matching element existed on the page
What happened:
The expected TestingLibraryElementError
is displayed, but the text below "Here are the matching elements:" contains only new line characters. See a screenshot of an example below:
NB: this screenshot is taken after I:
- downloaded the
cypress-testing-library
repo - Added an extra input with "Label 1" to the test app
- Ran the
find* dom-testing-library commands
spec
Suggested solution:
If it is possible to include the list of matching elements in the error message it will make failures much easier to debug, especially in CI.
Metadata
Metadata
Assignees
Labels
No labels