Answer: How can I clear a Codemirror editor field from Cypress
Jacob Evans
Posted on June 29, 2020
I was able to with a little help from another answer in the responses to come up with a solution.
- Problem domain involved embedded editor CodeMirror
- I wanted to use Cypress to remove all Text in a field then simulate a user typing in all their own, like a copy-paste.
- Could not remove code from the editor with Cypress as expected.
Normally I am afraid to use StackOverflow because I don't want to be shutdown or talked down too. I tweeted my question and got a great response; friendly and helpful! This is the type of interaction I love to see in StackOverflow.
Big thanks again to @evanplaice for seeing my tweet and helping out, here is his Twitter: https://twitter.com/evanplaice
The solution I ended up using looked something similar to code block in the question with a few changes.
I am not getting the window object from Cypress; CodeMirror editor wasn't there.
I used the idea Evan Plaice gave me related to the Editor instance being on the DOM and…
Posted on June 29, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.