Impact and workarounds for unsafe chaining in Cypress 12 #26026
Replies: 3 comments 1 reply
-
I just thought of a nice alternative:
|
Beta Was this translation helpful? Give feedback.
-
I vote for the types being updated. Commands should not return |
Beta Was this translation helpful? Give feedback.
-
Regarding 2. we use a slightly modified unsafe-to-chain-command rule from the cypress eslint plugin https://github.com/cypress-io/eslint-plugin-cypress
We have a lot of helper code where we define cypress getters and the test code gets very verbose after we removed unsafe chaining. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In Cypress 12 (but not before, as far as I know: e.g. compare https://docs.cypress.io/api/commands/check with https://web.archive.org/web/20220531163314/https://docs.cypress.io/api/commands/check) documentation for action commands says something like
However, the type declaration for these commands just says they return a
Chainable
and code that chained them before gives no errors or warnings.Also, it seems easy to create a command to allow the following:
instead of
or
recommended in https://docs.cypress.io/guides/core-concepts/retry-ability#Correctly-ending-chains-after-an-action
and I plan to make one as a helper in our project. Are there drawbacks to this approach? Is it something Cypress should provide?
Beta Was this translation helpful? Give feedback.
All reactions