Skip to content

Files

Latest commit

amirrustamcowboyjaffrepauljennifer-shehaneKevin Old
Jun 6, 2022
cc13866 · Jun 6, 2022

History

History

stubbing__resources

Stubbing Resources

The spec file cypress/e2e/spec.cy.js shows how to stub resources that are loaded e.g. by img tag. This works by observing DOM mutations and changing the src attribute.

When clicking onto the button in the index.html, a new img tag is created that is supposed to load images/rose.png. Instead we load a red image from the fixture file cypress/fixtures/picture.png.

Test example