question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: Record open devTools in screenshots and video during `cypress run`

See original GitHub issue

With these changes, it will no longer be possible to have opened the dev tools for electron in interactive mode and then have them automatically opened during a run. Also, it’s never been possible to explicitly tells other browsers to open their dev tools.

Add a flag (--dev-tools or --open-dev-tools) that will open the browser dev tools on launch so a debugger in test or app code can hit and pause the run for debugging purposes.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:53
  • Comments:21 (5 by maintainers)

github_iconTop GitHub Comments

10reactions
jennifer-shehanecommented, Jan 5, 2021

This is now possible in all supported browsers with the workaround below. See https://on.cypress.io/browser-launch-api#Modify-browser-launch-arguments

Closing as resolved.

// plugins/index.js
module.exports = (on, config) => {
  on('before:browser:launch', (browser = {}, launchOptions) => {
    // `args` is an array of all the arguments that will
    // be passed to browsers when it launches
    console.log(launchOptions.args) // print all current args

    if (browser.family === 'chromium' && browser.name !== 'electron') {
      // auto open devtools
      launchOptions.args.push('--auto-open-devtools-for-tabs')
    }

    if (browser.family === 'firefox') {
      // auto open devtools
      launchOptions.args.push('-devtools')
    }

    if (browser.name === 'electron') {
      // auto open devtools
      launchOptions.preferences.devTools = true
    }

    // whatever you return here becomes the launchOptions
    return launchOptions
  })
}
7reactions
mellis481commented, Mar 19, 2021

@jennifer-shehane This only appears to work with the Cypress test runner, not when you run Cypress headlessly (as @mjlawrence83 and @rbabayoff mentioned above). IMO automatically opening devtools during cypress open is a slight convenience whereas opening devtools while running Cypress headlessly would be of enormous benefit in situations where the cy.log’ed error isn’t helpful and one needs to troubleshoot an AOT error.

Please advise.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Screenshots and Videos - Cypress Documentation
Cypress records a video for each spec file when running tests during cypress run . Videos are not automatically recorded during cypress open...
Read more >
Cypress Tips and Tricks - Gleb Bahmutov
Read the docs Run Cypress on your own CI Record success and. ... place the debugger keyword and run the test with DevTools...
Read more >
agoldis/sorry-cypress-dashboard - Docker Image
Run your tests cypress run --parallel --record --key xxx --ci-build-id <buildId> ... S3 bucket preconfigured for storing screenshots and video recordings ...
Read more >
The top 7 advanced features of Cypress to know about
Cypress is a fully featured test runner, creating test reports and saving videos and screenshots during the test runs. This allows companies ...
Read more >
Screenshots and Videos in Cypress - Tools QA
Cypress provides in-built functionality for capturing screenshots and videos of various test runs. · By default, we capture screenshots only for ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found