File tree Expand file tree Collapse file tree 4 files changed +22
-26
lines changed Expand file tree Collapse file tree 4 files changed +22
-26
lines changed Original file line number Diff line number Diff line change 2
2
title : clearAllLocalStorage
3
3
---
4
4
5
- Clear localStorage data for all origins with which the test has interacted.
5
+ Clear
6
+ [ ` localStorage ` ] ( https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage )
7
+ data for all origins with which the test has interacted.
6
8
7
9
<Alert type =" warning " >
8
10
9
11
Cypress automatically runs this command _ before_ each test to prevent state from
10
- being shared across tests. You shouldn't need to use this command unless you're
11
- using it to clear localStorage inside a single test.
12
+ being shared across tests when
13
+ [ test isolation] ( /guides/core-concepts/writing-and-organizing-tests#Test-Isolation )
14
+ is ` on ` . You shouldn't need to use this command unless you're using it to clear
15
+ localStorage inside a single test or test isolation is ` off ` .
12
16
13
17
</Alert >
14
18
@@ -43,14 +47,6 @@ Pass in an options object to change the default behavior of
43
47
- ` cy.clearAllLocalStorage() ` yields ` null ` .
44
48
- ` cy.clearAllLocalStorage() ` cannot be chained further.
45
49
46
- ## Examples
47
-
48
- ### Clear all localStorage
49
-
50
- ``` javascript
51
- cy .clearAllLocalStorage ()
52
- ```
53
-
54
50
## Rules
55
51
56
52
### Requirements [ <Icon name =" question-circle " />] ( /guides/core-concepts/introduction-to-cypress#Chains-of-Commands )
Original file line number Diff line number Diff line change 2
2
title : clearAllSessionStorage
3
3
---
4
4
5
- Clear data in sessionStorage for all origins with which the test has interacted.
5
+ Clear
6
+ [ ` sessionStorage ` ] ( https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage )
7
+ data for all origins with which the test has interacted.
6
8
7
9
<Alert type =" warning " >
8
10
9
11
Cypress automatically runs this command _ before_ each test to prevent state from
10
- being shared across tests. You shouldn't need to use this command unless you're
11
- using it to clear sessionStorage inside a single test.
12
+ being shared across tests when
13
+ [ test isolation] ( /guides/core-concepts/writing-and-organizing-tests#Test-Isolation )
14
+ is ` on ` . You shouldn't need to use this command unless you're using it to clear
15
+ localStorage inside a single test or test isolation is ` off ` .
12
16
13
17
</Alert >
14
18
@@ -43,14 +47,6 @@ Pass in an options object to change the default behavior of
43
47
- ` cy.clearAllSessionStorage() ` yields ` null ` .
44
48
- ` cy.clearAllSessionStorage() ` cannot be chained further.
45
49
46
- ## Examples
47
-
48
- ### Clear all sessionStorage
49
-
50
- ``` javascript
51
- cy .clearAllSessionStorage ()
52
- ```
53
-
54
50
## Rules
55
51
56
52
### Requirements [ <Icon name =" question-circle " />] ( /guides/core-concepts/introduction-to-cypress#Chains-of-Commands )
Original file line number Diff line number Diff line change 2
2
title : getAllLocalStorage
3
3
---
4
4
5
- Get data in localStorage for all origins with which the test has interacted.
5
+ Get
6
+ [ ` localStorage ` ] ( https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage )
7
+ data for all origins with which the test has interacted.
6
8
7
9
## Syntax
8
10
@@ -33,7 +35,7 @@ Pass in an options object to change the default behavior of
33
35
### Yields [ <Icon name =" question-circle " />] ( /guides/core-concepts/introduction-to-cypress#Subject-Management )
34
36
35
37
` cy.getAllLocalStorage() ` yields an object where the keys are origins and the
36
- values are key-value pairs of localStorage data.
38
+ values are key-value pairs of ` localStorage ` data.
37
39
38
40
For example, if ` key1 ` is set to ` value1 ` on ` https://example.com ` and ` key2 ` is
39
41
set to ` value2 ` on ` https://other.com ` , ` cy.getAllLocalStorage() ` will yield:
Original file line number Diff line number Diff line change 2
2
title : getAllSessionStorage
3
3
---
4
4
5
- Get data in sessionStorage for all origins with which the test has interacted.
5
+ Get
6
+ [ ` sessionStorage ` ] ( https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage )
7
+ data for all origins with which the test has interacted.
6
8
7
9
## Syntax
8
10
@@ -33,7 +35,7 @@ Pass in an options object to change the default behavior of
33
35
### Yields [ <Icon name =" question-circle " />] ( /guides/core-concepts/introduction-to-cypress#Subject-Management )
34
36
35
37
` cy.getAllSessionStorage() ` yields an object where the keys are origins and the
36
- values are key-value pairs of sessionStorage data.
38
+ values are key-value pairs of ` sessionStorage ` data.
37
39
38
40
For example, if ` key1 ` is set to ` value1 ` on ` https://example.com ` and ` key2 ` is
39
41
set to ` value2 ` on ` https://other.com ` , ` cy.getAllSessionStorage() ` will yield:
You can’t perform that action at this time.
0 commit comments