Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

303
Vistas
How to run multiple tests in Cypress without closing browser?

I have a 3 spec files for testing form filling and photo uploading using cypress.

  1. spec file: Fill a form
  2. spec file: Upload a photo
  3. spec file: Check the results

Form is - https://demoqa.com/automation-practice-form

Problem is when fill a form test passes, browser is closed and 2 other test fail because I don't call open url in each test case.

If I run tests in GUI, everything is fine. Browser is not closed after first test, but when I run

npx cypress run --headed --browser chrome

from command line, problem occures.

I want to run tests from command line so browser doesn't close till all tests are finished.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I got exactly same problem and after hours of research I found a workaround that solves this. It is not a real fix but it solves your issue and mine. Here are the steps I did:

Create a 4th spec file, call it main.spec.ts, inside this file do an import for the 3 spec files you have:

import './fillform.spec.js'
import './uploadphoto.spec.js'
import './result.spec.js'

In cypress.json file, add the following entry to allow to run only the main spec file:

"testFiles": ["main.spec.js"],

Now cypress run will work exactly as cypress open and all specs will run without closing the browser in between:

npx cypress run --headed --browser chrome
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda