cypress: Cypress does not open color input on click
Current behavior:
Color palette does not appear when click input type="color" in Cypress test.
However it appears when click manually in browser launched by Cypress.
Desired behavior:
Color palette appears when click at input type="color"
Test code to reproduce
https://github.com/mayenok/cypress-test-tiny
Versions
Cypress: 4.9.0 Ubuntu 18.04.4 64-bit Chromium 83.0.4103.61
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 1
- Comments: 17 (5 by maintainers)
Also work for Angular!
This workaround does not work for Vue, where the value gets overwritten as soon as Vue updates the view.
The addition of
blurdid not help in this case.The color is updated (visually), but gets overwritten as soon as Vue updates. This happens for example when someone clicks a (submit) button.
TL;DR: What does work, is triggering an
inputEvent for Vue.Thanks for help! This works:
P.S. and thanks for the great framework ❤️
Yeah it is a native browser dialog similar to file opener dialog. Your test can simply set the desired color value as shown in
https://www.cypress.io/blog/2020/03/17/how-to-test-an-application-that-changes-css-variable/
Sent from my iPhone
Only this one worked for Nextjs, thanks @EtienneBruines
Note that i needed to change the event handler that triggers state update to be
onInputinstead ofonChange