I am testing a website with Cypress; this website has the classic popup to accept cookies in the bottom part of the page. Since i'm testing a part of the website where there are a form with multiple steps (a page with some data, button next, another page, etc.), my issue is that every single time this cookie popup appears again for every page.
I think it's something about saving data in localStorage
, but I'm not sure how to manage it. I tried just putting cy.saveLocalStorage()
after the cy.get('a#cookiePopup').click()
, but it says that cy.localStorage is not a function
.
Any suggestion would be appreciated!
I am testing a website with Cypress; this website has the classic popup to accept cookies in the bottom part of the page. Since i'm testing a part of the website where there are a form with multiple steps (a page with some data, button next, another page, etc.), my issue is that every single time this cookie popup appears again for every page.
I think it's something about saving data in localStorage
, but I'm not sure how to manage it. I tried just putting cy.saveLocalStorage()
after the cy.get('a#cookiePopup').click()
, but it says that cy.localStorage is not a function
.
Any suggestion would be appreciated!
Share Improve this question asked Apr 8, 2021 at 8:46 Don DiegoDon Diego 1,5083 gold badges26 silver badges55 bronze badges1 Answer
Reset to default 6Solved: I found this that explains how to put cy.preserveOnce('<name-of-your-cookie>')
in the beforeEach
loop at start.
I'm putting this here for future reference.