Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```javascript
- // Colar esses comandos no arquivo cypress/support/index.js
- Cypress.Commands.add('saveLocalStorage', () => {
- Object.keys(localStorage).forEach(key => {
- LOCAL_STORAGE_MEMORY[key] = localStorage[key];
- });
- });
- Cypress.Commands.add('restoreLocalStorage', () => {
- Object.keys(LOCAL_STORAGE_MEMORY).forEach(key => {
- localStorage.setItem(key, LOCAL_STORAGE_MEMORY[key]);
- });
- });
- // quando você deseja persistir o localStorage
- cy.saveLocalStorage();
- // Dentro de cada 'describe'
- beforeEach(() => {
- cy.restoreLocalStorage();
- });
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement