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

328
Vistas
Is there an way in cypress to assert a new tab opening without target or remove attribute as i have href as something like this?

I have the element something like this and i am writing the code something like this to click

Then('I click on the Help Icon > {string}', (option) => {
    cy.get('.icon-help').click({ force: true })
    cy.get('ul a')
        .contains(option)
        .click({ force: true })
});

as i need to click first and assert that the page is opening in the next step but the page is opening in a new tab and to remove attribute or _target there is no target attribute.Its completely opening in new tab so how i can assert that the page opening in new tab? enter image description here

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

0

Since there's no href, it might be that there's a click handler that calls window.open.

If so, stub the call and assert it was called.

cy.get('.icon-help').click({ force: true })

cy.window().then(win => {
  cy.stub(win, 'open').as('open')
})
cy.get('ul a').contains(option).click({ force: true })
cy.get('@open').should('have.been.called')
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