worried-pager-99039
11/17/2022, 7:55 PMcypress open and having an actual browser where the test runs the following code is working:
ts
beforeEach(() => {
Cypress.on("window:before:load", (window) => {
window.localStorage.setItem("some_key", "some_value")
window.localStorage.setItem("another_key", "another_value");
})
})
But running this with cypress run --headless --browser electron does not work and it seems like that the items are not set inside localStorage. I tried to check it with
ts
expect(localStorage.getItem("some_key")).to.not.be.null;
expect(localStorage.getItem("another_key")).to.not.be.null;
Is there a way to set some localStorage items in the headless mode to get rid of my cookie banner?