-
Notifications
You must be signed in to change notification settings - Fork 154
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
Cypress 12.0.0 compatibility #238
Conversation
…nting to this branch" This reverts commit 119054b.
Issue resolved on the Cypress side, above no longer applies. We're currently planning on putting out Cypress 12 on Dec 8th or thereabouts, so three weeks. Please let me know if there's anything I can do to help or you have any questions! |
Updated to a new version of the Cy12 binary which resolves the previous issue - tests should now pass completely. |
I'm looking into this now |
Option 1 would be a breaking change and would drop support for all versions of Cypress outside 12 and those peerDependencies would have to be removed from the Option 2 would require multiple support paths which makes maintenance more costly and would require either multiple versions of Cypress to hit each code path, or a way that the tests could override. Is Cypress 12 dropping support for the private functions used in this code? Like |
We're not dropping support for it - custom commands will continue to work as they always have, including using verifyUpcomingAssertions. Most users won't see any problems if they simply continue using the existing version. However, some will - including Cypress' own internal test suite. We're being a lot more rigorous about enforcing "elements must be attached to the DOM in order to be acted upon", so several previously passing tests involving scrolling around virtualized lists in our Vue components started to fail. Something like
is more likely to fail:
This is a completely classic "Detached DOM" error. We're just running into it a lot more frequently with Cypress 12 + cy-test-lib, because Cy12 checks for element actionability (including 'is attached to DOM') more frequently and reliably. Queries prevent this by re-executing, replacing step 5: So that's the benefit - queries can fetch fresh elements from the page, updating the subject that future commands are using, while commands resolve once - when they eventually return a value, that value is "fixed", even if the DOM re-renders. The cost is, as you've said, we place some plugins in a really awkward spot. |
I've been fixing bugs in version 8 in anticipation of a possible breaking change from this pull request. If we do decide to drop support for Cypress <=11, I might as well fix all outstanding issues first. |
Let me know when you're done for the moment, I'll fix merge conflicts and include the changes you make in here. 👍 |
This PR fixes the warnings for:
|
That was fixed in #233 |
I was still on 8.0.3 -> 8.0.7 has it fixed indeed. Thank you |
I'm done for the moment. I was looking at a debug limit option for larger pages, but it will take more work. |
…ress 12+. Set Cypress peerDependency to ^12.0.0
Updated to fix merge conflicts, and make sure everything you fixed is merged in cleanly. I also used the commit message
which I believe should be the correct thing for semantic-release to trigger a breaking change. With that done, I think this is ready, save updating the devDependency to Cy12 once it's released. Let me know if there's anything else I can help with / needs to be done. |
@NicholasBoll - Cypress 12.0.0 is going out today, and has been published to NPM. It's not marked as Should be ready to merge/release this at your convenience. |
@JasonFairchild - Yes, this is a breaking change. Users of Cypress 11 and earlier will need to stay on cy-test-lib 8.x, while users on Cy 12+ will need to use cy-test-lib 9+. |
Tempted to click the merge button, but I'll wait for @NicholasBoll review 😅 |
I'm evaluating today to make sure the error messages, logs, etc work as expected. Possibly add specifications for such messages if they do not exist. |
I like how the new Cypress.Commands.addQuery('focused', (api, options = {}) => {
api.setTimeout(...)
}) But otherwise it looks good. I checked Command log output and Cypress functionality when I increased timeouts to make sure everything looks good. I'm assuming since Thank you for your fine work and I apologize for the delay. I'll add the necessary steps to release a breaking change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution and your patience!
Thank you for all your work! I'm installing Cypress 12 for a new project today, and want to add the testing library. When do you anticipate these latest changes being available to install via npm? Should I link to a specific branch for now? |
🎉 This PR is included in version 9.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
The use of In retrospect I think it would have been better to break the symmetry and pass in the
Thank you for being responsive and helpful! :) |
Not sure if I missed something that I need to do wrt this breaking change, but I'm now getting the error below when trying to run a spec. Any help appreciated! Thanks running versions:
|
@tracy-ash same here, had to use the fixed cypress version 12.1.0
|
For @tracy-ash and anyone else running into this, be sure that the side-effect On a side note, this is with Cypress 12.2.0 and |
Still having issue above, with latest Cypress or lower versions (like 12.1.0). Could someone advice? |
For me it happens when I run all specs, when running one by one it seems to be working fine.
|
@olegg-gocheetah @apolonskiy @zunjooo have you found any solution for issue "> Cypress.Commands.addQuery() is used to create new queries, etc." |
@tadaslinge I did not have this problem since the version upgrade, as I mentioned above - now I am on v12.8.1 and still everything regarding this issue is okay. |
I'm on "cypress": "^12.10.0", this problem still exist |
How to fix this? |
Hiya I'm on cypress: 2.16.0 & @testing-library/cypress 9.0.0, looks as though this problem still exists
|
Apologies I misunderstood the error I reported above. I was able to fix my issue. Prior to the migration efforts from v10.11.0 to v12.16.0 we had |
Hi. I have same issue when try to use synpress as a cypress plugin. |
Fixed this by monkey-patching the function before importing testing library:
|
I based my fix off of your "monkey-ing" around. I am on 13.15.0; I almost used the same, but the commands.ts page kept complaining because I needed to define, some of the new functions in the e2e file (I'm using typeScript).
and on the commands.ts page:
I added it to the commands.ts page on the very top, and everything worked fine. I hope this helps anyone else that is stuck with the same issue. |
Fixes #244
What:
Hello from the Cypress team! In Cypress 12.0.0, we'll be releasing a new API for custom commands:
Cypress.Commands.addQuery
. This is in order to resolve one of Cypress' oldest and most annoying issue, "Detached DOM".Queries are a type of command, but simpler - Cypress' own command queue manages the retry loop, rather than relying on each implementation to call
verifyUpcomingAssertions
.As the most popular plugin for Cypress, and by far the most popular plugin providing additional commands, I'm reaching out and see how you want to handle compatibility with Cypress 12.
Why:
Using
Commands.addQuery
instead ofCommands.add
has a couple of benefits:If you want to learn more about them, check out the Cypress docs I also have in flight. cypress-io/cypress-documentation#4835. Here's a deployed version of them, with the new guide about queries I'm working on: https://deploy-preview-4835--cypress-docs.netlify.app/api/cypress-api/custom-queries
How:
Cypress.Commands.addQuery
does not exist in Cypress 11, which means that as I've submitted it, this PR is breaking. I see a couple of options.if (Cypress.Commands.addQuery) { ...use code in this PR... } else { ...use old version... }
.The first option has the benefit of being small, without duplicated code or the burden of maintaining multiple versions of the plugin inside a single file. The second option has the benefit of allowing the same version of cy-test-lib to run with any version of Cypress.
If you prefer option 2, let me know and I'll update the PR in that direction.
Checklist: