When setting a property on the window object, it is not available to the running application.
The property set on the window object should persist and the running application should be able to access it.
cy.window().then(window => window.disableIntercom = true);
Cypress v3.0.3
Chrome 59 I think
log the property in your application
This depends on when you log in your application. Your app may load and hit the console.log
before the property is being set in your test. Your best bet is to use the onBeforeLoad
callback of cy.visit
:
cy.visit('/', {
onBeforeLoad (win) {
win.disableIntercom = true
}
})
in the developer tools console
Since your app runs in an iframe, you may need to switch to it so that window
is your app's window and not the 'top' window that Cypress runs in.
Thanks for the info @chrisbreiding I did not see the window switcher in the developer tools, that should help.
@chrisbreiding thank you worked perfectly
Most helpful comment
This depends on when you log in your application. Your app may load and hit the
console.log
before the property is being set in your test. Your best bet is to use theonBeforeLoad
callback ofcy.visit
:Since your app runs in an iframe, you may need to switch to it so that
window
is your app's window and not the 'top' window that Cypress runs in.