This is an example showing how to stub navigator.cookieEnabled
.
The application index.html displays a different message depending on whether the user has cookies enabled via the navigator.cookieEnabled
value.
- cypress/e2e/spec.cy.js stubs the
window.navigator.cookieEnabled
method usingcy.stub()
. We create the method stub within theonBeforeLoad
of thecy.visit()