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

206
Vistas
Validate CSS 'backgroud-image' URL using Cypress

I am trying to validate if the CSS 'backgroud-image' URL has status code '200'. Is it possible to validate loading of images using Cypress. Can anyone please suggest?

it('Validate the images displayed',() => {
    cy.get('.logo').each(($el,index,$list) => {
        expect($el).to.have.css('background-image','*should pass dynamic url image*')     
    })
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

After you get the element, you can use a JQuery function to return the background-image css value ($el.css('css-property')), and use that in a cy.request() function where you validate it is a 200.

it('Validate the images displayed',() => {
    cy.get('.logo').each(($el) => {
        // $el.css('background-image') => may take some formatting to be just right, depending on what is returned by that function.
        cy.request($el.css('background-image')).then((res) => {
             expect(res.statusCode).to.eql(200);
        });     
    });
});
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