This is an example showing how to stub window and console calls.
The application index.html has a single button that executes window.open on click. The application also prints "hello" to the console as soon as it loads.
- cypress/e2e/spec.cy.js stubs the
window.openmethod usingcy.stub(). Because the application executeswindow.openafter the click we create the method stub aftercy.visit
- cypress/e2e/spy-before-load.cy.js starts spying on
console.logduringcy.visitto confirm thatconsole.log('hello')is called when the page loads.

