Skip to content

Commit 97d7533

Browse files
emilyrohrboughmschileBlueWindsdebrisapronBen M
authored
v12 Migration Guide (#4862)
Co-authored-by: Matt Schile <[email protected]> Co-authored-by: Blue F <[email protected]> Co-authored-by: DEBRIS APRON <[email protected]> Co-authored-by: Ben M <[email protected]> Closes undefined
1 parent 08ee351 commit 97d7533

File tree

3 files changed

+385
-126
lines changed

3 files changed

+385
-126
lines changed

content/_changelogs/12.0.0.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
## 11.0.0
1+
## 12.0.0
22

33
_Released MM/DD/YYYY_
44

55
**Breaking Changes:**
66

77
- `experimentalSessionAndOrigin` flag has been removed and all functionality is
88
on by default now.
9-
- `testIsolation` defaults to `strict` now.
9+
- The new concept of `testIsolation` has been introduced and it defaults to
10+
`on`.
11+
- Cypress now throws an error if commands are invoked from inside a `.should()`
12+
callback. This previously resulted in unusual and undefined behavior; it is
13+
now explicitly an error.
1014
- `Cookies.defaults` and `Cookies.preserveOnce` have been removed. Please update
1115
to use [`cy.session()`](/api/commands/session) to preserve session details
1216
between tests. Addresses
1317
[#21472](https://github.com/cypress-io/cypress/issues/21472).
18+
- The` cy.server()` and` cy.route()` commands and the `Cypress.Server.defaults`
19+
API has been removed. Use [`cy.intercept()`(/api/commands/intercept) instead.
20+
Addressed in [#24411](https://github.com/cypress-io/cypress/pull/24411).

content/guides/core-concepts/writing-and-organizing-tests.md

Lines changed: 19 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ title: Writing and Organizing Tests
1717

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

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

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

565565
### Test Isolation
566566

567-
<Alert type="warning">
568-
569-
<strong class="alert-header"><Icon name="exclamation-triangle"></Icon>
570-
Experimental</strong>
571-
572-
The concept of test isolation is currently experimental, and can be enabled by
573-
setting the [`experimentalSessionAndOrigin`](/guides/references/experiments)
574-
option to `true` in the Cypress config.
575-
576-
</Alert>
577-
578567
<Alert type="success">
579568

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

620609
###### On Mode
621610

622-
<Alert type="warning">
623-
624-
<strong class="alert-header"><Icon name="exclamation-triangle"></Icon>
625-
Experimental</strong>
626-
627-
`on` mode is currently experimental and can be enabled by setting
628-
the [`experimentalSessionAndOrigin`](/guides/references/experiments) flag
629-
to `true` in the Cypress config. This is the default test isolation behavior
630-
when using the `experimentalSessionAndOrigin` experiment.
631-
632-
</Alert>
633-
634-
When in `on` mode, Cypress resets the browser context _before_ each test by:
611+
This is the default test isolation behavior in Cypress. When in `on` mode,
612+
Cypress resets the browser context _before_ each test by:
635613

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

653631
###### Off Mode
654632

655-
<Alert type="warning">
656-
657-
<strong class="alert-header"><Icon name="exclamation-triangle"></Icon>
658-
Experimental</strong>
659-
660-
`off` mode is currently experimental and can be enabled by setting
661-
the [`experimentalSessionAndOrigin`](/guides/references/experiments) flag
662-
to `true` in the Cypress config.
663-
664-
</Alert>
665-
666633
When in `off` mode, Cypress will not alter the browser context before the test
667634
starts. The page does not clear between tests and cookies, local storage and
668635
session storage will be available across tests in that suite. Additionally, the
669636
`cy.session()` command will only clear the current browser context when
670637
establishing the browser session - the current page will not clear.
671638

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

678646
###### Mode Comparison
679647

@@ -686,13 +654,16 @@ one other.
686654

687655
Cypress only support testIsolation `on` in component testing.
688656

689-
When running component tests, the browser context will allow start in a clean
690-
slate because Cypress will
657+
When running component tests, Cypress resets the browser context _before_ each
658+
test by:
691659

692-
- clear the page
693-
- clear [cookies](/api/cypress-api/cookies)
694-
- clear
660+
- clearing the page
661+
- clearing [cookies](/api/cypress-api/cookies)
662+
- clearing
695663
[`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage)
664+
- clearing
665+
[`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage)
666+
in all domains
696667

697668
### Test Configuration
698669

0 commit comments

Comments
 (0)