function updateVaultItemList(vaultUrl, vaultItems) { window.localStorage.setItem('swh-vault-cooking-tasks', JSON.stringify(vaultItems)); return cy.visit(vaultUrl); } it('should display and upgrade previous cooking tasks from the legacy format', function() { updateVaultItemList(this.Urls.browse_vault(), this.legacyVaultItems).then(() => { // here we are sure that localStorage content has been modified and processed // by code in vault-ui.js file }); });