Testcafe Hover和jQuery:hover-selector

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');
});
yunhaigufan 回答:Testcafe Hover和jQuery:hover-selector

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3152567.html

大家都在问