-
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
cy.state warning appears in console when running scripts with cy.xpath #27933
Comments
@LynyrdRoss The cypress/xpath plugin is deprecated, so we won't be making updates to that plugin anymore. However, I don't see the use of cy.state('withinSubject') even being used in that plugin. Do you use the cypress-testing-library plugin? I know they make a call to that here. https://github.com/testing-library/cypress-testing-library/blob/1af9f2f28b2ca62936da8a8acca81fc87e2192f7/src/utils.js#L10 That may be where the deprecation error is coming from. |
I don't recall anyone in our team using that specific plugin. My bad for pointing out @cypress/xpath as my prime suspect. It's just that upon using cy.get, I get no cy.state warnings, but if I switch to cy.xpath, that's where all this warning comes in. Is there any alternative we can use for xpath selection? |
This was a topic that was discussed also in Discord where you can read:
If it is all still working for you, then you could consider just ignoring the warning
cypress/npm/xpath/src/index.js Lines 52 to 55 in b71788d
|
No, as explained above. However you can simply ignore the warning. I don't think that there is anything more that can be done in this issue regarding the deprecated and unsupported @cypress/xpath npm module, so I suggest to close the issue. |
I completely understand. thanks @MikeMcC399 . At this point, it may be best to divert the use of xpath in Cypress. I'm just worried that on future releases where cy.state() is finally removed, we will be forced to adjust all object selectors created via xpath. If I can understand it correctly this is the only course of action that we have considering this has been an ongoing discussion for 4 years? |
This issue #29294 means that Cypress still requires xpath in order to test Salesforce lightning elements properly |
Current behavior
I get a warning every time I run a script that involves cy.xpath:
Desired behavior
My initial thoughts is to root out which plugin is causing this. And what I have learned in my own testing of my current plugins is @cypress/xpath.
Out project has page elements using xpath selectors. Is there any way I can get around this warning without removing the plugin?
Test code to reproduce
Repo with reproduction: https://github.com/LynyrdRoss/cypress-test-tiny/tree/cystate-problem
Cypress Version
12.17.4
Node version
16.16.0
Operating System
Windows 10
Debug Logs
No response
Other
This is the link for the plugin if it helps
The text was updated successfully, but these errors were encountered: