Cypress 3.0.0 doesn't always trigger onclick when calling .check() on radio buttons
See original GitHub issueIs this a Feature or Bug?
Bug
Current behavior:
Calling .check()
on a radio button will visually check it but the onclick
code doesn’t run. This was not the case with 2.1.0
Desired behavior:
Calling .check()
on a radio button should trigger the onclick
handler.
Steps to reproduce:
I’m not 100% sure what the cause is. I created a simple HTML file to test this on and it worked as expected, so maybe Cypress 3.0 handles a more complicated DOM differently. I can’t post the actual HTML I’m testing on since it is a company product.
Versions
Cypress 3.0.0, Windows
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Cypress does not always executes click on element
When that script takes a long time to execute it allows Cypress to click the button before the OnClick event is there. See:...
Read more >fix this problem, or use {force: true} to disable error checking.
Before I log a detailed issue, can someone tell me if the scrollIntoView() function supposed to scroll elements or does it only scroll...
Read more >check - Cypress Documentation
Check checkbox(es) or radio(s). It is unsafe to chain further commands that rely on the subject after .check(). This element must be an...
Read more >onClick event for radio button - Topic - Focal Point Forums
How do you add an onClick event handler for a radio button control? The "control" is a set of three radio buttons. In...
Read more >react onclick triggered on render Code Example - Code Grepper
Why is my onClick being called on render react? ... react why onclick property function trigger without click ... <button type="button" onClick={this.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have something that shows the problem. I’m trying to test a site and the inputs have an onclick that is generated in the form
onclick="javascript:setTimeout('postbackCall(\'id\')',0)"
. It looks like Cypress 3.0.0 is having trouble with the code parameter insetTimeout
.Here is an example that shows the issue:
In Cypress 2.1.0 the console log will show
foo
as well asbar
, but in 3.0.0foo
is displayed and then Cypress errors out on the call to the second.check()
, sayingfn.apply is not a function
. I can stop the error from ending the test by catching the uncaught exception, but this still prevents the postback from happening which is necessary for the app to function.@jbinto yah the issues described above definitely don’t have anything to do with the checkbox not checking - so we’ll need a reproducible example to figure this out.