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

107
Visualizações
Cypress extension background stops working between specs

I have a group of three e2e tests which I am converting from Cypress 8.7 to 10.3 with the end goal of being able to take advantage of Cypress' component testing.

The tests all work both as a group and as individual specs (via --spec <path>) in 8.7.

After converting to 10.3, I have a spec which calls a common command which clicks a button (which the extension adds to a page), which fires its listener and calls chrome.runtime.sendMessage with a message to open the extension UI. In this particular case, the content script is handling its own message (which is technically redundant), but since there are other cases which communicate with the background script, we use the same sendMessage call for consistency (this works every time in the actual Chrome environment). To facilitate this, the background script has a listener which effectively sends the message back to the sending tab for messages it does not directly handle.

  • Spec 1: always works
  • Spec 2: always works when run alone with --spec, and never works when all the tests are run together
  • Spec 3: same as spec 2

I do not believe it is a race condition, as no amount of cy.wait() has been successful. I can verify that the portion of the content script registering the event with chrome.runtime.onMessage.addListener runs at the start of each spec (both alone and all together). However, it never runs when clicking the button (even when paused and manually clicking).

I have the extension manifest setup for the tests to only match the URLs being visited by cypress and have that combined with all_frames: true, resulting in the extension button only showing in the content window and not the overall Cypress chrome window. Logging document at both the listener registration and the click listener logs the same document, so I don't think it is a cross-frame issue.

Based on the available logging from the background script, my conclusion is that it effectively stops running (breakpoints at the beginning of its message handler no longer fire). However, there's nothing to indicate why that might be.

If I place all the tests from those other specs into one spec, that call works as expected (although the tests still fail, presumably due to some other state which is cleared between specs). Is there something I can do to find out why the background script stops running between specs in Cypress 10.3?

One final note is that there are some uncaught and ignored errors in the background script. I am working on cleaning those up, but these tests have always worked in the past despite that (and work when run each spec is run alone), so I'm at a loss.

about 4 years ago · Santiago Trujillo
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