-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Problem with cy.contains(). It find two elements. It should find one #25225
Comments
I have had to deal with contains finding multiple before so can't speak on why it was working for you previously, but a simple |
@SkubisMilo This appears to be a regression from 12.0.1 to 12.0.2. I was able to reproduce with the following example: it('issue ', () => {
cy.visit('https://example.cypress.io')
cy.get('a').contains('next').click()
}) In 12.0.1 - passes
|
Tracked this down - basically we're running into a problem when .contains() is passed multiple subjects that match the filter (but no child element of any of the subjects does). Opened a PR to fix it, should go out in the next patch release. |
@BlueWinds thanks for looking at this problem. I hope that your fix resolve this problem :). |
I have also had problems because of this issue. Hoping for the fix to be released soon. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior
After update to Cypress 12.1.0 some tests stop working. The problem is with cy.contains().
Before this code:
cy.dataCy("OpenAddFormsButton.label").contains("Zadanie").click();
found only one element. Now it finds two elements:Desired behavior
In this situation it should find only element which contains only word "Zadanie" not "Zadanie Cykliczne" also.
Test code to reproduce
it("adds new task", () => {
cy.dataCy("OpenAddFormsButton.add").contains("Dodaj").click();
cy.dataCy("OpenAddFormsButton.label").contains("Zadanie").click();
});
Cypress Version
12.1.0
Node version
16.14.2
Operating System
Windows 11
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: