关于以下错误:
Uncaught Error: Script error.
Cypress detected that an uncaught error was thrown from a cross origin script.
We cannot provide you the stack trace, line number, or file where this error occurred.
参考文献https://docs.cypress.io/api/events/catalog-of-events.html#To-catch-a-single-uncaught-exception https://docs.cypress.io/api/events/catalog-of-events.html#To-catch-a-single-uncaught-exception
我正在尝试运行一个填写表单并单击按钮提交的测试:
it('adds biological sample with maximal input', function(){
cy.on('uncaught:exception', (err, runnable) => {
expect(err.message).to.include('of undefined')
done()
return false
});
cy.get('a').contains('Add biological sample').click();
. . .
cy.contains('Action results');
});
尽管我的规范包含以下内容,但我收到错误:
cy.on('uncaught:exception', (err, runnable) => {
expect(err.message).to.include('of undefined')
done()
return false
});
Here's an image of the test failing .
左下角的错误如下:
错误:未捕获断言错误:预期 '$f 未定义\n\n这
错误源自您的应用程序代码,而不是来自赛普拉斯。
\n\n当赛普拉斯检测到源自您的未捕获错误时
应用程序将自动使当前测试失败。\n\n这
行为是可配置的,您可以选择通过以下方式关闭它
聆听“未捕获:异常”
事件。\n\nhttps://on.cypress.io/uncaught-exception-from-application'
包括“未定义”
(https://www.flukebook.org/_cypress/runner/cypress_runner.js:49186 https://www.flukebook.org/_cypress/runner/cypress_runner.js:49186)
看来我接受了赛普拉斯的建议,但没有得到想要的结果。有什么建议么?这有发生在其他人身上吗?