TestCafé在测试megadropdown功能时遇到问题。
在测试中,我使用了TestCafé的.hover()
,它会正确触发导航链接的mouseenter
事件。在此mouseenter
中,我得到了jquery(2.1.4)的以下if子句:
if ($(this).parent().find(':hover').length > 0) {
...
}
现在,当我通过testCafe触发悬停时,该语句从不正确,长度保持为0。
我确实看到了mouseenter
事件,我看到了TestCafé绘制的光标,但是jQuery(': hover').length
始终为零。
我不知道为什么如此实现此功能,并且我不想更改代码,我只是想运行一些自动化测试来检查功能。有没有人知道解决方法/错误修复的外观?
更新以正确再现 https://jsbin.com/bivuzabala
import { Selector } from 'testcafe';
fixture `Hover issue`.page `https://jsbin.com/bivuzabala`;
test('Hover Test',async t => {
const testroot = Selector('#testroot');
await t.hover(testroot.find('li'));
await t.expect(Selector('.dropdown').visible).ok('dropdown should be visible');
});