You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following example is copied from this issue, it shows how to stub navigator.cookieEnabled.
cy.visit("http://localhost:3000",{onBeforeLoad(win){cy.stub(win.navigator,"cookieEnabled",false);// works fine},});
This example still works today with Cypress 9.5.0 but my code editor warns me it is deprecated (and since I'm using TypeScript, it expects a function as a third parameter instead of a single value). I tried using the syntax show on the documentation but I can't make it work.
cy.visit("http://localhost:3000",{onBeforeLoad(win){cy.stub(win.navigator,"cookieEnabled").returns(false);// Doesn't do anything},});
I guess this is because cy.stub(...).returns(value) is supposed to be used with functions/methods instead of simple properties?. Is there any other way to do this today?.
The text was updated successfully, but these errors were encountered:
The following example is copied from this issue, it shows how to stub
navigator.cookieEnabled
.This example still works today with Cypress 9.5.0 but my code editor warns me it is deprecated (and since I'm using TypeScript, it expects a function as a third parameter instead of a single value). I tried using the syntax show on the documentation but I can't make it work.
I guess this is because
cy.stub(...).returns(value)
is supposed to be used with functions/methods instead of simple properties?. Is there any other way to do this today?.The text was updated successfully, but these errors were encountered: