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.

Unable to run all the tests with --headed and --no-exit flag

See original GitHub issue

Current behavior

Just migrated to Cypress 10.02 and followed the suggested migration recommendations. When running all my tests with the command cypress run --e2e --headed --no-exit only the first test runs. When running headless with cypress run --e2e all the tests runs.

I have tried different combos with specifying a browser adding/removing --no-exit flag but it doesn’t make any difference. Only one test runs.

I did notice that I get a message regarding WebSwapCGLLayer but not sure it’s related. Providing it in the output below.

Desired behavior

I would like to be able to run all my tests while being able to inspect the ui. Previously there was a β€œrun all” button. But since it’s removed there needs to be another way of running all the tests headful.

Test code to reproduce

Inside the folder cypress/e2e there are four test-files all following the convention name-of-test.cy.js.

Previous cypress.json

{ "chromeWebSecurity": false }

Current cypress.config.js

const { defineConfig } = require('cypress')

module.exports = defineConfig({
  chromeWebSecurity: false,
  e2e: {
    // We've imported your old cypress plugins here.
    // You may want to clean this up later by importing these.
    setupNodeEvents(on, config) {
      return require('./cypress/plugins/index.js')(on, config)
    },
  },
})

Output from the terminal

When running cypress run --e2e --headed --no-exit:

> cypress run --e2e --headed --no-exit

objc[8029]: Class WebSwapCGLLayer is implemented in both /System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.framework/Versions/A/Frameworks/libANGLE-shared.dylib (0x7ffa55f21318) and /Users/me/Library/Caches/Cypress/10.0.2/Cypress.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib (0x10ef7c9c8). One of the two will be used. Which one is undefined.
Missing baseUrl in compilerOptions. tsconfig-paths will be skipped

====================================================================================================

  (Run Starting)

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Cypress:        10.0.2                                                                         β”‚
  β”‚ Browser:        Electron 100                                                                   β”‚
  β”‚ Node Version:   v16.15.0 (/Users/me/.nvm/versions/node/v16.15.0/bin/node)                     β”‚
  β”‚ Specs:          4 found (first-test.cy.js, second-test.cy.js, third-test.cy.js, four           β”‚
  β”‚                 th-test.cy.js)                                                                 β”‚
  β”‚ Searched:       cypress/e2e/**/*.cy.{js,jsx,ts,tsx}                                            β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  first-test.cy.js                                                               (1 of 4)


  View things in first test
    βœ“ can run first test (23334ms)


  1 passing (25s)

not exiting due to options.exit being false

Cypress Version

10.0.2

Other

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lmiller1990commented, Jun 3, 2022

Right, I see the problem. I made a minimal reproduction: https://github.com/lmiller1990/cypress-run-all

I have tried different combos with specifying a browser adding/removing --no-exit flag but it doesn’t make any difference. Only one test runs.

yarn cypress run --e2e --headed works fine for me. I’m surprised it’s not for you. Can you clone the repo above and run yarn cypress run --e2e --headed? I recorded a video of it working on my machine, just to sanity check myself https://github.com/lmiller1990/cypress-run-all/blob/main/repro.mov. If you add DEBUG=cypress* in front of yarn cypress run... you can get a huge log, which you could copy paste here to further help with debugging.


I see the problem with --no-exit. The difference here (which is different to 9.x) is that we now close the browser between each spec, to clean up and do some other things. Because --no-exit is present, this blocks the closing, thus only the first spec runs. This is obviously a problem that we need to fix.

So we have two things

  1. not working with yarn cypress run --e2e --headed. Although I can’t reproduce it, this is a huge problem and the #1 priority - hopefully someone can share some information that will help reproduce it, so we can patch it.
  2. --no-exit causes first spec to hang.
0reactions
mjhenkescommented, Jun 3, 2022

Please leave feedback on the removal of the run all feature over here on the discussion: https://github.com/cypress-io/cypress/discussions/21628

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-exit flag causes Cypress to hang after first file in multiple ...
Current behavior: If cypress run is invoked with the --no-exit flag and the pattern to find specs matches multiple files, cypress will onlyΒ ......
Read more >
9 How To Run Cypress Tests in From Command Line - YouTube
In this video, I will show you how to run cypress using CLI commands. ... Command Line | Cypress Test Headed Mode |...
Read more >
Command Line - Cypress Documentation
By default, cypress run will run all tests headlessly. ... You can pass --headed --no-exit in order to view the command log or...
Read more >
How can I get Cypress to run a specific folder of tests by ...
I think you're looking for --spec path/to/folder/*.js. You can run all the tests in a folder, or even in all subfolders of a...
Read more >
cy.pause() now pauses test while running cypress run --headed
cy.pause() will not be ignored and pause a test when --headed and --no-exit flags are passed to cypress run.
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found