-
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
Unable to overwrite click command #19086
Comments
The same problem here with 9.2 cypress. |
@emilyrohrbough I don't think it's related to typescript, only partially when you need to override with different parameters, but that's not my use case. Can you please update the labels accordingly? |
@emilyrohrbough |
@oririner-wiz I see your point here, and I like your solution to bake-in the waiting for the 3rd-party stuff to complete. In the mean time, what you have you done to achieve this waiting? Do you have a command called I'm not involved in planning work around this, but just curious about the underlying desire (plus I agree, this does not seem to need the typescript label unless I'm missing something). It might be useful to know when a person looks at a spec file, that the I do think even in the current state it would be good to at least warn that, when you overwrite |
Hey @marktnoonan thanks for looking into this 🙏 I indeed created a new command, it's called I actually disagree about creating a custom command, cypress has many commands and adding to it more custom commands creates a very large api surface on the We have a local docs for all of the custom commands to allow for discovering these new custom command, but still it's usually less visited vs the cypress api docs. With that said, it would be really nice to know which commands are overwritten at a glance in the IDE, but that's more of a nice-to-have IMO. A better way to go about this would be to avoid the global
Totally agree! though I think that with the current api, it's hard because it's only possible to know which commands are used in your command during runtime, and if your command isn't used. Maybe adding "dependencies" to each command so that you can define this dependency graph of commands that would allow you to know when you're overwriting a command that's being used by other commands. |
Still exist in Cy v12 |
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. |
This issue has been closed due to inactivity. |
Current behavior
I want to overwrite click with the following code:
I want to be able to "pause" after clicks till after a frame has passed because of some 3rd-party library doing some DOM side-effects during the animation frame. This way I clicked something, I wait for the 3rd-party library to do it's side-effect and I can now continue with the normal flow.
However, this creates some issues.
I'm also using
cy.type
&cy.check
which internally usecy.click
, but they don't do it "normally" as a command but rather throughcy.now('click', ...)
. It would've been fine butcy.now
(which is undocumented) wraps the command with a "promise" and my call tocy.window
within the overwritten command also creates a "promise" and then we see the big red error message banners that you can't use promise in a command inside cypress.I tried doing as suggested here but it caused
cy.type
to type at the start of the input and not at the end (I have tests where I append some text and they failed because of it)Regardless, I don't think I should be overwriting
check
,uncheck
,type
,select
(and possibly any other command in the future that triggerscy.now('click', ...)
) just because I want to overwrite click, this feels very brittle.Desired behavior
Be able to overwrite click just like any other command and invoke any other cy commands inside of it.
Test code to reproduce
Here's how it looks like:
Cypress Version
7.5.0
Other
I know I'm not the most recent version, but I looked at the code in
develop
and it's still withcy.now('click', ...)
, so that wouldn't work.Anyway, thank you for all your hard work!
It's really appreciated 🙏
The text was updated successfully, but these errors were encountered: