我正在为我们的Web应用程序的移动版本编写一个测试用例,并且我无法单击旨在在“ touchmove”事件中消失的弹出窗口。有什么办法可以克服这个特殊的问题?
平台信息:操作系统:Mac OS Mojave 10.14.13TestCafe版本:1.0.1Chrome版本:72.0.03626TestCafe browsers
值: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
事件,因此我在TestCafe存储库中创建了单独的ticket。请跟踪以查看进度