我已经从另一个SO答案How to type using cypress .type() inside the codemirror editor?中尝试过类似的操作>
如果有帮助,这是我正在使用https://testing-playground.com/在赛普拉斯上工作的网站
// CodeMirror's editor doesn't let us clear it from the // textarea, but we can read the Window object and then // invoke `setValue` on the editor global cy.window().then(win => { win.editor.setValue("") })
我遇到的问题是,当我尝试实现此功能时,我得到的编辑器为
undefined
。我尝试更多地挖掘Window对象,但找不到类似于Codemirror编辑器的任何东西。在任何其他Codemirror元素上运行.clear({force: true})
不会产生任何结果,仅在文本字段上使用.type({force: true})
将新内容与旧内容相加。
我已经从另一个SO答案中尝试过类似的方法如何在codemirror编辑器内使用cypress .type()进行键入?如果有帮助,这是我正在使用https:// testing -...
我没有从赛普拉斯获得窗口对象; CodeMirror编辑器不存在。