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

240
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 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