0
点赞
收藏
分享

微信扫一扫

Cypress 的鼠标悬浮等事件不生效(mouseover等)解决方法

页面有个元素需要鼠标悬停才会显示出来,写用例的时候死活写不出来,看cypress文档说使用.trigger("mouseover") ,但是没有用!!!
最终在https://rat.dev/cypress-io/cypress/issues/10,这里有个人分享了一个插件,试了下终于OK了
插件地址:
https://github.com/dmtrKovalenko/cypress-real-events
安装:

npm install cypress-real-events

yarn add cypress-real-events

注册指令:
在文件cypress/support/index.{js,ts}中引入一下

import "cypress-real-events/support";

使用:

cy.get("button").realHover();
cy.get("button").realHover(options);

记录一下。

举报

相关推荐

0 条评论