You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set localStorage item. Equivalent to `localStorage.setItem` in browser:
66
+
51
67
```js
52
-
cy.getLocalStorage("item") // Get localStorage item
68
+
cy.setLocalStorage("item", "value");
53
69
```
54
70
71
+
Remove localStorage item. Equivalent to `localStorage.removeItem` in browser:
72
+
55
73
```js
56
-
cy.setLocalStorage("item", "value") // Set localStorage item
74
+
cy.removeLocalStorage("item");
57
75
```
58
76
77
+
### Preserving local storage between tests
78
+
79
+
Use `saveLocalStorage` to save a snapshot of current `localStorage` at the end of one test, and use the `restoreLocalStorage` command to restore it at the beginning of another one:
0 commit comments