Skip to content

Commit 5feafd6

Browse files
authored
feat(testing): add support for cypress v14 (#30618)
## Current Behavior Cypress v14 is not supported. ## Expected Behavior Cypress v14 is supported. ## Related Issue(s) Fixes #30097
1 parent 3b91e0b commit 5feafd6

File tree

58 files changed

+4401
-570
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+4401
-570
lines changed

docs/generated/manifests/nx-api.json

+50
Original file line numberDiff line numberDiff line change
@@ -1372,6 +1372,56 @@
13721372
}
13731373
},
13741374
"migrations": {
1375+
"/nx-api/cypress/migrations/set-inject-document-domain": {
1376+
"description": "Replaces the `experimentalSkipDomainInjection` configuration option with the new `injectDocumentDomain` configuration option.",
1377+
"file": "generated/packages/cypress/migrations/set-inject-document-domain.json",
1378+
"hidden": false,
1379+
"name": "set-inject-document-domain",
1380+
"version": "20.8.0-beta.0",
1381+
"originalFilePath": "/packages/cypress",
1382+
"path": "/nx-api/cypress/migrations/set-inject-document-domain",
1383+
"type": "migration"
1384+
},
1385+
"/nx-api/cypress/migrations/remove-experimental-fetch-polyfill": {
1386+
"description": "Removes the `experimentalFetchPolyfill` configuration option.",
1387+
"file": "generated/packages/cypress/migrations/remove-experimental-fetch-polyfill.json",
1388+
"hidden": false,
1389+
"name": "remove-experimental-fetch-polyfill",
1390+
"version": "20.8.0-beta.0",
1391+
"originalFilePath": "/packages/cypress",
1392+
"path": "/nx-api/cypress/migrations/remove-experimental-fetch-polyfill",
1393+
"type": "migration"
1394+
},
1395+
"/nx-api/cypress/migrations/replace-experimental-just-in-time-compile": {
1396+
"description": "Replaces the `experimentalJustInTimeCompile` configuration option with the new `justInTimeCompile` configuration option.",
1397+
"file": "generated/packages/cypress/migrations/replace-experimental-just-in-time-compile.json",
1398+
"hidden": false,
1399+
"name": "replace-experimental-just-in-time-compile",
1400+
"version": "20.8.0-beta.0",
1401+
"originalFilePath": "/packages/cypress",
1402+
"path": "/nx-api/cypress/migrations/replace-experimental-just-in-time-compile",
1403+
"type": "migration"
1404+
},
1405+
"/nx-api/cypress/migrations/update-component-testing-mount-imports": {
1406+
"description": "Updates the module specifier for the Component Testing `mount` function.",
1407+
"file": "generated/packages/cypress/migrations/update-component-testing-mount-imports.json",
1408+
"hidden": false,
1409+
"name": "update-component-testing-mount-imports",
1410+
"version": "20.8.0-beta.0",
1411+
"originalFilePath": "/packages/cypress",
1412+
"path": "/nx-api/cypress/migrations/update-component-testing-mount-imports",
1413+
"type": "migration"
1414+
},
1415+
"/nx-api/cypress/migrations/20.8.0-package-updates": {
1416+
"description": "",
1417+
"file": "generated/packages/cypress/migrations/20.8.0-package-updates.json",
1418+
"hidden": false,
1419+
"name": "20.8.0-package-updates",
1420+
"version": "20.8.0-beta.0",
1421+
"originalFilePath": "/packages/cypress",
1422+
"path": "/nx-api/cypress/migrations/20.8.0-package-updates",
1423+
"type": "migration"
1424+
},
13751425
"/nx-api/cypress/migrations/update-19-6-0-update-ci-webserver-for-vite": {
13761426
"description": "Update ciWebServerCommand to use static serve for the application.",
13771427
"file": "generated/packages/cypress/migrations/update-19-6-0-update-ci-webserver-for-vite.json",

docs/generated/packages-metadata.json

+50
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,56 @@
13641364
}
13651365
],
13661366
"migrations": [
1367+
{
1368+
"description": "Replaces the `experimentalSkipDomainInjection` configuration option with the new `injectDocumentDomain` configuration option.",
1369+
"file": "generated/packages/cypress/migrations/set-inject-document-domain.json",
1370+
"hidden": false,
1371+
"name": "set-inject-document-domain",
1372+
"version": "20.8.0-beta.0",
1373+
"originalFilePath": "/packages/cypress",
1374+
"path": "cypress/migrations/set-inject-document-domain",
1375+
"type": "migration"
1376+
},
1377+
{
1378+
"description": "Removes the `experimentalFetchPolyfill` configuration option.",
1379+
"file": "generated/packages/cypress/migrations/remove-experimental-fetch-polyfill.json",
1380+
"hidden": false,
1381+
"name": "remove-experimental-fetch-polyfill",
1382+
"version": "20.8.0-beta.0",
1383+
"originalFilePath": "/packages/cypress",
1384+
"path": "cypress/migrations/remove-experimental-fetch-polyfill",
1385+
"type": "migration"
1386+
},
1387+
{
1388+
"description": "Replaces the `experimentalJustInTimeCompile` configuration option with the new `justInTimeCompile` configuration option.",
1389+
"file": "generated/packages/cypress/migrations/replace-experimental-just-in-time-compile.json",
1390+
"hidden": false,
1391+
"name": "replace-experimental-just-in-time-compile",
1392+
"version": "20.8.0-beta.0",
1393+
"originalFilePath": "/packages/cypress",
1394+
"path": "cypress/migrations/replace-experimental-just-in-time-compile",
1395+
"type": "migration"
1396+
},
1397+
{
1398+
"description": "Updates the module specifier for the Component Testing `mount` function.",
1399+
"file": "generated/packages/cypress/migrations/update-component-testing-mount-imports.json",
1400+
"hidden": false,
1401+
"name": "update-component-testing-mount-imports",
1402+
"version": "20.8.0-beta.0",
1403+
"originalFilePath": "/packages/cypress",
1404+
"path": "cypress/migrations/update-component-testing-mount-imports",
1405+
"type": "migration"
1406+
},
1407+
{
1408+
"description": "",
1409+
"file": "generated/packages/cypress/migrations/20.8.0-package-updates.json",
1410+
"hidden": false,
1411+
"name": "20.8.0-package-updates",
1412+
"version": "20.8.0-beta.0",
1413+
"originalFilePath": "/packages/cypress",
1414+
"path": "cypress/migrations/20.8.0-package-updates",
1415+
"type": "migration"
1416+
},
13671417
{
13681418
"description": "Update ciWebServerCommand to use static serve for the application.",
13691419
"file": "generated/packages/cypress/migrations/update-19-6-0-update-ci-webserver-for-vite.json",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "20.8.0-package-updates",
3+
"version": "20.8.0-beta.0",
4+
"x-prompt": "Do you want to update the Cypress version to v14?",
5+
"requires": { "cypress": ">=13.0.0 <14.0.0" },
6+
"packages": {
7+
"cypress": { "version": "^14.2.1", "alwaysAddToPackageJson": false },
8+
"@cypress/vite-dev-server": {
9+
"version": "^6.0.3",
10+
"alwaysAddToPackageJson": false
11+
},
12+
"@cypress/webpack-dev-server": {
13+
"version": "^4.0.2",
14+
"alwaysAddToPackageJson": false
15+
}
16+
},
17+
"aliases": [],
18+
"description": "",
19+
"hidden": false,
20+
"implementation": "",
21+
"path": "/packages/cypress",
22+
"schema": null,
23+
"type": "migration"
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "remove-experimental-fetch-polyfill",
3+
"cli": "nx",
4+
"version": "20.8.0-beta.0",
5+
"requires": { "cypress": ">=14.0.0" },
6+
"description": "Removes the `experimentalFetchPolyfill` configuration option.",
7+
"implementation": "/packages/cypress/src/migrations/update-20-8-0/remove-experimental-fetch-polyfill.ts",
8+
"aliases": [],
9+
"hidden": false,
10+
"path": "/packages/cypress",
11+
"schema": null,
12+
"type": "migration",
13+
"examplesFile": "#### Remove `experimentalFetchPolyfill` Configuration Option\n\nRemoves the `experimentalFetchPolyfill` configuration option that was removed in Cypress v14. Read more at the [migration notes](<https://docs.cypress.io/app/references/changelog#:~:text=The%20experimentalFetchPolyfill%20configuration%20option%20was,cy.intercept()%20for%20handling%20fetch%20requests>).\n\n#### Examples\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```ts {% fileName=\"apps/app1-e2e/cypress.config.ts\" %}\nimport { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';\nimport { defineConfig } from 'cypress';\n\nexport default defineConfig({\n e2e: {\n ...nxE2EPreset(__filename, {\n cypressDir: 'src',\n bundler: 'vite',\n webServerCommands: {\n default: 'pnpm exec nx run app1:dev',\n production: 'pnpm exec nx run app1:dev',\n },\n ciWebServerCommand: 'pnpm exec nx run app1:dev',\n ciBaseUrl: 'http://localhost:4200',\n }),\n baseUrl: 'http://localhost:4200',\n experimentalFetchPolyfill: true,\n },\n});\n```\n\n{% /tab %}\n\n{% tab label=\"After\" %}\n\n```ts {% fileName=\"apps/app1-e2e/cypress.config.ts\" %}\nimport { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';\nimport { defineConfig } from 'cypress';\n\nexport default defineConfig({\n e2e: {\n ...nxE2EPreset(__filename, {\n cypressDir: 'src',\n bundler: 'vite',\n webServerCommands: {\n default: 'pnpm exec nx run app1:dev',\n production: 'pnpm exec nx run app1:dev',\n },\n ciWebServerCommand: 'pnpm exec nx run app1:dev',\n ciBaseUrl: 'http://localhost:4200',\n }),\n baseUrl: 'http://localhost:4200',\n },\n});\n```\n\n{% /tab %}\n\n{% /tabs %}\n"
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "replace-experimental-just-in-time-compile",
3+
"cli": "nx",
4+
"version": "20.8.0-beta.0",
5+
"requires": { "cypress": ">=14.0.0" },
6+
"description": "Replaces the `experimentalJustInTimeCompile` configuration option with the new `justInTimeCompile` configuration option.",
7+
"implementation": "/packages/cypress/src/migrations/update-20-8-0/replace-experimental-just-in-time-compile.ts",
8+
"aliases": [],
9+
"hidden": false,
10+
"path": "/packages/cypress",
11+
"schema": null,
12+
"type": "migration",
13+
"examplesFile": "#### Replace the `experimentalJustInTimeCompile` Configuration Option with `justInTimeCompile`\n\nReplaces the `experimentalJustInTimeCompile` configuration option with the new `justInTimeCompile` configuration option. Read more at the [migration notes](https://docs.cypress.io/app/references/migration-guide#CT-Just-in-Time-Compile-changes).\n\n#### Examples\n\nIf the `experimentalJustInTimeCompile` configuration option is present and set to `true`, the migration will remove it. This is to account for the fact that JIT compilation is the default behavior in Cypress v14.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```ts {% fileName=\"apps/app1/cypress.config.ts\" %}\nimport { defineConfig } from 'cypress';\n\nexport default defineConfig({\n component: {\n devServer: {\n framework: 'angular',\n bundler: 'webpack',\n },\n experimentalJustInTimeCompile: true,\n },\n});\n```\n\n{% /tab %}\n\n{% tab label=\"After\" %}\n\n```ts {% fileName=\"apps/app1/cypress.config.ts\" %}\nimport { defineConfig } from 'cypress';\n\nexport default defineConfig({\n component: {\n devServer: {\n framework: 'angular',\n bundler: 'webpack',\n },\n },\n});\n```\n\n{% /tab %}\n{% /tabs %}\n\nIf the `experimentalJustInTimeCompile` configuration option is set to `false` and it is using webpack, the migration will rename it to `justInTimeCompile`.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```ts {% fileName=\"apps/app1/cypress.config.ts\" %}\nimport { defineConfig } from 'cypress';\n\nexport default defineConfig({\n component: {\n devServer: {\n framework: 'angular',\n bundler: 'webpack',\n },\n experimentalJustInTimeCompile: false,\n },\n});\n```\n\n{% /tab %}\n\n{% tab label=\"After\" %}\n\n```ts {% fileName=\"apps/app1/cypress.config.ts\" highlightLines=[9] %}\nimport { defineConfig } from 'cypress';\n\nexport default defineConfig({\n component: {\n devServer: {\n framework: 'angular',\n bundler: 'webpack',\n },\n justInTimeCompile: false,\n },\n});\n```\n\n{% /tab %}\n{% /tabs %}\n\nIf the `experimentalJustInTimeCompile` configuration is set to any value and it is using Vite, the migration will remove it. This is to account for the fact that JIT compilation no longer applies to Vite.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```ts {% fileName=\"apps/app1/cypress.config.ts\" %}\nimport { defineConfig } from 'cypress';\n\nexport default defineConfig({\n component: {\n devServer: {\n framework: 'react',\n bundler: 'vite',\n },\n experimentalJustInTimeCompile: false,\n },\n});\n```\n\n{% /tab %}\n\n{% tab label=\"After\" %}\n\n```ts {% fileName=\"apps/app1/cypress.config.ts\" %}\nimport { defineConfig } from 'cypress';\n\nexport default defineConfig({\n component: {\n devServer: {\n framework: 'react',\n bundler: 'vite',\n },\n },\n});\n```\n\n{% /tab %}\n{% /tabs %}\n"
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "set-inject-document-domain",
3+
"cli": "nx",
4+
"version": "20.8.0-beta.0",
5+
"requires": { "cypress": ">=14.0.0" },
6+
"description": "Replaces the `experimentalSkipDomainInjection` configuration option with the new `injectDocumentDomain` configuration option.",
7+
"implementation": "/packages/cypress/src/migrations/update-20-8-0/set-inject-document-domain.ts",
8+
"aliases": [],
9+
"hidden": false,
10+
"path": "/packages/cypress",
11+
"schema": null,
12+
"type": "migration",
13+
"examplesFile": "#### Set `injectDocumentDomain` Configuration Option\n\nReplaces the removed `experimentalSkipDomainInjection` configuration option with the new `injectDocumentDomain` configuration option when needed. Skipping domain injection is the default behavior in Cypress v14 and therefore, it is required to use the `cy.origin()` command when navigating between domains. The `injectDocumentDomain` option was introduced to ease the transition to v14, but it is deprecated and will be removed in Cypress v15. Read more at the [migration notes](https://docs.cypress.io/app/references/migration-guide#Changes-to-cyorigin).\n\n#### Examples\n\nIf the `experimentalSkipDomainInjection` configuration option is present, the migration will remove it. This is to account for the fact that skipping domain injection is the default behavior in Cypress v14.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```ts {% fileName=\"apps/app1-e2e/cypress.config.ts\" %}\nimport { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';\nimport { defineConfig } from 'cypress';\n\nexport default defineConfig({\n e2e: {\n ...nxE2EPreset(__filename, {\n cypressDir: 'src',\n bundler: 'vite',\n webServerCommands: {\n default: 'pnpm exec nx run app1:dev',\n production: 'pnpm exec nx run app1:dev',\n },\n ciWebServerCommand: 'pnpm exec nx run app1:dev',\n ciBaseUrl: 'http://localhost:4200',\n }),\n baseUrl: 'http://localhost:4200',\n experimentalSkipDomainInjection: ['https://example.com'],\n },\n});\n```\n\n{% /tab %}\n\n{% tab label=\"After\" %}\n\n```ts {% fileName=\"apps/app1-e2e/cypress.config.ts\" %}\nimport { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';\nimport { defineConfig } from 'cypress';\n\nexport default defineConfig({\n e2e: {\n ...nxE2EPreset(__filename, {\n cypressDir: 'src',\n bundler: 'vite',\n webServerCommands: {\n default: 'pnpm exec nx run app1:dev',\n production: 'pnpm exec nx run app1:dev',\n },\n ciWebServerCommand: 'pnpm exec nx run app1:dev',\n ciBaseUrl: 'http://localhost:4200',\n }),\n baseUrl: 'http://localhost:4200',\n },\n});\n```\n\n{% /tab %}\n\n{% /tabs %}\n\nIf the `experimentalSkipDomainInjection` configuration option is present and set to an empty array (no domain injection is skipped), the migration will remove it and will set the `injectDocumentDomain` option to `true`.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```ts {% fileName=\"apps/app1-e2e/cypress.config.ts\" %}\nimport { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';\nimport { defineConfig } from 'cypress';\n\nexport default defineConfig({\n e2e: {\n ...nxE2EPreset(__filename, {\n cypressDir: 'src',\n bundler: 'vite',\n webServerCommands: {\n default: 'pnpm exec nx run app1:dev',\n production: 'pnpm exec nx run app1:dev',\n },\n ciWebServerCommand: 'pnpm exec nx run app1:dev',\n ciBaseUrl: 'http://localhost:4200',\n }),\n baseUrl: 'http://localhost:4200',\n experimentalSkipDomainInjection: [],\n },\n});\n```\n\n{% /tab %}\n\n{% tab label=\"After\" %}\n\n```ts {% fileName=\"apps/app1-e2e/cypress.config.ts\" highlightLines=[\"17-19\"] %}\nimport { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';\nimport { defineConfig } from 'cypress';\n\nexport default defineConfig({\n e2e: {\n ...nxE2EPreset(__filename, {\n cypressDir: 'src',\n bundler: 'vite',\n webServerCommands: {\n default: 'pnpm exec nx run app1:dev',\n production: 'pnpm exec nx run app1:dev',\n },\n ciWebServerCommand: 'pnpm exec nx run app1:dev',\n ciBaseUrl: 'http://localhost:4200',\n }),\n baseUrl: 'http://localhost:4200',\n // Please ensure you use `cy.origin()` when navigating between domains and remove this option.\n // See https://docs.cypress.io/app/references/migration-guide#Changes-to-cyorigin\n injectDocumentDomain: true,\n },\n});\n```\n\n{% /tab %}\n\n{% /tabs %}\n\nIf the `experimentalSkipDomainInjection` configuration option is not present (no domain injection is skipped), the migration will set the `injectDocumentDomain` option to `true`.\n\n{% tabs %}\n{% tab label=\"Before\" %}\n\n```ts {% fileName=\"apps/app1-e2e/cypress.config.ts\" %}\nimport { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';\nimport { defineConfig } from 'cypress';\n\nexport default defineConfig({\n e2e: {\n ...nxE2EPreset(__filename, {\n cypressDir: 'src',\n bundler: 'vite',\n webServerCommands: {\n default: 'pnpm exec nx run app1:dev',\n production: 'pnpm exec nx run app1:dev',\n },\n ciWebServerCommand: 'pnpm exec nx run app1:dev',\n ciBaseUrl: 'http://localhost:4200',\n }),\n baseUrl: 'http://localhost:4200',\n },\n});\n```\n\n{% /tab %}\n\n{% tab label=\"After\" %}\n\n```ts {% fileName=\"apps/app1-e2e/cypress.config.ts\" highlightLines=[\"17-19\"] %}\nimport { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';\nimport { defineConfig } from 'cypress';\n\nexport default defineConfig({\n e2e: {\n ...nxE2EPreset(__filename, {\n cypressDir: 'src',\n bundler: 'vite',\n webServerCommands: {\n default: 'pnpm exec nx run app1:dev',\n production: 'pnpm exec nx run app1:dev',\n },\n ciWebServerCommand: 'pnpm exec nx run app1:dev',\n ciBaseUrl: 'http://localhost:4200',\n }),\n baseUrl: 'http://localhost:4200',\n // Please ensure you use `cy.origin()` when navigating between domains and remove this option.\n // See https://docs.cypress.io/app/references/migration-guide#Changes-to-cyorigin\n injectDocumentDomain: true,\n },\n});\n```\n\n{% /tab %}\n\n{% /tabs %}\n"
14+
}

0 commit comments

Comments
 (0)