DEV Community

Discussion on: Using Graphical User Interfaces like Cypress' in WSL2

Collapse
 
andreasgalster_91 profile image
Andreas Galster

Hey Nicky, thanks for this article, this has helped me a lot! Running Cypress for the first time on WSL, that's amazing!

What I've noticed is that it opens cypress but doesn't run the tests. Is there a way to automatically already execute the tests? I've tried doing

npm run cy:open --spec "cypress/integration/examples/location.spec.js"
Enter fullscreen mode Exit fullscreen mode

to run a specific spec for example but it doesn't run the actual test, it just opens the GUI. Any suggestions how to actually run through the tests automatically on cypress launch?

Collapse
 
nickymeuleman profile image
Nicky Meuleman

Glad it helped!

If you would like the tests to automatically start, use cypress run instead of cypress open. By default it runs in headless mode, so if you want to see the GUI you have to pass --headed as command line argument.

{
  "scripts": {
    "cy:run": "cypress run --headed"
  }
}

The docs to the CLI will tell you more details.

Collapse
 
andreasgalster_91 profile image
Andreas Galster

Sometimes the solution is so darn simple, makes you wonder how you didn't see it lol!

Thanks so much! I'm super excited to finally using Cypress in real-world scenarios, appreciate your help!