We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8d1d882 + ae107df commit 32d17eeCopy full SHA for 32d17ee
cypress/integration/utils/cypress-command/local-storage.js
@@ -0,0 +1,15 @@
1
+//https://github.com/cypress-io/cypress/issues/461#issuecomment-325402086
2
+const command = () => {
3
+ let LOCAL_STORAGE_MEMORY = {}
4
+ Cypress.Commands.add("saveLocalStorage", () => {
5
+ Object.keys(localStorage).forEach((key) => {
6
+ LOCAL_STORAGE_MEMORY[key] = localStorage[key]
7
+ })
8
9
+ Cypress.Commands.add("restoreLocalStorage", () => {
10
+ Object.keys(LOCAL_STORAGE_MEMORY).forEach((key) => {
11
+ localStorage.setItem(key, LOCAL_STORAGE_MEMORY[key])
12
13
14
+}
15
+export default command
0 commit comments