Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/faq/questions/using-cypress-faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -727,12 +727,16 @@ expand the APIs to support "switching into" an iframe and then back out of them.
## <Icon name="angle-right" /> How do I preserve cookies / localStorage in between my tests?

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

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

Alternatively, you can disable
[`testIsolation`](/guides/references/configuration#e2e) at the suite or e2e
configuration-level to prevent the clearing of browser state.

## <Icon name="angle-right" /> Some of my elements animate in; how do I work around that?

Oftentimes you can usually account for animation by asserting
Expand Down
7 changes: 4 additions & 3 deletions docs/guides/core-concepts/test-isolation.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ sidebar_position: 35

:::tip

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

:::

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

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

## Test Isolation in End-to-End Testing

Expand Down