我试图隐藏 cypress 测试运行程序上的 XHR 调用。我已经在 my 中添加了以下代码,support/index.js但它仍然不起作用。
Cypress.Server.defaults({
delay:500,
force404:false,
ignore: (xhr) => {
return false;
},
})
Run Code Online (Sandbox Code Playgroud)
有人可以建议它是如何工作的吗?
Nil*_*ama 15
试试这个,对我有用
将以下内容添加到 cypress/support/index.js:
// Hide fetch/XHR requests
const app = window.top;
if (!app.document.head.querySelector('[data-hide-command-log-request]')) {
const style = app.document.createElement('style');
style.innerHTML =
'.command-name-request, .command-name-xhr { display: none }';
style.setAttribute('data-hide-command-log-request', '');
app.document.head.appendChild(style);
}
Run Code Online (Sandbox Code Playgroud)
参考并获得的详细信息https://gist.github.com/simenbrekken/3d2248f9e50c1143bf9dbe02e67f5399
| 归档时间: |
|
| 查看次数: |
8513 次 |
| 最近记录: |