Skip to content

Instantly share code, notes, and snippets.

@Julianhm9612
Last active March 24, 2023 20:30
Show Gist options
  • Save Julianhm9612/3682e458598a6994a73b1befd88e308d to your computer and use it in GitHub Desktop.
Save Julianhm9612/3682e458598a6994a73b1befd88e308d to your computer and use it in GitHub Desktop.
it('Validate the images displayed', () => {
cy.get('.v-image__image').each(($el) => {
const image = $el.css('background-image').replace('url("', '').replace('")', '')
cy.request(image).then((res) => {
expect(res.status).to.eql(200);
});
});
});
it('Validate the images displayed', () => {
cy.get('.image', { includeShadowDom: true })
.filter('[src]')
.should(($imgs) => $imgs.map((i, /** @type {HTMLImageElement} */ img) => expect(img.naturalWidth).to.be.greaterThan(0)));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment