javascript - Cypress:如何将经过测试的应用程序的控制台错误打印到终端输出中?

标签 javascript cypress

当 cypress 在 headless 模式下运行时,不可能在浏览器中看到控制台错误。

我希望在终端中看到浏览器的错误:

Console error: GET http://localhost/main.js net::ERR_ABORTED 404 (Not Found)

CypressError: Timed out retrying: cy.type() failed because this element is not visible:

This element '' is not visible because its parent '' has CSS property: 'display: none'



相反,我只得到:

CypressError: Timed out retrying: cy.type() failed because this element is not visible:

This element '' is not visible because its parent '' has CSS property: 'display: none'



有些情况下,相同的测试在本地(浏览器和 headless )通过,但在 CI 中失败(即在 gitlab 管道中),只有原始终端输出而没有任何浏览器控制台错误,这使得很难说出这些测试失败的原因。

最佳答案

关于javascript - Cypress:如何将经过测试的应用程序的控制台错误打印到终端输出中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55303738/

相关文章:

javascript - 用于面向用户的字符串的常量中间件

javascript - php mysql 在一页和一个查询中插入多行数据

cypress - 声明一个不断变化的属性

Cypress 无法点击自定义按钮

javascript - Cypress /JavaScript : Parameter on request path (response. body.VARIABLE)

javascript - NodeJS 函数内某些代码的最大调用次数不超过

javascript - 将数据附加到表中作为变量

javascript - AngularJS 数据-ng- Controller 不起作用

npm - Cypress-webpack-preprocessor 的 Webpack 编译错误

Cypress拦截不等待