From 1c50105d6eb5377e33ae1a8c6692f118a695aa6b Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Tue, 15 Nov 2022 13:05:57 -0600 Subject: [PATCH 01/44] r1 - migration guide content --- content/_changelogs/11.0.0.md | 3 + content/_changelogs/12.0.0.md | 6 +- .../writing-and-organizing-tests.md | 49 +-- content/guides/references/migration-guide.md | 383 ++++++++++++++---- 4 files changed, 332 insertions(+), 109 deletions(-) diff --git a/content/_changelogs/11.0.0.md b/content/_changelogs/11.0.0.md index 754d8b4f4f..849a41f4ce 100644 --- a/content/_changelogs/11.0.0.md +++ b/content/_changelogs/11.0.0.md @@ -71,6 +71,9 @@ which explains the breaking changes in more detail.** unauthorized calls. If you use a self-signed CA you will need to set `npm_config_ca`, `npm_config_cafile`, or `NODE_EXTRA_CA_CERTS`. Addresses [#23980](https://github.com/cypress-io/cypress/issues/23980). +- 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. ###### Experimental: diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index 8d98cee796..a121935ae0 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -6,8 +6,12 @@ _Released MM/DD/YYYY_ - `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`. - `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). diff --git a/content/guides/core-concepts/writing-and-organizing-tests.md b/content/guides/core-concepts/writing-and-organizing-tests.md index 511142e903..853345f36c 100644 --- a/content/guides/core-concepts/writing-and-organizing-tests.md +++ b/content/guides/core-concepts/writing-and-organizing-tests.md @@ -619,19 +619,8 @@ and `off`. ###### On Mode - - - -Experimental - -`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. - - - -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 @@ -652,28 +641,17 @@ is so tests can reliably pass when run standalone or in a randomized order. ###### Off Mode - - - -Experimental - -`off` mode is currently experimental and can be enabled by setting -the [`experimentalSessionAndOrigin`](/guides/references/experiments) flag -to `true` in the Cypress config. - - - 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, 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. ###### Mode Comparison @@ -686,13 +664,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 diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index 2ef6fcb79c..d10005cd75 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -2,6 +2,315 @@ title: Migration Guide --- +## Migrating to Cypress version 12.0 + +This guide details the changes and how to change your code to migrate to Cypress +version 11.0. +[See the full changelog for version 11.0](/guides/references/changelog#11-0-0). + +The `experimentalSessionAndOrigin` flag has been removed and all functionality +associated with the Session and Origin Experiment are now available. The +`cy.origin()` and `cy.session()` commands are generally available and the +concept of Test Isolation has been introduced. + +### Test Isolation + +The +[`testIsolation`](/guides/core-concepts/writing-and-organizing-tests#Test-Isolation) +config option defaults to `on`. This means 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 +- clearing + [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) + in all domains +- clearing + [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) + in all domains + +Test suites that relied on the application to persist between tests may have to +be updated to revisit their application and rebuild the browser state for each +test that needs it. + +Before this change, it was possible to write tests such that you could rely on +the application (i.e. DOM state) to persist between tests. For example you could +log in to a CMS in the first test, change some content in the second test, +verify the new version is displayed on a different URL in the third, and log out +in the fourth. + +Here's a simplified example of such a test strategy. + +Before Multiple small tests against different +origins + +```js +it('logs in', () => { + cy.visit('https://supersecurelogons.com') + cy.get('input#password').type('Password123!') + cy.get('button#submit').click() +}) + +it('updates the content', () => { + // already on page redirect from clicking button#submit + cy.get('#current-user').contains('logged in') + cy.get('button#edit-1').click() + cy.get('input#title').type('Updated title') + cy.get('button#submit').click() + cy.get('.toast').type('Changes saved!') +}) + +it('validates the change', () => { + cy.visit('/items/1') + cy.get('h1').contains('Updated title') +}) +``` + +After migrating, when `testIsolation='on'`, this flow would need to be contained +within a single test. While the above practice has always been +[discouraged](/guides/references/best-practices#Having-tests-rely-on-the-state-of-previous-tests) +we know some users have historically written tests this way, often to get around +the `same-origin` restrictions. But with `cy.origin()` you no longer need these +kind of brittle hacks, as your multi-origin logic can all reside in a single +test, like the following. + +After One big test using `cy.origin()` + +```js +it('securely edits content', () => { + cy.origin('supersecurelogons.com', () => { + cy.visit('https://supersecurelogons.com') + cy.get('input#password').type('Password123!') + cy.get('button#submit').click() + }) + + cy.origin('mycms.com', () => { + cy.url().should('contain', 'cms') + cy.get('#current-user').contains('logged in') + cy.get('button#edit-1').click() + cy.get('input#title').type('Updated title') + cy.get('button#submit').click() + cy.get('.toast').type('Changes saved!') + }) + + cy.visit('/items/1') + cy.get('h1').contains('Updated title') +}) +``` + +The just-release `cy.session()` command can be used to setup and cache cookies, +local storage and session storage between tests to easily re-establish the +previous (or common) browser contexts needed in a suite. This command will run +setup on the initial execution and will restore the saved browser state on each +sequential command execution. This command reduces the need for repeated +application logins, while users also benefit from the test isolation guardrails +to write independent, reliable and deterministic tests from the start. + +If for whatever reason you still need to persist the dom and browser context +between tests, you can set `testIsolation='off` on the root configuration or at +the suite-level. For example: + +```js +describe('workflow', { testIsolation: 'off' }, () => { + ... +}) +``` + +It is important to note that while turning test isolation `off` may improve the +overall performance of end-to-end tests, 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. + +For examplethe following tests are not independent +nor deterministic: + +```js +describe('workflow', { testIsolation: 'off' }, () => { + it('logs in', () => { + cy.visit('my-app.com/log-in) + cy.get('username').type('User1') + cy.get('password').type(Cypress.env('User1_password')) + cy.get('button#login').click() + cy.contains('User1') + }) + + it('clicks user profile', () => { + cy.get('User1').find('#profile_avatar).click() + cy.contains('Email Preferences') + }) + + it('updates profile', () => { + cy.get('button#edit') + cy.get('email').type('user1@email.com') + cy.get('button#save').click() + }) +}) +``` + +In the above example, each test is relying on the previous test to be +_successful_ to correctly execute. If at any point, the first or second test +fails, the sequential test(s) will automatically fail and provided un-reliable +debugging errors since the errors are representative of the previous test. + +The best way to ensure your tests are independent is to add a `.only()` to your +test and verify it can run successfully without the test before it. + +### Alias Behaviors Changes + +Cypress always re-queries aliases when they are referenced. This can result in +certain tests that use to pass failing. For example, + +```js +cy.findByTestId('popover') + .findByRole('button', { expanded: true }) + .as('button') + .click() + +cy.get('@button').should('have.attr', 'aria-expanded', 'false') +``` + +previously passed, because the initial button was collapsed when first queried, +and then later expanded. However, in Cypress 12, this test fails because the +alias is always re-queried from the DOM, effectively resulting in the following +execution: + +```js +cy.findByTestId('popover').findByRole('button', { expanded: true }).click() + +cy.findByTestId('popover') + .findByRole('button', { expanded: true }) // A button which matches here (is expanded)... + .should('have.attr', 'aria-expanded', 'false') // ...will never pass this assertion. +``` + +You can rewrite tests like this to be more specific; in our case, we changed the +alias to be the first button rather than the unexpanded button. + +```js +cy.findByTestId('popover').findAllByRole('button').first().as('button') +``` + +### Command / Cypress API Changes + +### `Cypress.Cookies.defaults` and `Cypress.Cookies.preserveOnce` + +The `Cypress.Cookies.defaults` and `CypressCookies.preserveOnce` APIs been +removed. Use the [`cy.session()`](/api/commands/session) command to preserve +cookies (and local and session storage) between tests. + +```diff +describe('Dashboard', () => { + beforeEach(() => { +- cy.login() +- Cypress.Cookies.preserveOnce('session_id', 'remember_token') ++ cy.session('unique_identifier', cy.login, { ++ validate () { ++ cy.getCookies().should('have.length', 2) ++ }, ++ cacheAcrossSpecs: true ++ }) + }) +``` + +#### `cy.server()`, `cy.route()` and `Cypress.Server.defaults` + +The` cy.server()` and` cy.route()` commands and the `Cypress.server.defaults` +API has been removed. Use the [`cy.intercept()`(/api/commands/intercept) command +instead. + +```diff + it('can encode + decode headers', () => { +- Cypress.Server.defaults({ +- delay: 500, +- method: 'GET', +- }) +- cy.server() +- cy.route(/api/, () => { +- return { +- 'test': 'We’ll', +- } +- }).as('getApi') ++ cy.intercept('GET', /api/, (req) => { ++ req.on('response', (res) => { ++ res.setDelay(500) ++ }) ++ req.body.'test': 'We’ll' ++ }).as('getApi') + cy.visit('/index.html') + cy.window().then((win) => { + const xhr = new win.XMLHttpRequest + xhr.open('GET', '/api/v1/foo/bar?a=42') + xhr.send() + }) + + cy.wait('@getApi') +- .its('url').should('include', 'api/v1') ++ .its('request.url').should('include', 'api/v1') + }) +``` + +### cy.invoke() + +`.invoke()` now throws an error if the function returns a promise. If you wish +to call a method that returns a promise and wait for it to resolve, use +`.then()` instead of `.invoke()`. + +```diff +cy.wrap(myAPI) +- .invoke('makeARequest', 'http://example.com') ++ .then(api => api.makeARequest('http://example.com')) + .then(res => { ...handle response... }) +``` + +If `.invoke()` is followed by additional commands or assertions, it will call +the named function multiple times. This has the benefit that the chained +assertions can more reliably use the function's return value. + +If this behavior is undesirable because you expect the function to invoked only +once, break the command chain and move the chains commands and/or assertions to +their own chain. For example, rewrite + +```diff +- cy.get('input').invoke('val', 'text').type('newText') ++ cy.get('input').invoke('val', 'text') ++ cy.get('input').type('newText') +``` + +#### `Cypress.Commands.override()` + +The follow commands can no longer be overridden: + +- .as() +- .children() +- .closest() +- .contains() +- cy.debug() +- cy.document() +- .eq() +- .filter() +- .find() +- .first() +- .focused() +- .get() +- .hash() +- .its() +- .last() +- cy.location() +- .next() +- .nextAll() +- .not() +- .parent() +- .parents() +- .parentsUntil() +- .prev() +- .prevUntil() +- cy.root() +- .shadow() +- .siblings() +- cy.title() +- cy.url() +- cy.window() + ## Migrating to Cypress version 11.0 This guide details the changes and how to change your code to migrate to Cypress @@ -268,80 +577,6 @@ export default defineConfig({ Vite 3+ users could make use of the [`mergeConfig`](https://vitejs.dev/guide/api-javascript.html#mergeconfig) API. -## Migrating to Cypress version 11.0 - -This guide details the changes and how to change your code to migrate to Cypress -version 11.0. -[See the full changelog for version 11.0](/guides/references/changelog#11-0-0). - -### Test Isolation - -The `testIsolation` config option defaults to `strict`. This means that after -every test, the current page is reset to `about:blank` and all active session -data (cookies, `localStorage` and `sessionStorage`) across all domains are -cleared. Some test suites that rely on the previous behavior may have to be -updated. - -Before this change, it was possible to write tests such that you could, for -example, log in to a CMS in the first test, change some content in the second -test, verify the new version is displayed on a different URL in the third, and -log out in the fourth. Here's a simplified example of such a test strategy. - -Before Multiple small tests against different -origins - -```js -it('logs in', () => { - cy.visit('https://supersecurelogons.com') - cy.get('input#password').type('Password123!') - cy.get('button#submit').click() -}) -it('updates the content', () => { - cy.get('#current-user').contains('logged in') - cy.get('button#edit-1').click() - cy.get('input#title').type('Updated title') - cy.get('button#submit').click() - cy.get('.toast').type('Changes saved!') -}) -it('validates the change', () => { - cy.visit('/items/1') - cy.get('h1').contains('Updated title') -}) -``` - -After migrating, this flow would need to be contained within a single test. -While the above practice has always been -[discouraged](/guides/references/best-practices#Having-tests-rely-on-the-state-of-previous-tests) -we know some users have historically written tests this way, often to get around -the same-origin restrictions. But with `cy.origin()` you no longer need these -kind of brittle hacks, as your multi-origin logic can all reside in a single -test, like the following. - -After One big test using `cy.origin()` - -```js -it('securely edits content', () => { - cy.origin('supersecurelogons.com', () => { - cy.visit('https://supersecurelogons.com') - cy.get('input#password').type('Password123!') - cy.get('button#submit').click() - }) - cy.origin('mycms.com', () => { - cy.url().should('contain', 'cms') - cy.get('#current-user').contains('logged in') - cy.get('button#edit-1').click() - cy.get('input#title').type('Updated title') - cy.get('button#submit').click() - cy.get('.toast').type('Changes saved!') - }) - cy.visit('/items/1') - cy.get('h1').contains('Updated title') -}) -``` - -Always remember, -[Cypress tests are not unit tests](https://docs.cypress.io/guides/references/best-practices#Creating-tiny-tests-with-a-single-assertion). - ## Migrating to Cypress version 10.0 This guide details the changes and how to change your code to migrate to Cypress From 5e1a18a9707ddc08254fc29e1e8be2993c07467d Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Wed, 16 Nov 2022 09:36:25 -0600 Subject: [PATCH 02/44] r2 - remove test isolation experimental reference --- .../core-concepts/writing-and-organizing-tests.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/content/guides/core-concepts/writing-and-organizing-tests.md b/content/guides/core-concepts/writing-and-organizing-tests.md index 853345f36c..85ccdde7b2 100644 --- a/content/guides/core-concepts/writing-and-organizing-tests.md +++ b/content/guides/core-concepts/writing-and-organizing-tests.md @@ -564,17 +564,6 @@ it.skip('returns "fizz" when number is multiple of 3', () => { ### Test Isolation - - - -Experimental - -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. - - - **Best Practice:** Tests should From 2435390877dd237df2b4151d74e074cf46ece859 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 21 Nov 2022 15:58:20 -0600 Subject: [PATCH 03/44] include should in v12 changes --- content/_changelogs/11.0.0.md | 3 -- content/_changelogs/12.0.0.md | 3 ++ content/guides/references/migration-guide.md | 32 +++++++++++++++++++- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/content/_changelogs/11.0.0.md b/content/_changelogs/11.0.0.md index 849a41f4ce..754d8b4f4f 100644 --- a/content/_changelogs/11.0.0.md +++ b/content/_changelogs/11.0.0.md @@ -71,9 +71,6 @@ which explains the breaking changes in more detail.** unauthorized calls. If you use a self-signed CA you will need to set `npm_config_ca`, `npm_config_cafile`, or `NODE_EXTRA_CA_CERTS`. Addresses [#23980](https://github.com/cypress-io/cypress/issues/23980). -- 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. ###### Experimental: diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index a121935ae0..67001a4eca 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -8,6 +8,9 @@ _Released MM/DD/YYYY_ on by default now. - The new concept of `testIsolation` has been introduced and it defaults to `on`. +- 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 diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index d10005cd75..ba73d59694 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -249,7 +249,7 @@ instead. }) ``` -### cy.invoke() +### `.invoke()` `.invoke()` now throws an error if the function returns a promise. If you wish to call a method that returns a promise and wait for it to resolve, use @@ -276,6 +276,36 @@ their own chain. For example, rewrite + cy.get('input').type('newText') ``` +### `.should()` + +`.should()` now throws an error if Cypress commands are invoked from inside a +`.should()` callback. This previously resulted in unusual and undefined +behavior. If you wish to execute series of commands on the yield value, +use`.then()` instead. + +```diff +cy.get('button') +- .should(($button) => { + + }) ++ .then(api => api.makeARequest('http://example.com')) + .then(res => { ...handle response... }) +``` + +If `.invoke()` is followed by additional commands or assertions, it will call +the named function multiple times. This has the benefit that the chained +assertions can more reliably use the function's return value. + +If this behavior is undesirable because you expect the function to invoked only +once, break the command chain and move the chains commands and/or assertions to +their own chain. For example, rewrite + +```diff +- .invoke('val', 'text').type('newText') ++ cy.get('input').invoke('val', 'text') ++ cy.get('input').type('newText') +``` + #### `Cypress.Commands.override()` The follow commands can no longer be overridden: From e998b1dc4b044ab3900f99e00f6ffc6a4f46810c Mon Sep 17 00:00:00 2001 From: Ben M Date: Tue, 29 Nov 2022 09:23:36 -0500 Subject: [PATCH 04/44] Update 12.0.0.md updated version number --- content/_changelogs/12.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index 67001a4eca..58151442cb 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -1,4 +1,4 @@ -## 11.0.0 +## 12.0.0 _Released MM/DD/YYYY_ From 48d480764c34840c705112104060784bbdb291bb Mon Sep 17 00:00:00 2001 From: Ben M Date: Tue, 29 Nov 2022 09:25:54 -0500 Subject: [PATCH 05/44] Update writing-and-organizing-tests.md removed the word "recently" that was describing a talk we gave 4 years ago --- content/guides/core-concepts/writing-and-organizing-tests.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/core-concepts/writing-and-organizing-tests.md b/content/guides/core-concepts/writing-and-organizing-tests.md index 85ccdde7b2..e2a2c27559 100644 --- a/content/guides/core-concepts/writing-and-organizing-tests.md +++ b/content/guides/core-concepts/writing-and-organizing-tests.md @@ -17,7 +17,7 @@ title: Writing and Organizing Tests Best Practices -We recently gave a "Best Practices" conference talk at AssertJS (February 2018). +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. From 4c82587e1011a6b696762f9993c86e7a8279bb52 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Tue, 29 Nov 2022 08:27:26 -0600 Subject: [PATCH 06/44] Update content/guides/references/migration-guide.md Co-authored-by: Matt Schile --- content/guides/references/migration-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index ba73d59694..9bdbb2c996 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -6,7 +6,7 @@ title: Migration Guide This guide details the changes and how to change your code to migrate to Cypress version 11.0. -[See the full changelog for version 11.0](/guides/references/changelog#11-0-0). +[See the full changelog for version 12.0](/guides/references/changelog#12-0-0). The `experimentalSessionAndOrigin` flag has been removed and all functionality associated with the Session and Origin Experiment are now available. The From 05fb3e35bd1407a455d458148a132e4b04763fff Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Tue, 29 Nov 2022 08:27:34 -0600 Subject: [PATCH 07/44] Update content/guides/references/migration-guide.md Co-authored-by: Matt Schile --- content/guides/references/migration-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index 9bdbb2c996..5368925074 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -9,7 +9,7 @@ version 11.0. [See the full changelog for version 12.0](/guides/references/changelog#12-0-0). The `experimentalSessionAndOrigin` flag has been removed and all functionality -associated with the Session and Origin Experiment are now available. The +associated with the Session and Origin experiments are now available. The `cy.origin()` and `cy.session()` commands are generally available and the concept of Test Isolation has been introduced. From 820f1344e306612203a054ffe9872aa2e1b63827 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Tue, 29 Nov 2022 08:27:46 -0600 Subject: [PATCH 08/44] Update content/guides/references/migration-guide.md Co-authored-by: Matt Schile --- content/guides/references/migration-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index 5368925074..9d86f0df0c 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -5,7 +5,7 @@ title: Migration Guide ## Migrating to Cypress version 12.0 This guide details the changes and how to change your code to migrate to Cypress -version 11.0. +version 12.0. [See the full changelog for version 12.0](/guides/references/changelog#12-0-0). The `experimentalSessionAndOrigin` flag has been removed and all functionality From c35e709be915293b24161b1fec413a385cf31f5c Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Tue, 29 Nov 2022 13:45:02 -0600 Subject: [PATCH 09/44] . --- content/guides/references/migration-guide.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index 9d86f0df0c..a938684980 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -2,7 +2,7 @@ title: Migration Guide --- -## Migrating to Cypress version 12.0 +## Migrating to Cypress 12.0 This guide details the changes and how to change your code to migrate to Cypress version 12.0. @@ -341,7 +341,7 @@ The follow commands can no longer be overridden: - cy.url() - cy.window() -## Migrating to Cypress version 11.0 +## Migrating to Cypress 11.0 This guide details the changes and how to change your code to migrate to Cypress version 11.0. @@ -607,7 +607,7 @@ export default defineConfig({ Vite 3+ users could make use of the [`mergeConfig`](https://vitejs.dev/guide/api-javascript.html#mergeconfig) API. -## Migrating to Cypress version 10.0 +## Migrating to Cypress 10.0 This guide details the changes and how to change your code to migrate to Cypress version 10.0. From eb94eb4b9f14a8d7d6a5178dbfc06f1bc40c604a Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Tue, 29 Nov 2022 13:58:02 -0600 Subject: [PATCH 10/44] add dropped node support to migration guide --- content/guides/references/migration-guide.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index a938684980..ec4279a81d 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -13,6 +13,18 @@ associated with the Session and Origin experiments are now available. The `cy.origin()` and `cy.session()` commands are generally available and the concept of Test Isolation has been introduced. +### Node.js 14+ support + +Cypress comes bundled with its own +[Node.js version](https://github.com/cypress-io/cypress/blob/develop/.node-version). +However, installing the `cypress` npm package uses the Node.js version installed +on your system. + +Node.js 12 reached its end of life on April 30, 2022. +[See Node's release schedule](https://github.com/nodejs/Release). This Node.js +version will no longer be supported when installing Cypress. The minimum Node.js +version supported to install Cypress is Node.js 14+. + ### Test Isolation The @@ -192,7 +204,7 @@ cy.findByTestId('popover').findAllByRole('button').first().as('button') ### Command / Cypress API Changes -### `Cypress.Cookies.defaults` and `Cypress.Cookies.preserveOnce` +#### `Cypress.Cookies.defaults` and `Cypress.Cookies.preserveOnce` The `Cypress.Cookies.defaults` and `CypressCookies.preserveOnce` APIs been removed. Use the [`cy.session()`](/api/commands/session) command to preserve From 93ae48920daa4965ae9787b70005b399e8bcefc1 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Wed, 30 Nov 2022 16:20:11 -0600 Subject: [PATCH 11/44] updates / pr feedback --- content/guides/references/migration-guide.md | 133 ++++++++++--------- 1 file changed, 69 insertions(+), 64 deletions(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index ec4279a81d..61c4168f3a 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -8,10 +8,15 @@ This guide details the changes and how to change your code to migrate to Cypress version 12.0. [See the full changelog for version 12.0](/guides/references/changelog#12-0-0). -The `experimentalSessionAndOrigin` flag has been removed and all functionality -associated with the Session and Origin experiments are now available. The -`cy.origin()` and `cy.session()` commands are generally available and the -concept of Test Isolation has been introduced. +The Session and Origin experiment has been released as General Availability +(GA), meaning that we have deemed this experiment to be feature complete and +free of issues in the majority of use cases. With releasing this as GA, the +`experimentalSessionAndOrigin` flag has been removed, the +[`cy.origin()`](<(/api/commands/origin)>) and +[`cy.session()`](/api/commands/session) commands are generally available and the +concept of +[Test Isolation](/guides/core-concepts/writing-and-organizing-tests#Test-Isolation) +has been introduced. ### Node.js 14+ support @@ -82,9 +87,9 @@ After migrating, when `testIsolation='on'`, this flow would need to be contained within a single test. While the above practice has always been [discouraged](/guides/references/best-practices#Having-tests-rely-on-the-state-of-previous-tests) we know some users have historically written tests this way, often to get around -the `same-origin` restrictions. But with `cy.origin()` you no longer need these -kind of brittle hacks, as your multi-origin logic can all reside in a single -test, like the following. +the `same-origin` restrictions. But with [`cy.origin()`](/api/commands/origin) +you no longer need these kind of brittle hacks, as your multi-origin logic can +all reside in a single test, like the following. After One big test using `cy.origin()` @@ -227,8 +232,8 @@ describe('Dashboard', () => { #### `cy.server()`, `cy.route()` and `Cypress.Server.defaults` The` cy.server()` and` cy.route()` commands and the `Cypress.server.defaults` -API has been removed. Use the [`cy.intercept()`(/api/commands/intercept) command -instead. +API has been removed. Use the [`cy.intercept()`](/api/commands/intercept) +command instead. ```diff it('can encode + decode headers', () => { @@ -261,11 +266,11 @@ instead. }) ``` -### `.invoke()` +#### `.invoke()` -`.invoke()` now throws an error if the function returns a promise. If you wish -to call a method that returns a promise and wait for it to resolve, use -`.then()` instead of `.invoke()`. +[`.invoke()`](/api/commands/invoke) now throws an error if the function returns +a promise. If you wish to call a method that returns a promise and wait for it +to resolve, use [`.then()`](/api/commands/then) instead of `.invoke()`. ```diff cy.wrap(myAPI) @@ -288,12 +293,12 @@ their own chain. For example, rewrite + cy.get('input').type('newText') ``` -### `.should()` +#### `.should()` -`.should()` now throws an error if Cypress commands are invoked from inside a -`.should()` callback. This previously resulted in unusual and undefined -behavior. If you wish to execute series of commands on the yield value, -use`.then()` instead. +[`.should()`](/api/commands/should) now throws an error if Cypress commands are +invoked from inside a `.should()` callback. This previously resulted in unusual +and undefined behavior. If you wish to execute series of commands on the yield +value, use`.then()` instead. ```diff cy.get('button') @@ -304,54 +309,54 @@ cy.get('button') .then(res => { ...handle response... }) ``` -If `.invoke()` is followed by additional commands or assertions, it will call -the named function multiple times. This has the benefit that the chained -assertions can more reliably use the function's return value. - -If this behavior is undesirable because you expect the function to invoked only -once, break the command chain and move the chains commands and/or assertions to -their own chain. For example, rewrite - -```diff -- .invoke('val', 'text').type('newText') -+ cy.get('input').invoke('val', 'text') -+ cy.get('input').type('newText') -``` - #### `Cypress.Commands.override()` -The follow commands can no longer be overridden: - -- .as() -- .children() -- .closest() -- .contains() -- cy.debug() -- cy.document() -- .eq() -- .filter() -- .find() -- .first() -- .focused() -- .get() -- .hash() -- .its() -- .last() -- cy.location() -- .next() -- .nextAll() -- .not() -- .parent() -- .parents() -- .parentsUntil() -- .prev() -- .prevUntil() -- cy.root() -- .shadow() -- .siblings() -- cy.title() -- cy.url() -- cy.window() +In Cypress 12.0.0, we introduced a new command types, called queries. A query +command is a command that returns a small and fast function for getting data +from the window or DOM. This distinction is important because Cypress will retry +any queries leading up to a non-query command, and retry any assertions after a +non-query command, to ensure the yielded subject that is being tested is always +up-to-date. + +With the introduction of query commands, the following commands have been +re-categorized and can no longer be overridden with +[`Cypress.Commands.override()`](api/cypress-api/custom-commands#Overwrite-Existing-Commands): + +- [`.as()`](/api/commands/as) +- [`.children()`](/api/commands/children) +- [`.closest()`](/api/commands/closest) +- [`.contains()`](/api/commands/contains) +- [`cy.debug()`](/api/commands/debug) +- [`cy.document()`](/api/commands/document) +- [`.eq()`](/api/commands/eq) +- [`.filter()`](/api/commands/filter) +- [`.find()`](/api/commands/find) +- [`.first()`](/api/commands/first) +- [`.focused()`](/api/commands/focused) +- [`.get()`](/api/commands/get) +- [`.hash()`](/api/commands/hash) +- [`.its()`](/api/commands/its) +- [`.last()`](/api/commands/last) +- [`cy.location()`](/api/commands/location) +- [`.next()`](/api/commands/next) +- [`.nextAll()`](/api/commands/nextall) +- [`.not()`](/api/commands/not) +- [`.parent()`](/api/commands/parent) +- [`.parents()`](/api/commands/parents) +- [`.parentsUntil()`](/api/commands/parentsuntil) +- [`.prev()`](/api/commands/prev) +- [`.prevUntil()`](/api/commands/prevuntil) +- [`cy.root()`](/api/commands/root) +- [`.shadow()`](/api/commands/shadow) +- [`.siblings()`](/api/commands/siblings) +- [`cy.title()`](/api/commands/title) +- [`cy.url()`](/api/commands/url) +- [`cy.window()`](/api/commands/window) + +If you were previously overwriting one the above commands, try adding your +version as a new command using +[`Cypress.Commands.add()`](api/cypress-api/custom-commands) under a different +name. ## Migrating to Cypress 11.0 From 73a2b4a98a4152110c4ac17194003b44f6f69422 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Wed, 30 Nov 2022 16:28:04 -0600 Subject: [PATCH 12/44] use blues words --- content/guides/references/migration-guide.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index 61c4168f3a..ac6fef9bbc 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -311,12 +311,10 @@ cy.get('button') #### `Cypress.Commands.override()` -In Cypress 12.0.0, we introduced a new command types, called queries. A query -command is a command that returns a small and fast function for getting data -from the window or DOM. This distinction is important because Cypress will retry -any queries leading up to a non-query command, and retry any assertions after a -non-query command, to ensure the yielded subject that is being tested is always -up-to-date. +In Cypress 12.0.0, we introduced a new command type, called queries. A query is +a small and fast command for getting data from the window or DOM. This +distinction is important because Cypress can retry chains of queries, keeping +the yielded subject up-to-date as a page rerenders. With the introduction of query commands, the following commands have been re-categorized and can no longer be overridden with From 188825b71947dc61b6d8ea4f51e8b3e4d59ba380 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Wed, 30 Nov 2022 17:23:36 -0600 Subject: [PATCH 13/44] fix markdown --- .../guides/core-concepts/writing-and-organizing-tests.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/guides/core-concepts/writing-and-organizing-tests.md b/content/guides/core-concepts/writing-and-organizing-tests.md index e2a2c27559..8c83432952 100644 --- a/content/guides/core-concepts/writing-and-organizing-tests.md +++ b/content/guides/core-concepts/writing-and-organizing-tests.md @@ -17,9 +17,9 @@ title: Writing and Organizing Tests Best Practices -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. +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. [https://www.youtube.com/watch?v=5XQOK0v_YRE](https://www.youtube.com/watch?v=5XQOK0v_YRE) From 98a048209d771b98ad40621f66c5323fb28f336e Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Thu, 1 Dec 2022 12:12:19 -0600 Subject: [PATCH 14/44] Apply suggestions from code review Co-authored-by: Blue F --- content/guides/references/migration-guide.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index ac6fef9bbc..440e542ccf 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -309,7 +309,7 @@ cy.get('button') .then(res => { ...handle response... }) ``` -#### `Cypress.Commands.override()` +#### `Cypress.Commands.overwrite()` In Cypress 12.0.0, we introduced a new command type, called queries. A query is a small and fast command for getting data from the window or DOM. This @@ -317,8 +317,8 @@ distinction is important because Cypress can retry chains of queries, keeping the yielded subject up-to-date as a page rerenders. With the introduction of query commands, the following commands have been -re-categorized and can no longer be overridden with -[`Cypress.Commands.override()`](api/cypress-api/custom-commands#Overwrite-Existing-Commands): +re-categorized and can no longer be overwritten with +[`Cypress.Commands.overwrite()`](api/cypress-api/custom-commands#Overwrite-Existing-Commands): - [`.as()`](/api/commands/as) - [`.children()`](/api/commands/children) From 90f63b835cc1c0da5d97f91e2ad3b865619133e1 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Thu, 1 Dec 2022 14:11:32 -0600 Subject: [PATCH 15/44] Apply suggestions from code review Co-authored-by: DEBRIS APRON --- content/guides/references/migration-guide.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index 440e542ccf..e1cef975ee 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -115,10 +115,10 @@ it('securely edits content', () => { }) ``` -The just-release `cy.session()` command can be used to setup and cache cookies, +The just-released `cy.session()` command can be used to setup and cache cookies, local storage and session storage between tests to easily re-establish the previous (or common) browser contexts needed in a suite. This command will run -setup on the initial execution and will restore the saved browser state on each +setup on its initial execution and will restore the saved browser state on each sequential command execution. This command reduces the need for repeated application logins, while users also benefit from the test isolation guardrails to write independent, reliable and deterministic tests from the start. @@ -167,7 +167,7 @@ describe('workflow', { testIsolation: 'off' }, () => { In the above example, each test is relying on the previous test to be _successful_ to correctly execute. If at any point, the first or second test -fails, the sequential test(s) will automatically fail and provided un-reliable +fails, the sequential test(s) will automatically fail and provide unreliable debugging errors since the errors are representative of the previous test. The best way to ensure your tests are independent is to add a `.only()` to your @@ -176,7 +176,7 @@ test and verify it can run successfully without the test before it. ### Alias Behaviors Changes Cypress always re-queries aliases when they are referenced. This can result in -certain tests that use to pass failing. For example, +certain tests that used to pass failing. For example, ```js cy.findByTestId('popover') @@ -284,7 +284,7 @@ the named function multiple times. This has the benefit that the chained assertions can more reliably use the function's return value. If this behavior is undesirable because you expect the function to invoked only -once, break the command chain and move the chains commands and/or assertions to +once, break the command chain and move the chain's commands and/or assertions to their own chain. For example, rewrite ```diff @@ -297,7 +297,7 @@ their own chain. For example, rewrite [`.should()`](/api/commands/should) now throws an error if Cypress commands are invoked from inside a `.should()` callback. This previously resulted in unusual -and undefined behavior. If you wish to execute series of commands on the yield +and undefined behavior. If you wish to execute a series of commands on the yield value, use`.then()` instead. ```diff @@ -351,7 +351,7 @@ re-categorized and can no longer be overwritten with - [`cy.url()`](/api/commands/url) - [`cy.window()`](/api/commands/window) -If you were previously overwriting one the above commands, try adding your +If you were previously overwriting one of the above commands, try adding your version as a new command using [`Cypress.Commands.add()`](api/cypress-api/custom-commands) under a different name. From a739fc74b98755775deee7b21a066a7a485dfa51 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Thu, 1 Dec 2022 14:12:36 -0600 Subject: [PATCH 16/44] Apply suggestions from code review --- content/guides/references/migration-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index e1cef975ee..d68fd94ad6 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -284,7 +284,7 @@ the named function multiple times. This has the benefit that the chained assertions can more reliably use the function's return value. If this behavior is undesirable because you expect the function to invoked only -once, break the command chain and move the chain's commands and/or assertions to +once, break the command chain and move the chain'ed commands and/or assertions to their own chain. For example, rewrite ```diff From 4f6fd8e2b113ea5e60aa4cfb4179eb11189e2f53 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Thu, 1 Dec 2022 14:13:28 -0600 Subject: [PATCH 17/44] Apply suggestions from code review --- content/guides/references/migration-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index d68fd94ad6..fe9c161714 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -284,7 +284,7 @@ the named function multiple times. This has the benefit that the chained assertions can more reliably use the function's return value. If this behavior is undesirable because you expect the function to invoked only -once, break the command chain and move the chain'ed commands and/or assertions to +once, break the command chain and move the chained commands and/or assertions to their own chain. For example, rewrite ```diff From b0ae517121b18c7322ff4201f0f5ead911068c05 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Fri, 2 Dec 2022 09:10:57 -0600 Subject: [PATCH 18/44] Update content/guides/core-concepts/writing-and-organizing-tests.md Co-authored-by: DEBRIS APRON --- .../guides/core-concepts/writing-and-organizing-tests.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/content/guides/core-concepts/writing-and-organizing-tests.md b/content/guides/core-concepts/writing-and-organizing-tests.md index 8c83432952..08aeeca07d 100644 --- a/content/guides/core-concepts/writing-and-organizing-tests.md +++ b/content/guides/core-concepts/writing-and-organizing-tests.md @@ -637,10 +637,11 @@ session storage will be available across tests in that suite. Additionally, the establishing the browser session - the current page will not clear. It is important to note that while turning test isolation `off` may improve the -overall performance of end-to-end tests, 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. +overall performance of end-to-end tests, however, it can also 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 From 2766b720ed46d3ef3986c69d07551578af6f9347 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Fri, 2 Dec 2022 09:11:20 -0600 Subject: [PATCH 19/44] Update content/guides/references/migration-guide.md Co-authored-by: DEBRIS APRON --- content/guides/references/migration-guide.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index fe9c161714..5ca3a89640 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -134,10 +134,11 @@ describe('workflow', { testIsolation: 'off' }, () => { ``` It is important to note that while turning test isolation `off` may improve the -overall performance of end-to-end tests, 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. +overall performance of end-to-end tests, however, it can also 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. For examplethe following tests are not independent nor deterministic: From f9f731d8da490db801a0947869084c52adb4535b Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Fri, 2 Dec 2022 09:16:56 -0600 Subject: [PATCH 20/44] Apply suggestions from code review --- content/guides/references/migration-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index 5ca3a89640..1cb1ca5821 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -174,7 +174,7 @@ debugging errors since the errors are representative of the previous test. The best way to ensure your tests are independent is to add a `.only()` to your test and verify it can run successfully without the test before it. -### Alias Behaviors Changes +### Behavior Changes in Alias Resolution Cypress always re-queries aliases when they are referenced. This can result in certain tests that used to pass failing. For example, From e3c1bd831aa0fe8d6efc515eee02a30a226507b1 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Fri, 2 Dec 2022 09:17:08 -0600 Subject: [PATCH 21/44] Update content/guides/references/migration-guide.md Co-authored-by: DEBRIS APRON --- content/guides/references/migration-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index 1cb1ca5821..03c7d94186 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -284,7 +284,7 @@ If `.invoke()` is followed by additional commands or assertions, it will call the named function multiple times. This has the benefit that the chained assertions can more reliably use the function's return value. -If this behavior is undesirable because you expect the function to invoked only +If this behavior is undesirable because you expect the function to be invoked only once, break the command chain and move the chained commands and/or assertions to their own chain. For example, rewrite From da378464a5430ee643e79054f97f8678c6dd9b4d Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Fri, 2 Dec 2022 11:58:42 -0600 Subject: [PATCH 22/44] Update content/guides/core-concepts/writing-and-organizing-tests.md Co-authored-by: Ben M --- content/guides/core-concepts/writing-and-organizing-tests.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/core-concepts/writing-and-organizing-tests.md b/content/guides/core-concepts/writing-and-organizing-tests.md index 08aeeca07d..688dfbef2b 100644 --- a/content/guides/core-concepts/writing-and-organizing-tests.md +++ b/content/guides/core-concepts/writing-and-organizing-tests.md @@ -637,7 +637,7 @@ session storage will be available across tests in that suite. Additionally, the establishing the browser session - the current page will not clear. It is important to note that while turning test isolation `off` may improve the -overall performance of end-to-end tests, however, it can also cause state to "leak" +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 From e482ae33ea4eb966f8fd680ebf5a037cbad0ee00 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Fri, 2 Dec 2022 11:59:12 -0600 Subject: [PATCH 23/44] Update content/guides/references/migration-guide.md Co-authored-by: Ben M --- content/guides/references/migration-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index 03c7d94186..0670a76e6e 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -134,7 +134,7 @@ describe('workflow', { testIsolation: 'off' }, () => { ``` It is important to note that while turning test isolation `off` may improve the -overall performance of end-to-end tests, however, it can also cause state to "leak" +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 From 01f930b7c16ba8969ee49de7ca64f1d3ff5d4993 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Fri, 2 Dec 2022 11:59:55 -0600 Subject: [PATCH 24/44] Update content/guides/references/migration-guide.md --- content/guides/references/migration-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index 0670a76e6e..c586a8b06f 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -177,7 +177,7 @@ test and verify it can run successfully without the test before it. ### Behavior Changes in Alias Resolution Cypress always re-queries aliases when they are referenced. This can result in -certain tests that used to pass failing. For example, +certain tests that used to pass could start to fail. For example, ```js cy.findByTestId('popover') From 26d7407a9a4cc73392a08c245ad69f2be4c41eda Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Fri, 2 Dec 2022 12:00:12 -0600 Subject: [PATCH 25/44] Update content/guides/references/migration-guide.md Co-authored-by: Ben M --- content/guides/references/migration-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index c586a8b06f..83212fee86 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -298,7 +298,7 @@ their own chain. For example, rewrite [`.should()`](/api/commands/should) now throws an error if Cypress commands are invoked from inside a `.should()` callback. This previously resulted in unusual -and undefined behavior. If you wish to execute a series of commands on the yield +and undefined behavior. If you wish to execute a series of commands on the yielded value, use`.then()` instead. ```diff From ec986861139f7d79c26b6295e657d39fba38fb17 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Fri, 2 Dec 2022 12:02:29 -0600 Subject: [PATCH 26/44] fix markdown --- .../core-concepts/writing-and-organizing-tests.md | 4 ++-- content/guides/references/migration-guide.md | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/content/guides/core-concepts/writing-and-organizing-tests.md b/content/guides/core-concepts/writing-and-organizing-tests.md index 688dfbef2b..587305d97b 100644 --- a/content/guides/core-concepts/writing-and-organizing-tests.md +++ b/content/guides/core-concepts/writing-and-organizing-tests.md @@ -640,8 +640,8 @@ 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. +extremely mindful of how tests are written when using this mode, and ensure that +tests continue to run independently of one another. ###### Mode Comparison diff --git a/content/guides/references/migration-guide.md b/content/guides/references/migration-guide.md index 83212fee86..101f5b590f 100644 --- a/content/guides/references/migration-guide.md +++ b/content/guides/references/migration-guide.md @@ -137,8 +137,8 @@ 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. +extremely mindful of how tests are written when using this mode, and ensure that +tests continue to run independently of one another. For examplethe following tests are not independent nor deterministic: @@ -284,9 +284,9 @@ If `.invoke()` is followed by additional commands or assertions, it will call the named function multiple times. This has the benefit that the chained assertions can more reliably use the function's return value. -If this behavior is undesirable because you expect the function to be invoked only -once, break the command chain and move the chained commands and/or assertions to -their own chain. For example, rewrite +If this behavior is undesirable because you expect the function to be invoked +only once, break the command chain and move the chained commands and/or +assertions to their own chain. For example, rewrite ```diff - cy.get('input').invoke('val', 'text').type('newText') @@ -298,8 +298,8 @@ their own chain. For example, rewrite [`.should()`](/api/commands/should) now throws an error if Cypress commands are invoked from inside a `.should()` callback. This previously resulted in unusual -and undefined behavior. If you wish to execute a series of commands on the yielded -value, use`.then()` instead. +and undefined behavior. If you wish to execute a series of commands on the +yielded value, use`.then()` instead. ```diff cy.get('button') From 016dbb031dfbdf74bb625ae2500d6a2d93bbc5c9 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Fri, 2 Dec 2022 15:39:10 -0600 Subject: [PATCH 27/44] start --- content/_changelogs/12.0.0.md | 80 ++++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 5 deletions(-) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index 58151442cb..e0a7a7cc9a 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -4,17 +4,87 @@ _Released MM/DD/YYYY_ **Breaking Changes:** +- Cypress dropped support for Node 12. Use Node 14+. Addressed in + [#24885](https://github.com/cypress-io/cypress/pull/24885). - `experimentalSessionAndOrigin` flag has been removed and all functionality is - on by default now. + now enabled by default now. Addresses + [#21471](https://github.com/cypress-io/cypress/issues/21471). + - The new concept of `testIsolation` has been introduced and it defaults to `on`. -- 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. + - Changes the testIsolation configuration values from on or off to true or + false. Addressed in + [#24935](https://github.com/cypress-io/cypress/pull/24935). +- Cypress now throws an error if any Cypess commands are invoked from inside a + `.should()` callback. This previously resulted in unusual and undefined + behavior; it is now explicitly an error. + + - Addresses [#5963](https://github.com/cypress-io/cypress/issues/5963) + - Addresses [#14656](https://github.com/cypress-io/cypress/issues/14656) + - Addresses [#22587](https://github.com/cypress-io/cypress/issues/22587) + - `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). + Addresses [#22126](https://github.com/cypress-io/cypress/issues/22126). + +- To aligns with browser cookie rules, the Cookie commands now uses the the + hostname, not the superdomain, as the domain by default. This may affect what + cookies are returned by `cy.getCookie()`, `cy.setCookie()`, and + `cy.clearCookies()`. set/cleared by cookie commands. + - Addresses [#363](https://github.com/cypress-io/cypress/issues/363) + - Addresses [#5723](https://github.com/cypress-io/cypress/issues/5723) + - Addresses [#24526](https://github.com/cypress-io/cypress/issues/24526) + +FEAT: + +- experimentalRunAllSpecs: Allow running all specs regardless of folder + structure by adding a top-level run-all button. Addresses + [#24759](https://github.com/cypress-io/cypress/issues/24759). + +- Added `cy.getAllLocalStorage()` command. Addresses + [#24276](https://github.com/cypress-io/cypress/issues/24276). +- Added `cy.clearAllLocalStorage()` command. Addresses + [#24276](https://github.com/cypress-io/cypress/issues/24276). +- Added `cy.getAllSessionStorage()` command. Addresses + [#24277](https://github.com/cypress-io/cypress/issues/24277). +- Added `cy.clearAllSessionStorage()` command. Addresses + [#24277](https://github.com/cypress-io/cypress/issues/24277). + +Creates and adds types to `Cypress.ensure` API, which can be useful for creating +custom queries. This new API is based off the previously undocumented +cy.ensure\* methods, which are now removed. Addressed in +[#24697](https://github.com/cypress-io/cypress/pull/24697). + + + +- Added new experimentalOriginDependencies flag to enable support for + request/import within cy.origin. Previously this feature was enabled with the + experimentalSessionAndOrigin flag. + [#24931](https://github.com/cypress-io/cypress/pull/24931). + +FIX: + +- npm config set VAR VAL will inject npm_config_var=val environment variable- + Fixes [#24556](https://github.com/cypress-io/cypress/issues/24556). +- Fixes "Create Spec from Component" to better handle special characters in + filenames. Fixes [#23492](https://github.com/cypress-io/cypress/issues/23492). + +- Getting an alias for an intercepted call will now log the yielded object. + CONSOLE PROPS FOR CY.incercept().as() UPDATE. Fixed in + [#24623](https://github.com/cypress-io/cypress/pull/24623). + +If cy.getCookie() fails to find a cookie, you can no longer traverse the +non-existent cookie's properties (eg, with .its('value)). If you expect a cookie +not to exist, assert that directly, eg: +cy.getCookie('foo1').should('not.exist'). Addressed in +[#24203](https://github.com/cypress-io/cypress/pull/24203). + +DEP: + +Addresses [#](https://github.com/cypress-io/cypress/issues/) Fixes +[#](https://github.com/cypress-io/cypress/issues/) From 1cc02360e4d8bd23476dd8feab88644d0d509371 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 5 Dec 2022 10:10:42 -0600 Subject: [PATCH 28/44] getting close --- content/_changelogs/11.2.0.md | 3 +- content/_changelogs/12.0.0.md | 185 +++++++++++++++++++++------------- 2 files changed, 119 insertions(+), 69 deletions(-) diff --git a/content/_changelogs/11.2.0.md b/content/_changelogs/11.2.0.md index 1764626e14..9e8c352f8b 100644 --- a/content/_changelogs/11.2.0.md +++ b/content/_changelogs/11.2.0.md @@ -7,7 +7,8 @@ _Released 11/22/2022_ - Re-implemented the 'Run All Specs' for End to End Testing for running multiple tests sequentially in open mode. This feature had been previously removed in Cypress 10.0. Enable 'Run All Specs' with the new experimental flag, - `experimentalRunAllSpecs`. Please leave any feedback around 'Run All Specs' + [`experimentalRunAllSpecs`](guides/references/experiments#End-to-End-Testing). + Please leave any feedback around 'Run All Specs' [here](https://github.com/cypress-io/cypress/discussions/21628). Your feedback will help us make product decisions around the future of this feature. Addresses [#24168](https://github.com/cypress-io/cypress/issues/24168) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index e0a7a7cc9a..6fa2e53958 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -1,90 +1,139 @@ ## 12.0.0 -_Released MM/DD/YYYY_ +_Released 12/06/2022_ -**Breaking Changes:** - -- Cypress dropped support for Node 12. Use Node 14+. Addressed in - [#24885](https://github.com/cypress-io/cypress/pull/24885). -- `experimentalSessionAndOrigin` flag has been removed and all functionality is - now enabled by default now. Addresses - [#21471](https://github.com/cypress-io/cypress/issues/21471). - -- The new concept of `testIsolation` has been introduced and it defaults to - `on`. - - Changes the testIsolation configuration values from on or off to true or - false. Addressed in - [#24935](https://github.com/cypress-io/cypress/pull/24935). -- Cypress now throws an error if any Cypess commands are invoked from inside a - `.should()` callback. This previously resulted in unusual and undefined - behavior; it is now explicitly an error. +**Summary:** ...Notes below... - - Addresses [#5963](https://github.com/cypress-io/cypress/issues/5963) - - Addresses [#14656](https://github.com/cypress-io/cypress/issues/14656) - - Addresses [#22587](https://github.com/cypress-io/cypress/issues/22587) +**Breaking Changes:** -- `Cookies.defaults` and `Cookies.preserveOnce` have been removed. Please update - to use [`cy.session()`](/api/commands/session) to preserve session details +- Cypress dropped support for Node 12. Use Node 14, Node 16 or Node 18+. + Addressed in [#24885](https://github.com/cypress-io/cypress/pull/24885). +- The `Cookies.defaults` and `Cookies.preserveOnce` APIs have been removed. Use + the new [`cy.session()`](/api/commands/session) command to preserve cookies between tests. Addresses [#21472](https://github.com/cypress-io/cypress/issues/21472). +- The `cy.server()` and `cy.route()` commands have been removed. Additionally, + the corresponding `Cypress.Server.defaults` API has also been removed. Use the + [`cy.intercept()`(/api/commands/intercept) command to stub network responses + and requests. Addresses + [#22126](https://github.com/cypress-io/cypress/issues/22126). +- The Cookie commands now uses the `hostname` the as the domain by default + instead of the `superdomain`. This change aligns Cypress' cookie rules with + the browser cookie rules. This may affect what cookies are returned by + [`cy.getCookie()`](/api/commands/getcookie), what cookies are set with + [`cy.setCookie()`](/api/commands/setcookie), and the cookies cleared with + [`cy.clearCookies()`](/api/commands/clearcookies). Addresses + [#363](https://github.com/cypress-io/cypress/issues/363), + [#5723](https://github.com/cypress-io/cypress/issues/5723) and + [#24526](https://github.com/cypress-io/cypress/issues/24526) +- Cypress now throws an error if any Cypress commands are invoked from inside a + [`.should()`](/api/commands/should) callback. This previously resulted in + unusual and undefined behavior. Addresses + [#5963](https://github.com/cypress-io/cypress/issues/5963), + [#14656](https://github.com/cypress-io/cypress/issues/14656) and + [#22587](https://github.com/cypress-io/cypress/issues/22587). + +**Features:** + +- Added a new Cypress command, called + [`cy.getAllLocalStorage()`](/api/commands/getAllLocalStorage), to get + [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) + data for all origins with which the test has interacted. Addresses + [#24276](https://github.com/cypress-io/cypress/issues/24276). + +- Added a new Cypress command, called + [`cy.clearAllLocalStorage()`](/api/commands/clearAllLocalStorage), to clear + [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) + data for all origins with which the test has interacted. Addresses + [#24276](https://github.com/cypress-io/cypress/issues/24276). -- The` cy.server()` and` cy.route()` commands and the `Cypress.Server.defaults` - API has been removed. Use [`cy.intercept()`(/api/commands/intercept) instead. - Addresses [#22126](https://github.com/cypress-io/cypress/issues/22126). +- Added a new Cypress command, called + [`cy.getAllSessionStorage()`](/api/commands/getAllSessionStorage), to get + [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) + data for all origins with which the test has interacted. Addresses + [#24276](https://github.com/cypress-io/cypress/issues/24276). + +- Added a new Cypress command, called + [`cy.clearAllSessionStorage()`](/api/commands/clearAllSessionStorage), to + clear + [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) + data for all origins with which the test has interacted. Addresses + [#24276](https://github.com/cypress-io/cypress/issues/24276). -- To aligns with browser cookie rules, the Cookie commands now uses the the - hostname, not the superdomain, as the domain by default. This may affect what - cookies are returned by `cy.getCookie()`, `cy.setCookie()`, and - `cy.clearCookies()`. set/cleared by cookie commands. - - Addresses [#363](https://github.com/cypress-io/cypress/issues/363) - - Addresses [#5723](https://github.com/cypress-io/cypress/issues/5723) - - Addresses [#24526](https://github.com/cypress-io/cypress/issues/24526) +- Added a new configuration option called `experimentalOriginDependencies`. This + option enables support using `require` and `import` with callback supplied to + the [`cy.origin()`](/api/commands/origin) command in end-to-end testing. + Previously this feature was enabled through the `experimentalSessionAndOrigin` + configuration option. This was added as a configuration option in v12.0, + instead of being enabled by default, due to increase node memory usage + associated with this option that needs addressed before making this behavior + generally available. Addressed in + [#24931](https://github.com/cypress-io/cypress/pull/24931). -FEAT: +- Added a new `Cypress.ensure` API which provided several methods that can be + helpful when writing customs command and custom query commands. Addressed in + [#24697](https://github.com/cypress-io/cypress/pull/24697). -- experimentalRunAllSpecs: Allow running all specs regardless of folder - structure by adding a top-level run-all button. Addresses +- Added a new "Run All" button to the + [`experimentalRunAllSpecs`](guides/references/experiments#End-to-End-Testing) + experiment which enables running all spec files returned from the + `specPattern` glob or an array of globs, regardless of the specs sharing a + root folder. Addresses [#24759](https://github.com/cypress-io/cypress/issues/24759). -- Added `cy.getAllLocalStorage()` command. Addresses - [#24276](https://github.com/cypress-io/cypress/issues/24276). -- Added `cy.clearAllLocalStorage()` command. Addresses - [#24276](https://github.com/cypress-io/cypress/issues/24276). -- Added `cy.getAllSessionStorage()` command. Addresses - [#24277](https://github.com/cypress-io/cypress/issues/24277). -- Added `cy.clearAllSessionStorage()` command. Addresses - [#24277](https://github.com/cypress-io/cypress/issues/24277). +**Bugfixes:** -Creates and adds types to `Cypress.ensure` API, which can be useful for creating -custom queries. This new API is based off the previously undocumented -cy.ensure\* methods, which are now removed. Addressed in -[#24697](https://github.com/cypress-io/cypress/pull/24697). +- Fix a regression in [10.11.0](#10-11-0) where the Launchpad no longer showed a + loading spinner on startup to indicate that it has successfully started an was + a loading state. Fixed + [#24950](https://github.com/cypress-io/cypress/issues/24950). - +- Fixed the "Create Spec from Component" capability to correctly scaffold the + component spec from a component which contains special characters in its name. + Before this change, it scaffolded spec with either the wrong spec name or the + incorrect component import which lead to invalid JS errors. Fixes + [#23492](https://github.com/cypress-io/cypress/issues/23492). -- Added new experimentalOriginDependencies flag to enable support for - request/import within cy.origin. Previously this feature was enabled with the - experimentalSessionAndOrigin flag. - [#24931](https://github.com/cypress-io/cypress/pull/24931). +- Corrected Cypress environment variable resolution to correctly resolve + environment variables set with `npm config set`. Fixes + [#24556](https://github.com/cypress-io/cypress/issues/24556). -FIX: +- Fixed the console output returned from clicking on an aliased intercept in the + Command Log. It now logs the yielded request/response object associated to the + intercepted call when clicked, where previously it did not log these details. + Fixed in [#24623](https://github.com/cypress-io/cypress/pull/24623). + +- Added the missing Typescript types for the internal + [`cy.now()`](/guides/guides/debugging#Run-Cypress-command-outside-the-test) + command. Fixed in [#24697](https://github.com/cypress-io/cypress/pull/24697). -- npm config set VAR VAL will inject npm_config_var=val environment variable- - Fixes [#24556](https://github.com/cypress-io/cypress/issues/24556). -- Fixes "Create Spec from Component" to better handle special characters in - filenames. Fixes [#23492](https://github.com/cypress-io/cypress/issues/23492). +RAW NOTES: -- Getting an alias for an intercepted call will now log the yielded object. - CONSOLE PROPS FOR CY.incercept().as() UPDATE. Fixed in - [#24623](https://github.com/cypress-io/cypress/pull/24623). +SUMMARY: Cypress now fully supports for testing multiple domains of different +origins in a single test -If cy.getCookie() fails to find a cookie, you can no longer traverse the -non-existent cookie's properties (eg, with .its('value)). If you expect a cookie -not to exist, assert that directly, eg: -cy.getCookie('foo1').should('not.exist'). Addressed in -[#24203](https://github.com/cypress-io/cypress/pull/24203). +Read more about 12.0 in +[our blog post](https://cypress.io/blog/2022/12/06/cypress-12-release/). -DEP: +Breaking Changes: + +- `experimentalSessionAndOrigin` flag has been removed and all functionality is + now enabled by default now. Addresses + [#21471](https://github.com/cypress-io/cypress/issues/21471). + +- Added a new `testIsolation` configuration option, which defaults to `true`. To + clear more about about w + + - Changes the testIsolation configuration values from on or off to true or + false. Addressed in + [#24935](https://github.com/cypress-io/cypress/pull/24935). + +- The `cy.invoke()` -- need to find the PR again. + +FIX: -Addresses [#](https://github.com/cypress-io/cypress/issues/) Fixes -[#](https://github.com/cypress-io/cypress/issues/) +- If [`cy.getCookie()`](/api/commands/getcookie) fails to find a cookie, you can + no longer traverse the non-existent cookie's properties (eg, with + .its('value)). If you expect a cookie not to exist, assert that directly, eg: + cy.getCookie('foo1').should('not.exist'). Addressed in + [#24203](https://github.com/cypress-io/cypress/pull/24203). From f31ea0698ac8da14137d64a6283b3f388be366a2 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 5 Dec 2022 12:01:47 -0600 Subject: [PATCH 29/44] Update content/_changelogs/12.0.0.md Co-authored-by: Matt Schile --- content/_changelogs/12.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index 6fa2e53958..222b534e9d 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -61,7 +61,7 @@ _Released 12/06/2022_ [#24276](https://github.com/cypress-io/cypress/issues/24276). - Added a new configuration option called `experimentalOriginDependencies`. This - option enables support using `require` and `import` with callback supplied to + option enables support for using `require` and `import` within the callback supplied to the [`cy.origin()`](/api/commands/origin) command in end-to-end testing. Previously this feature was enabled through the `experimentalSessionAndOrigin` configuration option. This was added as a configuration option in v12.0, From 90b849b796da893cc779dc16ebc37ef7a48f3a92 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 5 Dec 2022 12:01:56 -0600 Subject: [PATCH 30/44] Update content/_changelogs/12.0.0.md Co-authored-by: Matt Schile --- content/_changelogs/12.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index 222b534e9d..f68fb8c961 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -17,7 +17,7 @@ _Released 12/06/2022_ [`cy.intercept()`(/api/commands/intercept) command to stub network responses and requests. Addresses [#22126](https://github.com/cypress-io/cypress/issues/22126). -- The Cookie commands now uses the `hostname` the as the domain by default +- The Cookie commands now uses the `hostname` as the domain by default instead of the `superdomain`. This change aligns Cypress' cookie rules with the browser cookie rules. This may affect what cookies are returned by [`cy.getCookie()`](/api/commands/getcookie), what cookies are set with From 68d2197560db4da4209bb469670336c838f5d311 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 5 Dec 2022 12:16:40 -0600 Subject: [PATCH 31/44] updated --- content/_changelogs/12.0.0.md | 70 ++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 22 deletions(-) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index 6fa2e53958..e1932d612a 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -2,7 +2,12 @@ _Released 12/06/2022_ -**Summary:** ...Notes below... +**Summary:** + +...Notes below... + +Read more about 12.0 in +[our blog post](https://cypress.io/blog/2022/12/06/cypress-12-release/). **Breaking Changes:** @@ -35,45 +40,62 @@ _Released 12/06/2022_ **Features:** +- Added a new configuration option called `testIsolation`, which defaults to + `true`. This option determines whether or not + [test isolation](/guides/core-concepts/writing-and-organizing-tests#Test-Isolation) + is enabled to ensure a clean browser context between tests. Addressed in + [#22230](https://github.com/cypress-io/cypress/pull/22230). +- The previously experimental Cypress command, called + [`cy.origin()`](/api/commands/origin), is now generally available in + end-to-end testing. This command allows testing multiple domains of different + origins in a single test. Addresses + [#17336](https://github.com/cypress-io/cypress/issues/17336). +- The previously experimental Cypress command, called + [`cy.session()`](/api/commands/session), is now generally available. This + command caches and restores `cookies`, + [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage), + and + [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) + in order to recreate a consistent browser context between tests. Addresses + [#20977](https://github.com/cypress-io/cypress/issues/20977). +- Added a new Cypress command, called + [`cy.getAllLocalStorage()`](/api/commands/getAllLocalStorage), to get + [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) + data for all origins with which the test has interacted. Addresses + [#24276](https://github.com/cypress-io/cypress/issues/24276). - Added a new Cypress command, called [`cy.getAllLocalStorage()`](/api/commands/getAllLocalStorage), to get [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) data for all origins with which the test has interacted. Addresses [#24276](https://github.com/cypress-io/cypress/issues/24276). - - Added a new Cypress command, called [`cy.clearAllLocalStorage()`](/api/commands/clearAllLocalStorage), to clear [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) data for all origins with which the test has interacted. Addresses [#24276](https://github.com/cypress-io/cypress/issues/24276). - - Added a new Cypress command, called [`cy.getAllSessionStorage()`](/api/commands/getAllSessionStorage), to get [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) data for all origins with which the test has interacted. Addresses [#24276](https://github.com/cypress-io/cypress/issues/24276). - - Added a new Cypress command, called [`cy.clearAllSessionStorage()`](/api/commands/clearAllSessionStorage), to clear [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) data for all origins with which the test has interacted. Addresses [#24276](https://github.com/cypress-io/cypress/issues/24276). - -- Added a new configuration option called `experimentalOriginDependencies`. This - option enables support using `require` and `import` with callback supplied to - the [`cy.origin()`](/api/commands/origin) command in end-to-end testing. - Previously this feature was enabled through the `experimentalSessionAndOrigin` - configuration option. This was added as a configuration option in v12.0, - instead of being enabled by default, due to increase node memory usage - associated with this option that needs addressed before making this behavior - generally available. Addressed in +- Added a new configuration option called `experimentalOriginDependencies`, + which defaults to `false`. This option enables support using `require` and + `import` with callback supplied to the [`cy.origin()`](/api/commands/origin) + command in end-to-end testing. Previously this feature was enabled through the + `experimentalSessionAndOrigin` configuration option. This was added as a + configuration option in v12.0, instead of being enabled by default, due to + increase node memory usage associated with this option that needs addressed + before making this behavior generally available. Addressed in [#24931](https://github.com/cypress-io/cypress/pull/24931). - - Added a new `Cypress.ensure` API which provided several methods that can be helpful when writing customs command and custom query commands. Addressed in [#24697](https://github.com/cypress-io/cypress/pull/24697). - - Added a new "Run All" button to the [`experimentalRunAllSpecs`](guides/references/experiments#End-to-End-Testing) experiment which enables running all spec files returned from the @@ -87,22 +109,18 @@ _Released 12/06/2022_ loading spinner on startup to indicate that it has successfully started an was a loading state. Fixed [#24950](https://github.com/cypress-io/cypress/issues/24950). - - Fixed the "Create Spec from Component" capability to correctly scaffold the component spec from a component which contains special characters in its name. Before this change, it scaffolded spec with either the wrong spec name or the incorrect component import which lead to invalid JS errors. Fixes [#23492](https://github.com/cypress-io/cypress/issues/23492). - - Corrected Cypress environment variable resolution to correctly resolve environment variables set with `npm config set`. Fixes [#24556](https://github.com/cypress-io/cypress/issues/24556). - - Fixed the console output returned from clicking on an aliased intercept in the Command Log. It now logs the yielded request/response object associated to the intercepted call when clicked, where previously it did not log these details. Fixed in [#24623](https://github.com/cypress-io/cypress/pull/24623). - - Added the missing Typescript types for the internal [`cy.now()`](/guides/guides/debugging#Run-Cypress-command-outside-the-test) command. Fixed in [#24697](https://github.com/cypress-io/cypress/pull/24697). @@ -112,11 +130,12 @@ RAW NOTES: SUMMARY: Cypress now fully supports for testing multiple domains of different origins in a single test -Read more about 12.0 in -[our blog post](https://cypress.io/blog/2022/12/06/cypress-12-release/). - Breaking Changes: +- The Session and Origin Experiment is now generally available for end-to-end + testing. This means Cypress now fully supports testing multiple domains of + different origins in a single test with the new + [`cy.origin()`](/api/commands/origin) - `experimentalSessionAndOrigin` flag has been removed and all functionality is now enabled by default now. Addresses [#21471](https://github.com/cypress-io/cypress/issues/21471). @@ -130,6 +149,8 @@ Breaking Changes: - The `cy.invoke()` -- need to find the PR again. +- https://github.com/cypress-io/cypress/pull/20302 + FIX: - If [`cy.getCookie()`](/api/commands/getcookie) fails to find a cookie, you can @@ -137,3 +158,8 @@ FIX: .its('value)). If you expect a cookie not to exist, assert that directly, eg: cy.getCookie('foo1').should('not.exist'). Addressed in [#24203](https://github.com/cypress-io/cypress/pull/24203). + + This fixes a regression in Cypress 12 introduced as part of the detached dom + rewrite of actionability tests, where the proper element wasn't being clicked + on to gain focus before typing. + https://github.com/cypress-io/cypress/pull/24886 From a90300511560fe8eb52177a41fbfa147023a1a2b Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Mon, 5 Dec 2022 12:59:20 -0600 Subject: [PATCH 32/44] documentation for #24909 --- content/_changelogs/12.0.0.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index ad4b6c1576..f8903c427c 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -102,6 +102,8 @@ Read more about 12.0 in `specPattern` glob or an array of globs, regardless of the specs sharing a root folder. Addresses [#24759](https://github.com/cypress-io/cypress/issues/24759). +- Further improved bundling in the binary to reduce startup and unzip time. + Addressed in [#24909](https://github.com/cypress-io/cypress/pull/24909) **Bugfixes:** From db6df0f6ad0ba0c9753b4369843efd519d00c381 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 5 Dec 2022 13:31:16 -0600 Subject: [PATCH 33/44] should be final entry --- content/_changelogs/12.0.0.md | 111 +++++++++++++++++++++------------- 1 file changed, 68 insertions(+), 43 deletions(-) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index ad4b6c1576..c67d72a453 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -4,7 +4,26 @@ _Released 12/06/2022_ **Summary:** -...Notes below... +The Session and Origin Experiment is now generally available for end-to-end +testing. This means Cypress now fully supports: + +- testing multiple domains of different origins in a single test with the new + [`cy.origin()`](/api/commands/origin) +- caching and restoring `cookies`, + [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage), + and + [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) + between tests +- configuring + [`testIsolation`](/guides/core-concepts/writing-and-organizing-tests#Test-Isolation) + in suites to define whether or not the browser context is cleaned or persisted + between tests + +Additionally in this release, enhancements were made to how Cypress manages DOM +element resolution to reduce the likelihood of hitting the dreaded detached DOM +errors due to maintaining stale DOM references. We've updated our +[Retry-ability Guide](/guides/core-concepts/retry-ability) with all the details +if you'd like to learn more. Read more about 12.0 in [our blog post](https://cypress.io/blog/2022/12/06/cypress-12-release/). @@ -13,6 +32,26 @@ Read more about 12.0 in - Cypress dropped support for Node 12. Use Node 14, Node 16 or Node 18+. Addressed in [#24885](https://github.com/cypress-io/cypress/pull/24885). +- Cypress has always pushed for writing tests in a clean slate. In Cypress 12, + we enforce running tests in a clean browser context through the + [test isolation](/guides/core-concepts/writing-and-organizing-tests#Test-Isolation). + This option is configurable, but is enabled by default behavior. Whether + enabled or disabled, this changes how Cypress previously cleaned up the + browser context **before** each test compares to previous Cypress versions and + you may experience test errors with this upgrade. To better understand the + full impact of this change, please review the + [migration guide](/guides/references/migration-guide#test-isolation). +- The `experimentalSessionAndOrigin` configuration option has been removed and + all functionality associated with this experiment is now enabled by default + now, with the exception of using `require` and `import` with callback supplied + to the [`cy.origin()`](/api/commands/origin) command. To leverage external + dependencies in `cy.origin()` callbacks, set the new + [`e2e.experimentalOriginDependencies`](guides/references/experiments#End-to-End-Testing) + configuration option to `true`. Addresses + [#21471](https://github.com/cypress-io/cypress/issues/21471). + - With the v12 release, the `testIsolation` configuration values from `on` or + `off` to `true` or `false`. Addressed in + [#24935](https://github.com/cypress-io/cypress/pull/24935). - The `Cookies.defaults` and `Cookies.preserveOnce` APIs have been removed. Use the new [`cy.session()`](/api/commands/session) command to preserve cookies between tests. Addresses @@ -30,18 +69,36 @@ Read more about 12.0 in [`cy.clearCookies()`](/api/commands/clearcookies). Addresses [#363](https://github.com/cypress-io/cypress/issues/363), [#5723](https://github.com/cypress-io/cypress/issues/5723) and - [#24526](https://github.com/cypress-io/cypress/issues/24526) + [#24526](https://github.com/cypress-io/cypress/issues/24526). +- The [`.within()`](/api/commands/within) command now requires a single subject + and throws an error if given more than one subject. This change adds + consistency around how `.within()` behaves across commands, since commands + inside a within block would silently select the first element, while others + would use all of them, and others would throw an error. Addressed in + [#24975](https://github.com/cypress-io/cypress/pull/24975). - Cypress now throws an error if any Cypress commands are invoked from inside a [`.should()`](/api/commands/should) callback. This previously resulted in unusual and undefined behavior. Addresses [#5963](https://github.com/cypress-io/cypress/issues/5963), [#14656](https://github.com/cypress-io/cypress/issues/14656) and [#22587](https://github.com/cypress-io/cypress/issues/22587). +- The [`.invoke()`](/api/commands/invoke) command now throws an error if the + invoked function returns a promise. If you wish to call a method that returns + a promise and wait for it to resolve, use [`.then()`](/api/commands/then) + instead of `.invoke()`. Addressed in + [#24417](https://github.com/cypress-io/cypress/pull/24417). +- The [`cy.request()`](/api/commands/request) command to uses + [`querystringify`](https://www.npmjs.com/package/querystringify) to stringify + & parse the `qs` options. This change aligns with how the + [`cy.visit()`](/api/commands/visit) command generates urls with query + parameters. Addressed in + [#20302](https://github.com/cypress-io/cypress/pull/20302). **Features:** - Added a new configuration option called `testIsolation`, which defaults to - `true`. This option determines whether or not + `true`. This option can be set at the `e2e` or suite-level to determine + whether or not [test isolation](/guides/core-concepts/writing-and-organizing-tests#Test-Isolation) is enabled to ensure a clean browser context between tests. Addressed in [#22230](https://github.com/cypress-io/cypress/pull/22230). @@ -84,7 +141,8 @@ Read more about 12.0 in [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) data for all origins with which the test has interacted. Addresses [#24276](https://github.com/cypress-io/cypress/issues/24276). -- Added a new configuration option called `experimentalOriginDependencies`, +- Added a new configuration option called + [`experimentalOriginDependencies`](guides/references/experiments#End-to-End-Testing), which defaults to `false`. This option enables support using `require` and `import` with callback supplied to the [`cy.origin()`](/api/commands/origin) command in end-to-end testing. Previously this feature was enabled through the @@ -117,6 +175,12 @@ Read more about 12.0 in - Corrected Cypress environment variable resolution to correctly resolve environment variables set with `npm config set`. Fixes [#24556](https://github.com/cypress-io/cypress/issues/24556). +- Fixed unexpected behaviors verify a cookie was not returned from not returned + from [`cy.getCookie()`](/api/commands/getcookie). Now its possible to + explicitly assert the cookie did not exist with + `cy.getCookie('foo1').should('not.exist')`. Previously users had to verify + cookies properties did not exist with `.its('value').should('equal', null)`. + Addressed in [#24203](https://github.com/cypress-io/cypress/pull/24203). - Fixed the console output returned from clicking on an aliased intercept in the Command Log. It now logs the yielded request/response object associated to the intercepted call when clicked, where previously it did not log these details. @@ -124,42 +188,3 @@ Read more about 12.0 in - Added the missing Typescript types for the internal [`cy.now()`](/guides/guides/debugging#Run-Cypress-command-outside-the-test) command. Fixed in [#24697](https://github.com/cypress-io/cypress/pull/24697). - -RAW NOTES: - -SUMMARY: Cypress now fully supports for testing multiple domains of different -origins in a single test - -Breaking Changes: - -- The Session and Origin Experiment is now generally available for end-to-end - testing. This means Cypress now fully supports testing multiple domains of - different origins in a single test with the new - [`cy.origin()`](/api/commands/origin) -- `experimentalSessionAndOrigin` flag has been removed and all functionality is - now enabled by default now. Addresses - [#21471](https://github.com/cypress-io/cypress/issues/21471). - -- Added a new `testIsolation` configuration option, which defaults to `true`. To - clear more about about w - - - Changes the testIsolation configuration values from on or off to true or - false. Addressed in - [#24935](https://github.com/cypress-io/cypress/pull/24935). - -- The `cy.invoke()` -- need to find the PR again. - -- https://github.com/cypress-io/cypress/pull/20302 - -FIX: - -- If [`cy.getCookie()`](/api/commands/getcookie) fails to find a cookie, you can - no longer traverse the non-existent cookie's properties (eg, with - .its('value)). If you expect a cookie not to exist, assert that directly, eg: - cy.getCookie('foo1').should('not.exist'). Addressed in - [#24203](https://github.com/cypress-io/cypress/pull/24203). - - This fixes a regression in Cypress 12 introduced as part of the detached dom - rewrite of actionability tests, where the proper element wasn't being clicked - on to gain focus before typing. - https://github.com/cypress-io/cypress/pull/24886 From afe53f59ea160fccc4dba92ec7e453a2131dc751 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 5 Dec 2022 16:01:43 -0600 Subject: [PATCH 34/44] Apply Review feedback --- content/_changelogs/12.0.0.md | 50 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index 05c32db880..e26d11b8a4 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -30,8 +30,10 @@ Read more about 12.0 in **Breaking Changes:** -- Cypress dropped support for Node 12. Use Node 14, Node 16 or Node 18+. - Addressed in [#24885](https://github.com/cypress-io/cypress/pull/24885). +- Cypress dropped support for Node.js 12, 15 and 17 because they these versions + have reached end-of-life. Installing Cypress on your system now requires + Node.js 14, 16 or 18+. Addressed in + [#24885](https://github.com/cypress-io/cypress/pull/24885). - Cypress has always pushed for writing tests in a clean slate. In Cypress 12, we enforce running tests in a clean browser context through the [test isolation](/guides/core-concepts/writing-and-organizing-tests#Test-Isolation). @@ -102,12 +104,12 @@ Read more about 12.0 in [test isolation](/guides/core-concepts/writing-and-organizing-tests#Test-Isolation) is enabled to ensure a clean browser context between tests. Addressed in [#22230](https://github.com/cypress-io/cypress/pull/22230). -- The previously experimental Cypress command, called +- The previously experimental Cypress command, [`cy.origin()`](/api/commands/origin), is now generally available in end-to-end testing. This command allows testing multiple domains of different origins in a single test. Addresses [#17336](https://github.com/cypress-io/cypress/issues/17336). -- The previously experimental Cypress command, called +- The previously experimental Cypress command, [`cy.session()`](/api/commands/session), is now generally available. This command caches and restores `cookies`, [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage), @@ -115,27 +117,22 @@ Read more about 12.0 in [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) in order to recreate a consistent browser context between tests. Addresses [#20977](https://github.com/cypress-io/cypress/issues/20977). -- Added a new Cypress command, called +- Added a new Cypress command, [`cy.getAllLocalStorage()`](/api/commands/getAllLocalStorage), to get [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) data for all origins with which the test has interacted. Addresses [#24276](https://github.com/cypress-io/cypress/issues/24276). -- Added a new Cypress command, called - [`cy.getAllLocalStorage()`](/api/commands/getAllLocalStorage), to get - [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) - data for all origins with which the test has interacted. Addresses - [#24276](https://github.com/cypress-io/cypress/issues/24276). -- Added a new Cypress command, called +- Added a new Cypress command, [`cy.clearAllLocalStorage()`](/api/commands/clearAllLocalStorage), to clear [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) data for all origins with which the test has interacted. Addresses [#24276](https://github.com/cypress-io/cypress/issues/24276). -- Added a new Cypress command, called +- Added a new Cypress command, [`cy.getAllSessionStorage()`](/api/commands/getAllSessionStorage), to get [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) data for all origins with which the test has interacted. Addresses [#24276](https://github.com/cypress-io/cypress/issues/24276). -- Added a new Cypress command, called +- Added a new Cypress command, [`cy.clearAllSessionStorage()`](/api/commands/clearAllSessionStorage), to clear [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) @@ -146,13 +143,16 @@ Read more about 12.0 in which defaults to `false`. This option enables support using `require` and `import` with callback supplied to the [`cy.origin()`](/api/commands/origin) command in end-to-end testing. Previously this feature was enabled through the - `experimentalSessionAndOrigin` configuration option. This was added as a - configuration option in v12.0, instead of being enabled by default, due to - increase node memory usage associated with this option that needs addressed - before making this behavior generally available. Addressed in + `experimentalSessionAndOrigin` configuration option. + `experimentalOriginDependencies` was added as a configuration option in v12.0, + instead of being enabled by default, due to increased Node.js memory usage + associated with this option that needs to be addressed before making this + behavior generally available. See issue + [#24976](https://github.com/cypress-io/cypress/issues/24976) for more + information. Addressed in [#24931](https://github.com/cypress-io/cypress/pull/24931). -- Added a new `Cypress.ensure` API which provided several methods that can be - helpful when writing customs command and custom query commands. Addressed in +- Added a new `Cypress.ensure` API which provides several methods that can be + helpful when writing customs commands. Addressed in [#24697](https://github.com/cypress-io/cypress/pull/24697). - Added a new "Run All" button to the [`experimentalRunAllSpecs`](guides/references/experiments#End-to-End-Testing) @@ -165,14 +165,14 @@ Read more about 12.0 in **Bugfixes:** -- Fix a regression in [10.11.0](#10-11-0) where the Launchpad no longer showed a - loading spinner on startup to indicate that it has successfully started an was - a loading state. Fixed +- Fixed a regression in [10.11.0](#10-11-0) where the Launchpad no longer showed + a loading spinner on startup to indicate that it had successfully started and + was in a loading state. Fixed [#24950](https://github.com/cypress-io/cypress/issues/24950). - Fixed the "Create Spec from Component" capability to correctly scaffold the component spec from a component which contains special characters in its name. - Before this change, it scaffolded spec with either the wrong spec name or the - incorrect component import which lead to invalid JS errors. Fixes + Before this change, a spec was scaffolded with either the wrong spec name or + the incorrect component import which lead to invalid JS errors. Fixes [#23492](https://github.com/cypress-io/cypress/issues/23492). - Corrected Cypress environment variable resolution to correctly resolve environment variables set with `npm config set`. Fixes @@ -187,6 +187,6 @@ Read more about 12.0 in Command Log. It now logs the yielded request/response object associated to the intercepted call when clicked, where previously it did not log these details. Fixed in [#24623](https://github.com/cypress-io/cypress/pull/24623). -- Added the missing Typescript types for the internal +- Added missing Typescript types for the internal [`cy.now()`](/guides/guides/debugging#Run-Cypress-command-outside-the-test) command. Fixed in [#24697](https://github.com/cypress-io/cypress/pull/24697). From 04065758d78523d9c4a21ce6109923cb289ce4fa Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 5 Dec 2022 16:04:58 -0600 Subject: [PATCH 35/44] missed feedback update --- content/_changelogs/12.0.0.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index e26d11b8a4..353b562aea 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -140,14 +140,14 @@ Read more about 12.0 in [#24276](https://github.com/cypress-io/cypress/issues/24276). - Added a new configuration option called [`experimentalOriginDependencies`](guides/references/experiments#End-to-End-Testing), - which defaults to `false`. This option enables support using `require` and - `import` with callback supplied to the [`cy.origin()`](/api/commands/origin) - command in end-to-end testing. Previously this feature was enabled through the - `experimentalSessionAndOrigin` configuration option. - `experimentalOriginDependencies` was added as a configuration option in v12.0, - instead of being enabled by default, due to increased Node.js memory usage - associated with this option that needs to be addressed before making this - behavior generally available. See issue + which defaults to `false`. This option enables support for `require` and + `import` within the callback supplied to the + [`cy.origin()`](/api/commands/origin) command in end-to-end testing. + Previously this feature was enabled through the `experimentalSessionAndOrigin` + configuration option. `experimentalOriginDependencies` was added as a + configuration option in v12.0, instead of being enabled by default, due to + increased Node.js memory usage associated with this option that needs to be + addressed before making this behavior generally available. See issue [#24976](https://github.com/cypress-io/cypress/issues/24976) for more information. Addressed in [#24931](https://github.com/cypress-io/cypress/pull/24931). From 2a6b805a609b788efc7e981a622e2246d774cdd7 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 5 Dec 2022 16:07:04 -0600 Subject: [PATCH 36/44] Update content/_changelogs/12.0.0.md Co-authored-by: Matt Schile --- content/_changelogs/12.0.0.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index 353b562aea..44424aea9e 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -106,8 +106,7 @@ Read more about 12.0 in [#22230](https://github.com/cypress-io/cypress/pull/22230). - The previously experimental Cypress command, [`cy.origin()`](/api/commands/origin), is now generally available in - end-to-end testing. This command allows testing multiple domains of different - origins in a single test. Addresses + end-to-end testing. This command allows testing multiple origins in a single test. Addresses [#17336](https://github.com/cypress-io/cypress/issues/17336). - The previously experimental Cypress command, [`cy.session()`](/api/commands/session), is now generally available. This From 4cd17e6a55d9ee8cf53ef0685fe16fb95ef6372f Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 5 Dec 2022 16:11:02 -0600 Subject: [PATCH 37/44] pretty markdown --- content/_changelogs/12.0.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index 44424aea9e..c356b9bc4a 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -106,8 +106,8 @@ Read more about 12.0 in [#22230](https://github.com/cypress-io/cypress/pull/22230). - The previously experimental Cypress command, [`cy.origin()`](/api/commands/origin), is now generally available in - end-to-end testing. This command allows testing multiple origins in a single test. Addresses - [#17336](https://github.com/cypress-io/cypress/issues/17336). + end-to-end testing. This command allows testing multiple origins in a single + test. Addresses [#17336](https://github.com/cypress-io/cypress/issues/17336). - The previously experimental Cypress command, [`cy.session()`](/api/commands/session), is now generally available. This command caches and restores `cookies`, From b48ece601e51ef1c173517608ab73fd6440bfd77 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 5 Dec 2022 16:14:47 -0600 Subject: [PATCH 38/44] Update content/_changelogs/12.0.0.md Co-authored-by: Ryan Manuel --- content/_changelogs/12.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index c356b9bc4a..71bb7a2a04 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -30,7 +30,7 @@ Read more about 12.0 in **Breaking Changes:** -- Cypress dropped support for Node.js 12, 15 and 17 because they these versions +- Cypress dropped support for Node.js 12, 15 and 17 because these versions have reached end-of-life. Installing Cypress on your system now requires Node.js 14, 16 or 18+. Addressed in [#24885](https://github.com/cypress-io/cypress/pull/24885). From e7bb6304aa814eae6ecbf669a9718eb58408a9c4 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 5 Dec 2022 16:22:17 -0600 Subject: [PATCH 39/44] missing entry --- content/_changelogs/12.0.0.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index c356b9bc4a..cc9d7905a9 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -176,6 +176,11 @@ Read more about 12.0 in - Corrected Cypress environment variable resolution to correctly resolve environment variables set with `npm config set`. Fixes [#24556](https://github.com/cypress-io/cypress/issues/24556). +- When + [`experimentalRunAllSpecs=true`](guides/references/experiments#End-to-End-Testing), + the "Run N specs" directory-level buttons in the Inline Specs List now + function correctly when activated by the keyboard. Fixes + [#24762](https://github.com/cypress-io/cypress/pull/24762). - Fixed unexpected behaviors verify a cookie was not returned from not returned from [`cy.getCookie()`](/api/commands/getcookie). Now its possible to explicitly assert the cookie did not exist with From bd469ba8644f790c9e9ec560192f7aa185d1031a Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 5 Dec 2022 16:28:41 -0600 Subject: [PATCH 40/44] Apply suggestions from code review Co-authored-by: Matt Schile Co-authored-by: Ryan Manuel --- content/_changelogs/12.0.0.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index 71bb7a2a04..a355d27aec 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -7,8 +7,8 @@ _Released 12/06/2022_ The Session and Origin Experiment is now generally available for end-to-end testing. This means Cypress now fully supports: -- testing multiple domains of different origins in a single test with the new - [`cy.origin()`](/api/commands/origin) +- testing multiple origins in a single test with the new + [`cy.origin()`](/api/commands/origin) command. - caching and restoring `cookies`, [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage), and @@ -34,24 +34,24 @@ Read more about 12.0 in have reached end-of-life. Installing Cypress on your system now requires Node.js 14, 16 or 18+. Addressed in [#24885](https://github.com/cypress-io/cypress/pull/24885). -- Cypress has always pushed for writing tests in a clean slate. In Cypress 12, - we enforce running tests in a clean browser context through the +- Cypress has always recommended writing tests in a clean context. In Cypress 12, + we enforce running tests in a clean browser context through [test isolation](/guides/core-concepts/writing-and-organizing-tests#Test-Isolation). - This option is configurable, but is enabled by default behavior. Whether - enabled or disabled, this changes how Cypress previously cleaned up the - browser context **before** each test compares to previous Cypress versions and + This option is configurable, but is enabled by default. Whether + enabled or disabled, this changed compared to how Cypress previously cleaned up the + browser context __before__ each test and you may experience test errors with this upgrade. To better understand the full impact of this change, please review the [migration guide](/guides/references/migration-guide#test-isolation). - The `experimentalSessionAndOrigin` configuration option has been removed and all functionality associated with this experiment is now enabled by default - now, with the exception of using `require` and `import` with callback supplied + , with the exception of using `require` and `import` with callback supplied to the [`cy.origin()`](/api/commands/origin) command. To leverage external dependencies in `cy.origin()` callbacks, set the new [`e2e.experimentalOriginDependencies`](guides/references/experiments#End-to-End-Testing) configuration option to `true`. Addresses [#21471](https://github.com/cypress-io/cypress/issues/21471). - - With the v12 release, the `testIsolation` configuration values from `on` or + - With the v12 release, the `testIsolation` configuration values have changed from `on` or `off` to `true` or `false`. Addressed in [#24935](https://github.com/cypress-io/cypress/pull/24935). - The `Cookies.defaults` and `Cookies.preserveOnce` APIs have been removed. Use From aa8864cad1ce250127f302834c351fa2df7a97bc Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 5 Dec 2022 16:29:48 -0600 Subject: [PATCH 41/44] fix markdown lint --- content/_changelogs/12.0.0.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index 4bb56ee1d8..6f7a709c06 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -30,29 +30,29 @@ Read more about 12.0 in **Breaking Changes:** -- Cypress dropped support for Node.js 12, 15 and 17 because these versions - have reached end-of-life. Installing Cypress on your system now requires - Node.js 14, 16 or 18+. Addressed in +- Cypress dropped support for Node.js 12, 15 and 17 because these versions have + reached end-of-life. Installing Cypress on your system now requires Node.js + 14, 16 or 18+. Addressed in [#24885](https://github.com/cypress-io/cypress/pull/24885). -- Cypress has always recommended writing tests in a clean context. In Cypress 12, - we enforce running tests in a clean browser context through +- Cypress has always recommended writing tests in a clean context. In Cypress + 12, we enforce running tests in a clean browser context through [test isolation](/guides/core-concepts/writing-and-organizing-tests#Test-Isolation). - This option is configurable, but is enabled by default. Whether - enabled or disabled, this changed compared to how Cypress previously cleaned up the - browser context __before__ each test and - you may experience test errors with this upgrade. To better understand the - full impact of this change, please review the + This option is configurable, but is enabled by default. Whether enabled or + disabled, this changed compared to how Cypress previously cleaned up the + browser context **before** each test and you may experience test errors with + this upgrade. To better understand the full impact of this change, please + review the [migration guide](/guides/references/migration-guide#test-isolation). - The `experimentalSessionAndOrigin` configuration option has been removed and - all functionality associated with this experiment is now enabled by default - , with the exception of using `require` and `import` with callback supplied - to the [`cy.origin()`](/api/commands/origin) command. To leverage external + all functionality associated with this experiment is now enabled by default , + with the exception of using `require` and `import` with callback supplied to + the [`cy.origin()`](/api/commands/origin) command. To leverage external dependencies in `cy.origin()` callbacks, set the new [`e2e.experimentalOriginDependencies`](guides/references/experiments#End-to-End-Testing) configuration option to `true`. Addresses [#21471](https://github.com/cypress-io/cypress/issues/21471). - - With the v12 release, the `testIsolation` configuration values have changed from `on` or - `off` to `true` or `false`. Addressed in + - With the v12 release, the `testIsolation` configuration values have changed + from `on` or `off` to `true` or `false`. Addressed in [#24935](https://github.com/cypress-io/cypress/pull/24935). - The `Cookies.defaults` and `Cookies.preserveOnce` APIs have been removed. Use the new [`cy.session()`](/api/commands/session) command to preserve cookies From a366c19d4e5cb77ea2bdcdc4fd9a8ad2bcab43e4 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Tue, 6 Dec 2022 07:23:05 -0600 Subject: [PATCH 42/44] apply more feedback --- thank you Matt!! --- content/_changelogs/12.0.0.md | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index 6f7a709c06..9ac45c5c26 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -43,17 +43,17 @@ Read more about 12.0 in this upgrade. To better understand the full impact of this change, please review the [migration guide](/guides/references/migration-guide#test-isolation). + - In Cypress v12, the `testIsolation` configuration values have changed from + `on` or `off` to `true` or `false`. Addressed in + [#24935](https://github.com/cypress-io/cypress/pull/24935). - The `experimentalSessionAndOrigin` configuration option has been removed and - all functionality associated with this experiment is now enabled by default , + all functionality associated with this experiment is now enabled by default, with the exception of using `require` and `import` with callback supplied to the [`cy.origin()`](/api/commands/origin) command. To leverage external dependencies in `cy.origin()` callbacks, set the new [`e2e.experimentalOriginDependencies`](guides/references/experiments#End-to-End-Testing) configuration option to `true`. Addresses [#21471](https://github.com/cypress-io/cypress/issues/21471). - - With the v12 release, the `testIsolation` configuration values have changed - from `on` or `off` to `true` or `false`. Addressed in - [#24935](https://github.com/cypress-io/cypress/pull/24935). - The `Cookies.defaults` and `Cookies.preserveOnce` APIs have been removed. Use the new [`cy.session()`](/api/commands/session) command to preserve cookies between tests. Addresses @@ -74,9 +74,10 @@ Read more about 12.0 in [#24526](https://github.com/cypress-io/cypress/issues/24526). - The [`.within()`](/api/commands/within) command now requires a single subject and throws an error if given more than one subject. This change adds - consistency around how `.within()` behaves across commands, since commands - inside a within block would silently select the first element, while others - would use all of them, and others would throw an error. Addressed in + consistency around how `.within()` behaves across commands. Previously some + commands inside a `.within()` callback would silently select the first + element, while others would use all of the previously yielded subjects, and + others would throw an error. Addressed in [#24975](https://github.com/cypress-io/cypress/pull/24975). - Cypress now throws an error if any Cypress commands are invoked from inside a [`.should()`](/api/commands/should) callback. This previously resulted in @@ -89,7 +90,7 @@ Read more about 12.0 in a promise and wait for it to resolve, use [`.then()`](/api/commands/then) instead of `.invoke()`. Addressed in [#24417](https://github.com/cypress-io/cypress/pull/24417). -- The [`cy.request()`](/api/commands/request) command to uses +- The [`cy.request()`](/api/commands/request) command now uses [`querystringify`](https://www.npmjs.com/package/querystringify) to stringify & parse the `qs` options. This change aligns with how the [`cy.visit()`](/api/commands/visit) command generates urls with query @@ -144,8 +145,8 @@ Read more about 12.0 in [`cy.origin()`](/api/commands/origin) command in end-to-end testing. Previously this feature was enabled through the `experimentalSessionAndOrigin` configuration option. `experimentalOriginDependencies` was added as a - configuration option in v12.0, instead of being enabled by default, due to - increased Node.js memory usage associated with this option that needs to be + configuration option in Cypress 12, instead of being enabled by default, due + to increased Node.js memory usage associated with this option that needs to be addressed before making this behavior generally available. See issue [#24976](https://github.com/cypress-io/cypress/issues/24976) for more information. Addressed in @@ -181,9 +182,9 @@ Read more about 12.0 in the "Run N specs" directory-level buttons in the Inline Specs List now function correctly when activated by the keyboard. Fixes [#24762](https://github.com/cypress-io/cypress/pull/24762). -- Fixed unexpected behaviors verify a cookie was not returned from not returned - from [`cy.getCookie()`](/api/commands/getcookie). Now its possible to - explicitly assert the cookie did not exist with +- Fixed unexpected behaviors when verifying a cookie was not returned from not + returned from [`cy.getCookie()`](/api/commands/getcookie). Now it's possible + to explicitly assert the cookie did not exist with `cy.getCookie('foo1').should('not.exist')`. Previously users had to verify cookies properties did not exist with `.its('value').should('equal', null)`. Addressed in [#24203](https://github.com/cypress-io/cypress/pull/24203). From dad6db6b5f165940388a505238be97044cf0eb6e Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Tue, 6 Dec 2022 08:51:26 -0600 Subject: [PATCH 43/44] Apply suggestions from code review Co-authored-by: Chris Breiding --- content/_changelogs/12.0.0.md | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index 9ac45c5c26..36e25b58a7 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -7,20 +7,20 @@ _Released 12/06/2022_ The Session and Origin Experiment is now generally available for end-to-end testing. This means Cypress now fully supports: -- testing multiple origins in a single test with the new +- Testing multiple origins in a single test with the new [`cy.origin()`](/api/commands/origin) command. -- caching and restoring `cookies`, +- Caching and restoring cookies, [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage), and [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) between tests -- configuring +- Configuring [`testIsolation`](/guides/core-concepts/writing-and-organizing-tests#Test-Isolation) in suites to define whether or not the browser context is cleaned or persisted between tests Additionally in this release, enhancements were made to how Cypress manages DOM -element resolution to reduce the likelihood of hitting the dreaded detached DOM +element resolution to reduce the likelihood of hitting detached DOM errors due to maintaining stale DOM references. We've updated our [Retry-ability Guide](/guides/core-concepts/retry-ability) with all the details if you'd like to learn more. @@ -30,7 +30,7 @@ Read more about 12.0 in **Breaking Changes:** -- Cypress dropped support for Node.js 12, 15 and 17 because these versions have +- Cypress dropped support for Node.js 12, 15 and 17. Those versions have reached end-of-life. Installing Cypress on your system now requires Node.js 14, 16 or 18+. Addressed in [#24885](https://github.com/cypress-io/cypress/pull/24885). @@ -38,8 +38,8 @@ Read more about 12.0 in 12, we enforce running tests in a clean browser context through [test isolation](/guides/core-concepts/writing-and-organizing-tests#Test-Isolation). This option is configurable, but is enabled by default. Whether enabled or - disabled, this changed compared to how Cypress previously cleaned up the - browser context **before** each test and you may experience test errors with + disabled, this changes how Cypress cleans up the + browser context before each test and you may experience test errors with this upgrade. To better understand the full impact of this change, please review the [migration guide](/guides/references/migration-guide#test-isolation). @@ -172,7 +172,7 @@ Read more about 12.0 in - Fixed the "Create Spec from Component" capability to correctly scaffold the component spec from a component which contains special characters in its name. Before this change, a spec was scaffolded with either the wrong spec name or - the incorrect component import which lead to invalid JS errors. Fixes + the incorrect component import which led to invalid JS errors. Fixes [#23492](https://github.com/cypress-io/cypress/issues/23492). - Corrected Cypress environment variable resolution to correctly resolve environment variables set with `npm config set`. Fixes @@ -182,8 +182,8 @@ Read more about 12.0 in the "Run N specs" directory-level buttons in the Inline Specs List now function correctly when activated by the keyboard. Fixes [#24762](https://github.com/cypress-io/cypress/pull/24762). -- Fixed unexpected behaviors when verifying a cookie was not returned from not - returned from [`cy.getCookie()`](/api/commands/getcookie). Now it's possible +- Fixed unexpected behaviors when verifying a cookie was not returned from + [`cy.getCookie()`](/api/commands/getcookie). Now it's possible to explicitly assert the cookie did not exist with `cy.getCookie('foo1').should('not.exist')`. Previously users had to verify cookies properties did not exist with `.its('value').should('equal', null)`. @@ -192,6 +192,3 @@ Read more about 12.0 in Command Log. It now logs the yielded request/response object associated to the intercepted call when clicked, where previously it did not log these details. Fixed in [#24623](https://github.com/cypress-io/cypress/pull/24623). -- Added missing Typescript types for the internal - [`cy.now()`](/guides/guides/debugging#Run-Cypress-command-outside-the-test) - command. Fixed in [#24697](https://github.com/cypress-io/cypress/pull/24697). From e55a7ba3bd10392b6874ba1c493ebd794111a15e Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Tue, 6 Dec 2022 08:52:17 -0600 Subject: [PATCH 44/44] fix markdown --- content/_changelogs/12.0.0.md | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/content/_changelogs/12.0.0.md b/content/_changelogs/12.0.0.md index 36e25b58a7..fa982174cb 100644 --- a/content/_changelogs/12.0.0.md +++ b/content/_changelogs/12.0.0.md @@ -20,8 +20,8 @@ testing. This means Cypress now fully supports: between tests Additionally in this release, enhancements were made to how Cypress manages DOM -element resolution to reduce the likelihood of hitting detached DOM -errors due to maintaining stale DOM references. We've updated our +element resolution to reduce the likelihood of hitting detached DOM errors due +to maintaining stale DOM references. We've updated our [Retry-ability Guide](/guides/core-concepts/retry-ability) with all the details if you'd like to learn more. @@ -30,18 +30,16 @@ Read more about 12.0 in **Breaking Changes:** -- Cypress dropped support for Node.js 12, 15 and 17. Those versions have - reached end-of-life. Installing Cypress on your system now requires Node.js - 14, 16 or 18+. Addressed in - [#24885](https://github.com/cypress-io/cypress/pull/24885). +- Cypress dropped support for Node.js 12, 15 and 17. Those versions have reached + end-of-life. Installing Cypress on your system now requires Node.js 14, 16 or + 18+. Addressed in [#24885](https://github.com/cypress-io/cypress/pull/24885). - Cypress has always recommended writing tests in a clean context. In Cypress 12, we enforce running tests in a clean browser context through [test isolation](/guides/core-concepts/writing-and-organizing-tests#Test-Isolation). This option is configurable, but is enabled by default. Whether enabled or - disabled, this changes how Cypress cleans up the - browser context before each test and you may experience test errors with - this upgrade. To better understand the full impact of this change, please - review the + disabled, this changes how Cypress cleans up the browser context before each + test and you may experience test errors with this upgrade. To better + understand the full impact of this change, please review the [migration guide](/guides/references/migration-guide#test-isolation). - In Cypress v12, the `testIsolation` configuration values have changed from `on` or `off` to `true` or `false`. Addressed in @@ -183,8 +181,8 @@ Read more about 12.0 in function correctly when activated by the keyboard. Fixes [#24762](https://github.com/cypress-io/cypress/pull/24762). - Fixed unexpected behaviors when verifying a cookie was not returned from - [`cy.getCookie()`](/api/commands/getcookie). Now it's possible - to explicitly assert the cookie did not exist with + [`cy.getCookie()`](/api/commands/getcookie). Now it's possible to explicitly + assert the cookie did not exist with `cy.getCookie('foo1').should('not.exist')`. Previously users had to verify cookies properties did not exist with `.its('value').should('equal', null)`. Addressed in [#24203](https://github.com/cypress-io/cypress/pull/24203).