简体   繁体   中英

Cypress: how to print tested app's console errors into terminal output?

When cypress is run in headless mode it's not possible to see console errors in the browser.

I expect to see browser's error in the terminal:

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'

instead I only get:

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'

There are cases when same tests are passing locally (browser and headless) but fail in CI (ie in gitlab pipeline), having only raw terminal output without any browser console errors makes it really difficult to tell why those tests are failing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM