Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

305
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda