Cypress can't check any radio buttons when required using React-Hook-Form #30302
Labels
E2E
Issue related to end-to-end testing
stage: needs investigating
Someone from Cypress needs to look at this
type: bug
Current behavior
Cypress can't check any radio buttons when required using React-Hook-Form
Brief Description
I'm using React-Hook-Form to validate and submit my form. When I run the e2e testing, Cypress can't check any of the radio buttons except for the last one if these radio buttons are required. If they're registered as a React-Hook-Form field but are not required, then Cypress can check any of them.
Steps
npm run cy:open
.modalForm.spec.ts
..check()
value "regular") is not checked by Cypress..check()
value from "regular" to "lime" in themodalForm.spec.ts
, is not checked by Cypress..check()
value from either "regular" or "lime" to "blueberry" in themodalForm.spec.ts
, then Cypress can check it.ModalForm.tsx
, take out the{ required: true }
from each of the radio buttons in the form. Then change the value to "regular" in themodalForm.spec.ts
. Runnpm run cy:open
. You can see that the first radio button is checked by Cypress.Video Demo
https://www.loom.com/share/370ebac07a8c4451bfd8109db429b4a1
Desired behavior
Cypress should be able to check any radio button no matter which form framework validation should work. In this case, I'm using React-Hook-Form. And specifically, they won't check if they're required in React-Hook-Form.
Test code to reproduce
Links to files:
The Branch
https://github.com/junerockwell/github-actions-nextjs-cypress-vercel/tree/cypress-reacthookform-radio-issue
Cypress Version
13.14.2
Node version
21.7.3
Operating System
macOS 12.3.1
Debug Logs
No response
Other
The text was updated successfully, but these errors were encountered: