【问题标题】:Hide Testcafe Overlay隐藏 Testcafe 覆盖
【发布时间】: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 来排队调用隐藏覆盖的函数,以便它排队并且仅在调用调试并且覆盖可见后执行.

虽然没有工作 :( 代码没有执行,得到一个未处理的承诺拒绝。 真的可以在这里使用一些帮助,谢谢:)

【问题讨论】:

标签: debugging testing automated-tests overlay testcafe


【解决方案1】:

是的,您可以通过单击页脚中的“解锁页面”按钮来解锁页面,正如评论中提到的@VysakhMohan。

详情请咨询client-side debugging documentation

【讨论】:

  • 希望使用 Javascript 来执行此操作,因此用户无需解锁它。
  • 页面默认是锁定的,以防止一些可能导致意外结果的意外操作。我希望页面被锁定。
猜你喜欢
  • 2015-11-28
  • 1970-01-01
  • 2017-09-21
  • 1970-01-01
  • 2018-04-29
  • 2012-05-22
  • 2013-12-12
  • 2011-02-05
  • 1970-01-01
相关资源
最近更新 更多