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

239
Visualizações
Cypress - Timed out retrying after 4000ms: Expected to find element - only in Jenkins

I have a grouping of Cypress tests that are failing, only in my Jenkins environment. An entire describe block is failing to find an element. Every test in the block starts with the same commands:

describe("This section of tests", () => {
  it("Test for something in this section", () => {
    cy.login(); // custom login command, works in all other test blocks
    setupPage(); // page setup function, no problems in all other test blocks
    cy.wait(10000); // desperation wait

    cy.get("#toggle-detail-pane-button").click(); // issue here!
    // all tests in block run more assertions and commands after this
  });

  // more similar tests in block
});

// more describe blocks that also use cy.login and setupPage, with no issue

When I run these tests in the cypress test UI, they all pass. When I run them in the terminal on my machine with npx cypress run, they pass. When I ssh into a remote OpenStack terminal which is set up to run my project and run cypress, and run npx cypress run, they pass.

When I run the tests in Jenkins, which uses a handful of identical OpenStack instances to run cypress in parallel, the tests fail, consistently, with the following message:

AssertionError: Timed out retrying after 4000ms: Expected to find element: `#toggle-detail-pane-button`, but never found it.

      at Context.eval (http://localhost:3000/__cypress/tests?p=cypress/integration/stuff/mytests.spec.js:519:8)

I have tried reorganizing my tests, rewriting them, etc, but no luck. I cannot figure out what is going wrong here. My Jenkins environment uses a custom sorry-cypress setup, and for some reason, the dashboard is not registering the tests, so I can't go and view any screenshots or videos (that is a whole separate can-of-worms problem).

Why would only these tests fail only in my CI/CD env? How can I even begin to debug this?

Edit: screenshots

I was able to rerun the CI/CD with screenshots and videos, and then I was able to scp the files off of the instance with the failing tests. When running on my machine, cypress has no problem finding the element:

enter image description here

When using the cypress selector playground on my machine, it finds it as well:

enter image description here

But in the screenshot I pulled off of the openstack instance running exactly the same test, it can't find it:

enter image description here

(Sorry for all the green, this is a proprietary app)

What gives?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

That means there's an issue with your cy.visit() command. The page is not being loaded before the test that's why

about 4 years ago · Juan Pablo Isaza Relatório

0

I had a similar problem. I solved it by getting the element by a selector or class instead of its id.

I went from:

cy.get('#mat-options-text').click()

to

cy.get('mat-options').click()
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