gpt4 book ai didi

由于应用程序代码错误, Cypress 测试失败

转载 作者:行者123 更新时间:2023-12-04 15:39:32 26 4
gpt4 key购买 nike

Cypress 测试失败是由于应用程序代码错误而不是我的代码错误。我试图通过使用下面的代码绕过错误,但它仍然不起作用。我可以看到 Cypress 团队在 Github 中打开了类似的错误,但有人可以提供解决方法,如果有的话?

on('uncaught:exception', (err, runnable) => {

return false
})

最佳答案

来自 https://github.com/cypress-io/cypress/issues/987 :

[Cypress doesn't] have a handler on top.onerror, only on the spec iframe and app iframe, and some errors will bubble straight to top.



作为一种解决方法,您可以将其添加到规范文件的顶部或 support/index.js :


// ignore uncaught exceptions
Cypress.on('uncaught:exception', (err) => {
return false
})

// patch Cypress top.onerror
Object.defineProperty(top, 'onerror', {
value: window.onerror,
})

关于由于应用程序代码错误, Cypress 测试失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58372833/

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