-
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
Chains of query commands do not retry anything before an assertion #25134
Comments
Hm, you're right, it's definitely intended to go through as you're describing. Thank you for the extremely precise repro - looking into this now. |
Putting out some notes from our meeting on the subject. tl;dr: We will be fixing this in the next This was originally an intentional decision in Cypress 12, which we were forced into because of a few rules.
Therefore, assertions must modify the subject chain somehow.
Therefore, assertions must not be queries, because they cannot be appended / retried.
is an unsafe operation, susceptible to detached dom errors.
That is to say: only builtin chainers can change the subject, user supplied callbacks can't. Weird inconsistency in the current rules. After discussing several solutions, we decided to drop rule 2 above. Aliases will now include assertions in their subject chain, and retry them when queried.
This has the advantage that assertions now follow the same rules as all other queries. The rules are very clear and straightforward. Downside: When they fail, you don't get the same visual patterns (eg, command log shows green -> red) as when you first were doing it. Mitigation:
Then, once .get() resolves, we collapse the children before adding the next command:
A test that will fail under the new rules:
The command log would look like:
.get() never finished resolving, so it remains uncollapsed and shows what happened as we tried to fetch the alias (what was contained inside the query chain). We will release the behavior change (assertions becoming full-fledged queries) in a The command log updates (collapsing groups when querying aliases) can follow at a later date, it's not required immediately. |
@emilyrohrbough - This is the issue we discussed last Thursday in our meeting with Brian. Notes posted just above. |
Just a bit of an update - I've been out sick a fair bit recently, but this is what I'm focusing on at the moment. It's a fair bit larger and more complicated than I'd hoped, but will be a huge gain in simplicity of Cypress' internal code once I finish working out all the kinks in the pull draft request. |
Your health first! Thanks for the update. |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
Seems like this shouldn't be closed until Cypress 13 is released? Also, following the chain of PR references it's hard to tell if what was originally PR #25296 (then #25738) even made it into the Cypress 13 branch. The former says it was replaced by the latter, but the latter shows closed, not merged. |
Just got burned by this again. Please do some work and fix this issue since it makes better practices (add more assertions) break the retry-ability in a really spectacular ways that is super hard for people to debug. |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
We still keep having to work around this. |
Current behavior
Notice in v12 (using 12.1.0 right now) that if there are assertions in the chain of queries, the query commands before an assertion are NOT retried, even if the assertion should pass.
Desired behavior
Cypress should go all the way to the start of the chain of queries and retry it, even if there are assertions in the mix.
Test code to reproduce
https://github.com/bahmutov/cypress-map/blob/main/cypress/e2e/chain-with-assertions.cy.js
Cypress Version
v12
Node version
16
Operating System
mac
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: