Leonardo de Jesus
Leonardo de Jesus

Reputation: 417

Is there a way to see in cypress electron browser some logging?

I am using cypress to test my web site. Everything works great but there is one page that opens fine when I am running the test using chrome but if I try to run that against headless or regular electron the lhes simply don’t open. I am assuming that there must be something on my code that is not working on the chromium version that electron uses (61) that do works the version that chromes uses (75).

Is there a way to debug or check some logging on what is not being able to execute? The console for electron does not display anything.

Any ideas?

Upvotes: 2

Views: 2904

Answers (2)

Filip Kwiatkowski
Filip Kwiatkowski

Reputation: 665

After adding these two env variables Cypress started showing console.log output on the terminal:

ELECTRON_ENABLE_LOGGING=true DEBUG=cypress:electron $(npm bin)/cypress run ...

Upvotes: 4

Zach Bloomquist
Zach Bloomquist

Reputation: 5871

You can show console.log messages from Electron by enabling a subset of DEBUG logs.

Like so:

  • Windows:
    npm i -g cross-env
    cross-env DEBUG=cypress:server:browsers:electron cypress run...
    
  • macOS or Linux:
    DEBUG=cypress:server:browsers:electron cypress run...
    

Upvotes: 4

Related Questions