当 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/