Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v12 Migration Guide #4862

Merged
merged 26 commits into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1c50105
r1 - migration guide content
emilyrohrbough Nov 15, 2022
5e1a18a
r2 - remove test isolation experimental reference
emilyrohrbough Nov 16, 2022
2435390
include should in v12 changes
emilyrohrbough Nov 21, 2022
e998b1d
Update 12.0.0.md
Nov 29, 2022
48d4807
Update writing-and-organizing-tests.md
Nov 29, 2022
4c82587
Update content/guides/references/migration-guide.md
emilyrohrbough Nov 29, 2022
05fb3e3
Update content/guides/references/migration-guide.md
emilyrohrbough Nov 29, 2022
820f134
Update content/guides/references/migration-guide.md
emilyrohrbough Nov 29, 2022
c35e709
.
emilyrohrbough Nov 29, 2022
eb94eb4
add dropped node support to migration guide
emilyrohrbough Nov 29, 2022
93ae489
updates / pr feedback
emilyrohrbough Nov 30, 2022
73a2b4a
use blues words
emilyrohrbough Nov 30, 2022
188825b
fix markdown
emilyrohrbough Nov 30, 2022
98a0482
Apply suggestions from code review
emilyrohrbough Dec 1, 2022
90f63b8
Apply suggestions from code review
emilyrohrbough Dec 1, 2022
a739fc7
Apply suggestions from code review
emilyrohrbough Dec 1, 2022
4f6fd8e
Apply suggestions from code review
emilyrohrbough Dec 1, 2022
b0ae517
Update content/guides/core-concepts/writing-and-organizing-tests.md
emilyrohrbough Dec 2, 2022
2766b72
Update content/guides/references/migration-guide.md
emilyrohrbough Dec 2, 2022
f9f731d
Apply suggestions from code review
emilyrohrbough Dec 2, 2022
e3c1bd8
Update content/guides/references/migration-guide.md
emilyrohrbough Dec 2, 2022
da37846
Update content/guides/core-concepts/writing-and-organizing-tests.md
emilyrohrbough Dec 2, 2022
e482ae3
Update content/guides/references/migration-guide.md
emilyrohrbough Dec 2, 2022
01f930b
Update content/guides/references/migration-guide.md
emilyrohrbough Dec 2, 2022
26d7407
Update content/guides/references/migration-guide.md
emilyrohrbough Dec 2, 2022
ec98686
fix markdown
emilyrohrbough Dec 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions content/_changelogs/12.0.0.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
## 11.0.0
## 12.0.0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll open a follow up PR for the changelog. This is more for notes at this time.


_Released MM/DD/YYYY_

**Breaking Changes:**

- `experimentalSessionAndOrigin` flag has been removed and all functionality is
on by default now.
- `testIsolation` defaults to `strict` now.
- The new concept of `testIsolation` has been introduced and it defaults to
`on`.
debrisapron marked this conversation as resolved.
Show resolved Hide resolved
- Cypress now throws an error if commands are invoked from inside a `.should()`
callback. This previously resulted in unusual and undefined behavior; it is
now explicitly an error.
- `Cookies.defaults` and `Cookies.preserveOnce` have been removed. Please update
to use [`cy.session()`](/api/commands/session) to preserve session details
between tests. Addresses
[#21472](https://github.com/cypress-io/cypress/issues/21472).
- The` cy.server()` and` cy.route()` commands and the `Cypress.Server.defaults`
API has been removed. Use [`cy.intercept()`(/api/commands/intercept) instead.
Addressed in [#24411](https://github.com/cypress-io/cypress/pull/24411).
67 changes: 19 additions & 48 deletions content/guides/core-concepts/writing-and-organizing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ title: Writing and Organizing Tests

<strong class="alert-header">Best Practices</strong>

We recently gave a "Best Practices" conference talk at AssertJS (February 2018).
This video demonstrates how to approach breaking down your application and
organizing your tests.
We gave a "Best Practices" conference talk at AssertJS (February 2018). This
video demonstrates how to approach breaking down your application and organizing
your tests.

<Icon name="play-circle"></Icon>
[https://www.youtube.com/watch?v=5XQOK0v_YRE](https://www.youtube.com/watch?v=5XQOK0v_YRE)
Expand Down Expand Up @@ -564,17 +564,6 @@ it.skip('returns "fizz" when number is multiple of 3', () => {

### Test Isolation

<Alert type="warning">

<strong class="alert-header"><Icon name="exclamation-triangle"></Icon>
Experimental</strong>

The concept of test isolation is currently experimental, and can be enabled by
setting the [`experimentalSessionAndOrigin`](/guides/references/experiments)
option to `true` in the Cypress config.

</Alert>

<Alert type="success">

<Icon name="check-circle" color="green"></Icon> **Best Practice:** Tests should
Expand Down Expand Up @@ -619,19 +608,8 @@ and `off`.

###### On Mode

<Alert type="warning">

<strong class="alert-header"><Icon name="exclamation-triangle"></Icon>
Experimental</strong>

`on` mode is currently experimental and can be enabled by setting
the [`experimentalSessionAndOrigin`](/guides/references/experiments) flag
to `true` in the Cypress config. This is the default test isolation behavior
when using the `experimentalSessionAndOrigin` experiment.

</Alert>

When in `on` mode, Cypress resets the browser context _before_ each test by:
This is the default test isolation behavior in Cypress. When in `on` mode,
Cypress resets the browser context _before_ each test by:

- clearing the dom state by visiting `about:blank`
- clearing [cookies](/api/cypress-api/cookies) in all domains
Expand All @@ -652,28 +630,18 @@ is so tests can reliably pass when run standalone or in a randomized order.

###### Off Mode

<Alert type="warning">

<strong class="alert-header"><Icon name="exclamation-triangle"></Icon>
Experimental</strong>

`off` mode is currently experimental and can be enabled by setting
the [`experimentalSessionAndOrigin`](/guides/references/experiments) flag
to `true` in the Cypress config.

</Alert>

When in `off` mode, Cypress will not alter the browser context before the test
starts. The page does not clear between tests and cookies, local storage and
session storage will be available across tests in that suite. Additionally, the
`cy.session()` command will only clear the current browser context when
establishing the browser session - the current page will not clear.

It is important to note that turning test isolation `off` may improve the
overall performance of end-to-end tests, however, previous tests could be impact
the browser state. It is important to be extremely mindful of how test are
written when using this mode and ensure tests continue to run independent from
one other.
It is important to note that while turning test isolation `off` may improve the
overall performance of end-to-end tests, it can however cause state to "leak"
between tests. This can make later tests dependent on the results of earlier
tests, and potentially cause misleading test failures. It is important to be
extremely mindful of how tests are written when using this mode, and ensure that
tests continue to run independently of one another.

###### Mode Comparison

Expand All @@ -686,13 +654,16 @@ one other.

Cypress only support testIsolation `on` in component testing.

When running component tests, the browser context will allow start in a clean
slate because Cypress will
When running component tests, Cypress resets the browser context _before_ each
test by:

- clear the page
- clear [cookies](/api/cypress-api/cookies)
- clear
- clearing the page
- clearing [cookies](/api/cypress-api/cookies)
- clearing
[`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage)
- clearing
[`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage)
in all domains

### Test Configuration

Expand Down