gpt4 book ai didi

automated-tests - 如何点击应该在 "touchmove"事件中消失的元素?

转载 作者:行者123 更新时间:2023-12-04 07:12:41 24 4
gpt4 key购买 nike

我正在为我们的 Web 应用程序的移动版本编写测试用例,但我无法单击设计为在“touchmove”事件时消失的弹出窗口。有什么办法可以克服这个特殊问题吗?

平台信息:
操作系统:Mac OS Mojave 10.14.13
TestCafe版本:1.0.1
Chrome 版本:72.0.03626
TestCafe 浏览器 值:chrome:emulation:device=iPhone X

当 testcafe 尝试执行点击时,弹出窗口消失。我试过先将鼠标悬停在该元素上,然后单击它,但这没有帮助。

这是处理“touchmove”事件的 React 代码

  componentDidUpdate(prevProps) {
if (!prevProps.undoRemove && this.props.undoRemove) {
window.addEventListener('touchmove', this.props.onHideUndo)
} else if (prevProps.undoRemove && !this.props.undoRemove) {
window.removeEventListener('touchmove', this.props.onHideUndo)
}
}

componentWillUnmount() {
if (this.props.undoRemove) this.props.onHideUndo()
window.removeEventListener('touchmove', this.props.onHideUndo)
}

验证该行为的代码:

test('Undo Popup - Click on "Undo" button should return item back', async t => {
const defItemCount = await page.itemCount;
const rItemId = await page.getItemByIndex(1).info.sku.textContent;

await page.removeItemByIndex(1);
await t.expect(page.itemCount).notEql(defProdCount);
await t.click(page.undoPopup.undoButton);
await t.expect(page.itemCount).eql(defItemCount);
})

我希望在 testcafe click 操作中我点击了那个按钮,在 drag 操作中,它应该会按预期消失。

最佳答案

据我了解,问题的原因是 touchmove 事件强制关闭弹出窗口。单击任何元素不应引发 touchmove 事件,因此我创建了一个单独的 ticket。在 TestCafe 存储库中。请跟踪它以查看进度

关于automated-tests - 如何点击应该在 "touchmove"事件中消失的元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54747078/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com