Skip to content

Commit 4dee86a

Browse files
Correct cookie/local storage FAQ (#5103)
Co-authored-by: Bill Glesias <[email protected]>
1 parent 266f6f2 commit 4dee86a

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

docs/faq/questions/using-cypress-faq.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,12 +727,16 @@ expand the APIs to support "switching into" an iframe and then back out of them.
727727
## <Icon name="angle-right" /> How do I preserve cookies / localStorage in between my tests?
728728

729729
By default, Cypress automatically
730-
[clears all cookies **before** each test](/api/commands/clearcookies) to prevent
731-
state from building up.
730+
[clears all cookies, local storage and session **before** each test](/guides/core-concepts/test-isolation)
731+
to prevent state from leaking between tests.
732732

733733
You can preserve session details across tests using the
734734
[`cy.session()`](/api/commands/session) command.
735735

736+
Alternatively, you can disable
737+
[`testIsolation`](/guides/references/configuration#e2e) at the suite or e2e
738+
configuration-level to prevent the clearing of browser state.
739+
736740
## <Icon name="angle-right" /> Some of my elements animate in; how do I work around that?
737741

738742
Oftentimes you can usually account for animation by asserting

docs/guides/core-concepts/test-isolation.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ sidebar_position: 35
1717

1818
:::tip
1919

20-
<Icon name="check-circle" color="green"></Icon> **Best Practice:** Tests should
21-
always be able to be run independently from one another **and still pass**.
20+
&#8239;<Icon name="check-circle" color="green"></Icon> **Best Practice:** Tests
21+
should always be able to be run independently from one another **and still
22+
pass**.
2223

2324
:::
2425

@@ -48,7 +49,7 @@ consistently when ran. This behavior is described as `testIsolation`.
4849

4950
The test isolation is a global configuration and can be overridden for
5051
end-to-end testing at the `describe` level with the
51-
[`testIsolation`](/guides/references/configuration#Global) option.
52+
[`testIsolation`](/guides/references/configuration#e2e) option.
5253

5354
## Test Isolation in End-to-End Testing
5455

0 commit comments

Comments
 (0)