【发布时间】:2020-03-05 08:15:05
【问题描述】:
我正在尝试使用 testcafe 在页面上填写表格。 填写表格后,我希望能够在窗口仍然打开的情况下停止测试,以便人们可以在点击提交之前查看表格。
我可以使用 t.debug() 暂停测试,但这会锁定页面并在底部显示 testcafe 控件覆盖。
有没有办法可以删除此叠加层并解锁页面?
我尝试过使用客户端函数来隐藏带有 javascript 的元素,如下所示:
test('test_1', async (t) => {
const hideOverlay = ClientFunction(function() {
const target = document.querySelector('#root-hammerhead-shadow-ui > div > div');
target.style.display = 'none';
return true;
})
await t.wait(5000);
setTimeout(async function() {
const res = await hideOverlay();
console.log('-------->', { res });
}, 6000);
await t.debug();
});
由于在调用调试后不会执行任何代码,我想我可以使用 settimeout 来排队调用隐藏覆盖的函数,以便它排队并且仅在调用调试并且覆盖可见后执行.
虽然没有工作 :( 代码没有执行,得到一个未处理的承诺拒绝。 真的可以在这里使用一些帮助,谢谢:)
【问题讨论】:
-
在使用 t.debug() 时,底部的 testcafe 控件覆盖层上会有一个“解锁页面”按钮,您可以单击它并解锁页面。 devexpress.github.io/testcafe/documentation/test-api/…
-
我希望有办法用 javascript 代码做到这一点
标签: debugging testing automated-tests overlay testcafe