如何将鼠标悬停在 cypress 中的父元素和子元素上

Man*_*h B 4 cypress

我正在尝试使用 cypress 自动化 Orangehrm 网站(https://opensource-demo.orangehrmlive.com/index.php/auth/login

我的用例

  1. 登录应用程序
  2. 将鼠标悬停在性能选项卡上。
  3. 将鼠标悬停在“配置”上
  4. 查找并单击 KPI

我尝试使用 cypress 但不知何故鼠标悬停不起作用。请建议点击 KPI 链接的最佳方式。

截图

在此输入图像描述

在此输入图像描述

Mic*_*nes 5

cypress -real-events库悬停命令工作正常

cy.get('#menu__Performance')
  .realHover()

cy.contains('#menu_performance_Configure', 'Configure')
  .realHover()

cy.contains('#menu_performance_searchKpi', 'KPIs')
  .click({force:true})

cy.contains('h1', 'Search Key Performance Indicators')
Run Code Online (Sandbox Code Playgroud)

注意
需要最后一个命令,force因为确实会发生元素剪切。

安装

npm install cypress-real-events
//or
yarn add cypress-real-events
Run Code Online (Sandbox Code Playgroud)

赛普拉斯/支持/index.js

import "cypress-real-events/support";
Run Code Online (Sandbox Code Playgroud)