@nx/cypress 16.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +22 -0
  3. package/README.md +63 -0
  4. package/executors.json +16 -0
  5. package/generators.json +66 -0
  6. package/index.d.ts +5 -0
  7. package/index.js +14 -0
  8. package/index.js.map +1 -0
  9. package/migrations.json +53 -0
  10. package/package.json +59 -0
  11. package/plugins/cypress-preset.d.ts +62 -0
  12. package/plugins/cypress-preset.js +53 -0
  13. package/plugins/cypress-preset.js.map +1 -0
  14. package/src/executors/cypress/compat.d.ts +2 -0
  15. package/src/executors/cypress/compat.js +6 -0
  16. package/src/executors/cypress/compat.js.map +1 -0
  17. package/src/executors/cypress/cypress.impl.d.ts +40 -0
  18. package/src/executors/cypress/cypress.impl.js +372 -0
  19. package/src/executors/cypress/cypress.impl.js.map +1 -0
  20. package/src/executors/cypress/schema.json +158 -0
  21. package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.d.ts +4 -0
  22. package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.js +104 -0
  23. package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.js.map +1 -0
  24. package/src/generators/convert-tslint-to-eslint/schema.json +44 -0
  25. package/src/generators/cypress-component-project/cypress-component-project.d.ts +4 -0
  26. package/src/generators/cypress-component-project/cypress-component-project.js +127 -0
  27. package/src/generators/cypress-component-project/cypress-component-project.js.map +1 -0
  28. package/src/generators/cypress-component-project/files/cypress/fixtures/example.json +5 -0
  29. package/src/generators/cypress-component-project/files/cypress/support/commands.ts__ext__ +34 -0
  30. package/src/generators/cypress-component-project/files/cypress/support/component-index.html +13 -0
  31. package/src/generators/cypress-component-project/files/cypress/support/component.ts__ext__ +17 -0
  32. package/src/generators/cypress-component-project/files/cypress/tsconfig.cy.json +17 -0
  33. package/src/generators/cypress-component-project/files/cypress.config.ts__ext__ +3 -0
  34. package/src/generators/cypress-component-project/schema.d.ts +5 -0
  35. package/src/generators/cypress-component-project/schema.json +33 -0
  36. package/src/generators/cypress-e2e-configuration/cypress-e2e-configuration.d.ts +18 -0
  37. package/src/generators/cypress-e2e-configuration/cypress-e2e-configuration.js +133 -0
  38. package/src/generators/cypress-e2e-configuration/cypress-e2e-configuration.js.map +1 -0
  39. package/src/generators/cypress-e2e-configuration/files/v10/__dir__/e2e/app.cy.ts__tmpl__ +13 -0
  40. package/src/generators/cypress-e2e-configuration/files/v10/__dir__/fixtures/example.json__tmpl__ +4 -0
  41. package/src/generators/cypress-e2e-configuration/files/v10/__dir__/support/app.po.ts__tmpl__ +1 -0
  42. package/src/generators/cypress-e2e-configuration/files/v10/__dir__/support/commands.ts__tmpl__ +33 -0
  43. package/src/generators/cypress-e2e-configuration/files/v10/__dir__/support/e2e.ts__tmpl__ +17 -0
  44. package/src/generators/cypress-e2e-configuration/files/v10/cypress.config.ts__tmpl__ +9 -0
  45. package/src/generators/cypress-e2e-configuration/files/v10/tsconfig__tsFileExt__ +10 -0
  46. package/src/generators/cypress-e2e-configuration/files/v9/__dir__/fixtures/example.json__tmpl__ +4 -0
  47. package/src/generators/cypress-e2e-configuration/files/v9/__dir__/integration/app.spec.ts__tmpl__ +13 -0
  48. package/src/generators/cypress-e2e-configuration/files/v9/__dir__/plugins/index.js +22 -0
  49. package/src/generators/cypress-e2e-configuration/files/v9/__dir__/support/app.po.ts__tmpl__ +1 -0
  50. package/src/generators/cypress-e2e-configuration/files/v9/__dir__/support/commands.ts__tmpl__ +33 -0
  51. package/src/generators/cypress-e2e-configuration/files/v9/__dir__/support/index.ts__tmpl__ +17 -0
  52. package/src/generators/cypress-e2e-configuration/files/v9/cypress.json +12 -0
  53. package/src/generators/cypress-e2e-configuration/files/v9/tsconfig__tsFileExt__ +10 -0
  54. package/src/generators/cypress-e2e-configuration/schema.json +91 -0
  55. package/src/generators/cypress-project/cypress-project.d.ts +13 -0
  56. package/src/generators/cypress-project/cypress-project.js +172 -0
  57. package/src/generators/cypress-project/cypress-project.js.map +1 -0
  58. package/src/generators/cypress-project/files/v10-and-after/cypress.config.ts__tmpl__ +10 -0
  59. package/src/generators/cypress-project/files/v10-and-after/src/e2e/app.cy.ts__tmpl__ +13 -0
  60. package/src/generators/cypress-project/files/v10-and-after/src/fixtures/example.json__tmpl__ +4 -0
  61. package/src/generators/cypress-project/files/v10-and-after/src/support/app.po.ts__tmpl__ +1 -0
  62. package/src/generators/cypress-project/files/v10-and-after/src/support/commands.ts__tmpl__ +33 -0
  63. package/src/generators/cypress-project/files/v10-and-after/src/support/e2e.ts__tmpl__ +17 -0
  64. package/src/generators/cypress-project/files/v10-and-after/tsconfig.json +10 -0
  65. package/src/generators/cypress-project/files/v9-and-under/cypress.json +12 -0
  66. package/src/generators/cypress-project/files/v9-and-under/src/fixtures/example.json__tmpl__ +4 -0
  67. package/src/generators/cypress-project/files/v9-and-under/src/integration/app.spec.ts__tmpl__ +13 -0
  68. package/src/generators/cypress-project/files/v9-and-under/src/plugins/index.js +22 -0
  69. package/src/generators/cypress-project/files/v9-and-under/src/support/app.po.ts__tmpl__ +1 -0
  70. package/src/generators/cypress-project/files/v9-and-under/src/support/commands.ts__tmpl__ +33 -0
  71. package/src/generators/cypress-project/files/v9-and-under/src/support/index.ts__tmpl__ +17 -0
  72. package/src/generators/cypress-project/files/v9-and-under/tsconfig.json +10 -0
  73. package/src/generators/cypress-project/schema.d.ts +15 -0
  74. package/src/generators/cypress-project/schema.json +79 -0
  75. package/src/generators/init/init.d.ts +5 -0
  76. package/src/generators/init/init.js +47 -0
  77. package/src/generators/init/init.js.map +1 -0
  78. package/src/generators/init/schema.d.ts +5 -0
  79. package/src/generators/init/schema.json +16 -0
  80. package/src/generators/migrate-to-cypress-11/conversion.util.d.ts +34 -0
  81. package/src/generators/migrate-to-cypress-11/conversion.util.js +241 -0
  82. package/src/generators/migrate-to-cypress-11/conversion.util.js.map +1 -0
  83. package/src/generators/migrate-to-cypress-11/migrate-to-cypress-11.d.ts +3 -0
  84. package/src/generators/migrate-to-cypress-11/migrate-to-cypress-11.js +85 -0
  85. package/src/generators/migrate-to-cypress-11/migrate-to-cypress-11.js.map +1 -0
  86. package/src/generators/migrate-to-cypress-11/schema.json +15 -0
  87. package/src/migrations/update-12-8-0/remove-typescript-plugin.d.ts +2 -0
  88. package/src/migrations/update-12-8-0/remove-typescript-plugin.js +89 -0
  89. package/src/migrations/update-12-8-0/remove-typescript-plugin.js.map +1 -0
  90. package/src/migrations/update-14-6-1/update-cypress-configs-presets.d.ts +3 -0
  91. package/src/migrations/update-14-6-1/update-cypress-configs-presets.js +111 -0
  92. package/src/migrations/update-14-6-1/update-cypress-configs-presets.js.map +1 -0
  93. package/src/migrations/update-14-7-0/update-cypress-version-if-10.d.ts +3 -0
  94. package/src/migrations/update-14-7-0/update-cypress-version-if-10.js +33 -0
  95. package/src/migrations/update-14-7-0/update-cypress-version-if-10.js.map +1 -0
  96. package/src/migrations/update-15-0-0/add-cypress-inputs.d.ts +2 -0
  97. package/src/migrations/update-15-0-0/add-cypress-inputs.js +48 -0
  98. package/src/migrations/update-15-0-0/add-cypress-inputs.js.map +1 -0
  99. package/src/migrations/update-15-0-0/update-cy-mount-usage.d.ts +5 -0
  100. package/src/migrations/update-15-0-0/update-cy-mount-usage.js +124 -0
  101. package/src/migrations/update-15-0-0/update-cy-mount-usage.js.map +1 -0
  102. package/src/migrations/update-15-1-0/cypress-11.d.ts +6 -0
  103. package/src/migrations/update-15-1-0/cypress-11.js +118 -0
  104. package/src/migrations/update-15-1-0/cypress-11.js.map +1 -0
  105. package/src/migrations/update-15-5-0/helpers.d.ts +3 -0
  106. package/src/migrations/update-15-5-0/helpers.js +40 -0
  107. package/src/migrations/update-15-5-0/helpers.js.map +1 -0
  108. package/src/migrations/update-15-5-0/update-to-cypress-12.d.ts +24 -0
  109. package/src/migrations/update-15-5-0/update-to-cypress-12.js +183 -0
  110. package/src/migrations/update-15-5-0/update-to-cypress-12.js.map +1 -0
  111. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  112. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
  113. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
  114. package/src/plugins/preprocessor-vite.d.ts +32 -0
  115. package/src/plugins/preprocessor-vite.js +96 -0
  116. package/src/plugins/preprocessor-vite.js.map +1 -0
  117. package/src/utils/add-linter.d.ts +21 -0
  118. package/src/utils/add-linter.js +90 -0
  119. package/src/utils/add-linter.js.map +1 -0
  120. package/src/utils/ct-helpers.d.ts +16 -0
  121. package/src/utils/ct-helpers.js +86 -0
  122. package/src/utils/ct-helpers.js.map +1 -0
  123. package/src/utils/cypress-version.d.ts +5 -0
  124. package/src/utils/cypress-version.js +34 -0
  125. package/src/utils/cypress-version.js.map +1 -0
  126. package/src/utils/find-target-options.d.ts +16 -0
  127. package/src/utils/find-target-options.js +115 -0
  128. package/src/utils/find-target-options.js.map +1 -0
  129. package/src/utils/project-name.d.ts +3 -0
  130. package/src/utils/project-name.js +20 -0
  131. package/src/utils/project-name.js.map +1 -0
  132. package/src/utils/versions.d.ts +9 -0
  133. package/src/utils/versions.js +13 -0
  134. package/src/utils/versions.js.map +1 -0
@@ -0,0 +1,44 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "cypress-convert-tslint-to-eslint",
4
+ "cli": "nx",
5
+ "title": "Convert a Cypress project from TSLint to ESLint",
6
+ "description": "Convert a Cypress project from TSLint to ESLint.\n_NOTE: Does not work in `--dry-run` mode_.",
7
+ "examples": [
8
+ {
9
+ "command": "nx g convert-tslint-to-eslint myapp",
10
+ "description": "Convert the Cypress project `myapp` from TSLint to ESLint."
11
+ }
12
+ ],
13
+ "type": "object",
14
+ "properties": {
15
+ "project": {
16
+ "description": "The name of the Cypress project to convert.",
17
+ "type": "string",
18
+ "$default": {
19
+ "$source": "argv",
20
+ "index": 0
21
+ },
22
+ "x-prompt": "Which Cypress project would you like to convert from TSLint to ESLint?"
23
+ },
24
+ "ignoreExistingTslintConfig": {
25
+ "type": "boolean",
26
+ "description": "If true we will not use existing TSLint config as a reference, we will just reset the project with the latest recommended ESLint config.",
27
+ "default": false,
28
+ "x-prompt": "Would you like to ignore the existing TSLint config? Recommended if the TSLint config has not been altered much as it makes the new ESLint config cleaner."
29
+ },
30
+ "removeTSLintIfNoMoreTSLintTargets": {
31
+ "type": "boolean",
32
+ "description": "If this conversion leaves no more TSLint usage in the workspace, it will remove TSLint and related dependencies and configuration.",
33
+ "default": true,
34
+ "x-prompt": "Would you like to remove TSLint and its related config if there are no TSLint projects remaining after this conversion?"
35
+ },
36
+ "skipFormat": {
37
+ "type": "boolean",
38
+ "description": "Skip formatting files.",
39
+ "default": false,
40
+ "x-priority": "internal"
41
+ }
42
+ },
43
+ "required": ["project"]
44
+ }
@@ -0,0 +1,4 @@
1
+ import { ProjectConfiguration, Tree } from '@nx/devkit';
2
+ import { CypressComponentProjectSchema } from './schema';
3
+ export declare function cypressComponentProject(tree: Tree, options: CypressComponentProjectSchema): Promise<() => void>;
4
+ export declare function updateTsConfigForComponentTesting(tree: Tree, projectConfig: ProjectConfiguration): void;
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateTsConfigForComponentTesting = exports.cypressComponentProject = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const cypress_version_1 = require("../../utils/cypress-version");
7
+ const versions_1 = require("../../utils/versions");
8
+ function cypressComponentProject(tree, options) {
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ const cyVersion = (0, cypress_version_1.installedCypressVersion)();
11
+ if (cyVersion && cyVersion < 10) {
12
+ throw new Error('Cypress version of 10 or higher is required to use component testing. See the migration guide to upgrade. https://nx.dev/cypress/v10-migration-guide');
13
+ }
14
+ const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
15
+ const installDepsTask = updateDeps(tree, options);
16
+ addProjectFiles(tree, projectConfig, options);
17
+ addTargetToProject(tree, projectConfig, options);
18
+ updateNxJsonConfiguration(tree);
19
+ updateTsConfigForComponentTesting(tree, projectConfig);
20
+ if (!options.skipFormat) {
21
+ yield (0, devkit_1.formatFiles)(tree);
22
+ }
23
+ return () => {
24
+ installDepsTask();
25
+ };
26
+ });
27
+ }
28
+ exports.cypressComponentProject = cypressComponentProject;
29
+ function updateDeps(tree, options) {
30
+ const devDeps = {
31
+ cypress: versions_1.cypressVersion,
32
+ };
33
+ if (options.bundler === 'vite') {
34
+ devDeps['@cypress/vite-dev-server'] = versions_1.cypressViteDevServerVersion;
35
+ }
36
+ else {
37
+ devDeps['@cypress/webpack-dev-server'] = versions_1.cypressWebpackVersion;
38
+ devDeps['html-webpack-plugin'] = versions_1.htmlWebpackPluginVersion;
39
+ }
40
+ return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDeps);
41
+ }
42
+ function addProjectFiles(tree, projectConfig, options) {
43
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), projectConfig.root, Object.assign(Object.assign({}, options), { projectRoot: projectConfig.root, offsetFromRoot: (0, devkit_1.offsetFromRoot)(projectConfig.root), ext: '' }));
44
+ }
45
+ function addTargetToProject(tree, projectConfig, options) {
46
+ projectConfig.targets['component-test'] = {
47
+ executor: '@nrwl/cypress:cypress',
48
+ options: {
49
+ cypressConfig: (0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress.config.ts'),
50
+ testingType: 'component',
51
+ },
52
+ };
53
+ (0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
54
+ }
55
+ function updateNxJsonConfiguration(tree) {
56
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
57
+ var _m, _o;
58
+ const nxJson = (0, devkit_1.readNxJson)(tree);
59
+ nxJson.tasksRunnerOptions = Object.assign(Object.assign({}, nxJson === null || nxJson === void 0 ? void 0 : nxJson.tasksRunnerOptions), { default: Object.assign(Object.assign({}, (_a = nxJson === null || nxJson === void 0 ? void 0 : nxJson.tasksRunnerOptions) === null || _a === void 0 ? void 0 : _a.default), { options: Object.assign(Object.assign({}, (_c = (_b = nxJson === null || nxJson === void 0 ? void 0 : nxJson.tasksRunnerOptions) === null || _b === void 0 ? void 0 : _b.default) === null || _c === void 0 ? void 0 : _c.options), { cacheableOperations: Array.from(new Set([
60
+ ...((_g = (_f = (_e = (_d = nxJson === null || nxJson === void 0 ? void 0 : nxJson.tasksRunnerOptions) === null || _d === void 0 ? void 0 : _d.default) === null || _e === void 0 ? void 0 : _e.options) === null || _f === void 0 ? void 0 : _f.cacheableOperations) !== null && _g !== void 0 ? _g : []),
61
+ 'component-test',
62
+ ])) }) }) });
63
+ if (nxJson.namedInputs) {
64
+ (_h = nxJson.targetDefaults) !== null && _h !== void 0 ? _h : (nxJson.targetDefaults = {});
65
+ const productionFileSet = (_j = nxJson.namedInputs) === null || _j === void 0 ? void 0 : _j.production;
66
+ if (productionFileSet) {
67
+ nxJson.namedInputs.production = Array.from(new Set([
68
+ ...productionFileSet,
69
+ '!{projectRoot}/cypress/**/*',
70
+ '!{projectRoot}/**/*.cy.[jt]s?(x)',
71
+ '!{projectRoot}/cypress.config.[jt]s',
72
+ ]));
73
+ }
74
+ (_k = (_m = nxJson.targetDefaults)['component-test']) !== null && _k !== void 0 ? _k : (_m['component-test'] = {});
75
+ (_l = (_o = nxJson.targetDefaults['component-test']).inputs) !== null && _l !== void 0 ? _l : (_o.inputs = [
76
+ 'default',
77
+ productionFileSet ? '^production' : '^default',
78
+ ]);
79
+ }
80
+ (0, devkit_1.updateNxJson)(tree, nxJson);
81
+ }
82
+ function updateTsConfigForComponentTesting(tree, projectConfig) {
83
+ const tsConfigPath = (0, devkit_1.joinPathFragments)(projectConfig.root, projectConfig.projectType === 'library'
84
+ ? 'tsconfig.lib.json'
85
+ : 'tsconfig.app.json');
86
+ if (tree.exists(tsConfigPath)) {
87
+ (0, devkit_1.updateJson)(tree, tsConfigPath, (json) => {
88
+ const excluded = new Set([
89
+ ...(json.exclude || []),
90
+ 'cypress/**/*',
91
+ 'cypress.config.ts',
92
+ '**/*.cy.ts',
93
+ '**/*.cy.js',
94
+ '**/*.cy.tsx',
95
+ '**/*.cy.jsx',
96
+ ]);
97
+ json.exclude = Array.from(excluded);
98
+ return json;
99
+ });
100
+ }
101
+ const projectBaseTsConfig = (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.json');
102
+ if (tree.exists(projectBaseTsConfig)) {
103
+ (0, devkit_1.updateJson)(tree, projectBaseTsConfig, (json) => {
104
+ if (json.references) {
105
+ const hasCyTsConfig = json.references.some((r) => r.path === './cypress/tsconfig.cy.json');
106
+ if (!hasCyTsConfig) {
107
+ json.references.push({ path: './cypress/tsconfig.cy.json' });
108
+ }
109
+ }
110
+ else {
111
+ const excluded = new Set([
112
+ ...(json.exclude || []),
113
+ 'cypress/**/*',
114
+ 'cypress.config.ts',
115
+ '**/*.cy.ts',
116
+ '**/*.cy.js',
117
+ '**/*.cy.tsx',
118
+ '**/*.cy.jsx',
119
+ ]);
120
+ json.exclude = Array.from(excluded);
121
+ }
122
+ return json;
123
+ });
124
+ }
125
+ }
126
+ exports.updateTsConfigForComponentTesting = updateTsConfigForComponentTesting;
127
+ //# sourceMappingURL=cypress-component-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cypress-component-project.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/generators/cypress-component-project/cypress-component-project.ts"],"names":[],"mappings":";;;;AAAA,uCAaoB;AACpB,iEAAsE;AAEtE,mDAK8B;AAG9B,SAAsB,uBAAuB,CAC3C,IAAU,EACV,OAAsC;;QAEtC,MAAM,SAAS,GAAG,IAAA,yCAAuB,GAAE,CAAC;QAC5C,IAAI,SAAS,IAAI,SAAS,GAAG,EAAE,EAAE;YAC/B,MAAM,IAAI,KAAK,CAC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mB,GAAG,IAAA,0BAAiB,EAC3C,aAAa,CAAC,IAAI,EAClB,eAAe,CAChB,CAAC;IACF,IAAI,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE;QACpC,IAAA,mBAAU,EAAC,IAAI,EAAE,mBAAmB,EAAE,CAAC,IAAI,EAAE,EAAE;YAC7C,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CACxC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,4BAA4B,CAC/C,CAAC;gBACF,IAAI,CAAC,aAAa,EAAE;oBAClB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,4BAA4B,EAAE,CAAC,CAAC;iBAC9D;aACF;iBAAM;gBACL,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;oBACvB,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;oBACvB,cAAc;oBACd,mBAAmB;oBACnB,YAAY;oBACZ,YAAY;oBACZ,aAAa;oBACb,aAAa;iBACd,CAAC,CAAC;gBAEH,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aACrC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;KACJ;AACH,CAAC;AAxDD,8EAwDC"}
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "Using fixtures to represent data",
3
+ "email": "hello@cypress.io",
4
+ "body": "Fixtures are a great way to mock data for responses to routes"
5
+ }
@@ -0,0 +1,34 @@
1
+ /// <reference types="cypress" />
2
+ // ***********************************************
3
+ // This example commands.ts shows you how to
4
+ // create various custom commands and overwrite
5
+ // existing commands.
6
+ //
7
+ // For more comprehensive examples of custom
8
+ // commands please read more here:
9
+ // https://on.cypress.io/custom-commands
10
+ // ***********************************************
11
+
12
+ // eslint-disable-next-line @typescript-eslint/no-namespace
13
+ declare namespace Cypress {
14
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
+ interface Chainable<Subject> {
16
+ login(email: string, password: string): void;
17
+ }
18
+ }
19
+ //
20
+ // -- This is a parent command --
21
+ Cypress.Commands.add('login', (email, password) => {
22
+ console.log('Custom command example: Login', email, password);
23
+ });
24
+ //
25
+ // -- This is a child command --
26
+ // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
27
+ //
28
+ //
29
+ // -- This is a dual command --
30
+ // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
31
+ //
32
+ //
33
+ // -- This will overwrite an existing command --
34
+ // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
+ <title><%= project %> Components App</title>
8
+
9
+ </head>
10
+ <body>
11
+ <div data-cy-root></div>
12
+ </body>
13
+ </html>
@@ -0,0 +1,17 @@
1
+ // ***********************************************************
2
+ // This example support/component.ts is processed and
3
+ // loaded automatically before your test files.
4
+ //
5
+ // This is a great place to put global configuration and
6
+ // behavior that modifies Cypress.
7
+ //
8
+ // You can change the location of this file or turn off
9
+ // automatically serving support files with the
10
+ // 'supportFile' configuration option.
11
+ //
12
+ // You can read more here:
13
+ // https://on.cypress.io/configuration
14
+ // ***********************************************************
15
+
16
+ // Import commands.ts using ES2015 syntax:
17
+ import './commands';
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "<%= offsetFromRoot %>../dist/out-tsc",
5
+ "module": "commonjs",
6
+ "types": ["cypress", "node"]
7
+ },
8
+ "include": [
9
+ "support/**/*.ts",
10
+ "../cypress.config.ts",
11
+ "../**/*.cy.ts",
12
+ "../**/*.cy.tsx",
13
+ "../**/*.cy.js",
14
+ "../**/*.cy.jsx",
15
+ "../**/*.d.ts"
16
+ ]
17
+ }
@@ -0,0 +1,3 @@
1
+ import { defineConfig } from 'cypress';
2
+
3
+ export default defineConfig({});
@@ -0,0 +1,5 @@
1
+ export interface CypressComponentProjectSchema {
2
+ project: string;
3
+ skipFormat: boolean;
4
+ bundler?: 'webpack' | 'vite';
5
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "NxCypressComponentProject",
4
+ "cli": "nx",
5
+ "title": "Set up Cypress component testing for a project",
6
+ "description": "Set up Cypress component test for a project.",
7
+ "type": "object",
8
+ "examples": [
9
+ {
10
+ "command": "nx g @nrwl/cypress:cypress-component-project --project=my-cool-lib ",
11
+ "description": "Add cypress component testing to an existing project named my-cool-lib"
12
+ }
13
+ ],
14
+ "properties": {
15
+ "project": {
16
+ "type": "string",
17
+ "description": "The name of the project to add cypress component testing to",
18
+ "$default": {
19
+ "$source": "projectName"
20
+ },
21
+ "x-prompt": "What project should we add Cypress component testing to?"
22
+ },
23
+ "bundler": {
24
+ "description": "The Cypress bundler to use.",
25
+ "type": "string",
26
+ "enum": ["vite", "webpack"],
27
+ "x-prompt": "Which Cypress bundler do you want to use for the dev-server?",
28
+ "default": "webpack"
29
+ }
30
+ },
31
+ "required": ["project"],
32
+ "examplesFile": "../../../docs/cypress-component-project-examples.md"
33
+ }
@@ -0,0 +1,18 @@
1
+ import { GeneratorCallback, Tree } from '@nx/devkit';
2
+ import { Linter } from '@nx/linter';
3
+ export interface CypressE2EConfigSchema {
4
+ project: string;
5
+ baseUrl?: string;
6
+ directory?: string;
7
+ js?: boolean;
8
+ skipFormat?: boolean;
9
+ setParserOptionsProject?: boolean;
10
+ skipPackageJson?: boolean;
11
+ bundler?: 'webpack' | 'vite' | 'none';
12
+ devServerTarget?: string;
13
+ linter?: Linter;
14
+ port?: number | 'cypress-auto';
15
+ }
16
+ export declare function cypressE2EConfigurationGenerator(tree: Tree, options: CypressE2EConfigSchema): Promise<GeneratorCallback>;
17
+ export default cypressE2EConfigurationGenerator;
18
+ export declare const compat: (generatorOptions: CypressE2EConfigSchema) => (tree: any, context: any) => Promise<any>;
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.compat = exports.cypressE2EConfigurationGenerator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const js_1 = require("@nx/js");
7
+ const linter_1 = require("@nx/linter");
8
+ const path_1 = require("path");
9
+ const add_linter_1 = require("../../utils/add-linter");
10
+ const cypress_version_1 = require("../../utils/cypress-version");
11
+ const versions_1 = require("../../utils/versions");
12
+ const init_1 = require("../init/init");
13
+ function cypressE2EConfigurationGenerator(tree, options) {
14
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
15
+ const opts = normalizeOptions(tree, options);
16
+ const tasks = [];
17
+ if (!(0, cypress_version_1.installedCypressVersion)()) {
18
+ tasks.push(yield (0, init_1.default)(tree, opts));
19
+ }
20
+ if (opts.bundler === 'vite') {
21
+ tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, { vite: versions_1.viteVersion }));
22
+ }
23
+ addFiles(tree, opts);
24
+ addTarget(tree, opts);
25
+ (0, add_linter_1.addLinterToCyProject)(tree, Object.assign(Object.assign({}, opts), { cypressDir: opts.directory }));
26
+ if (!opts.skipFormat) {
27
+ yield (0, devkit_1.formatFiles)(tree);
28
+ }
29
+ return (0, devkit_1.runTasksInSerial)(...tasks);
30
+ });
31
+ }
32
+ exports.cypressE2EConfigurationGenerator = cypressE2EConfigurationGenerator;
33
+ function normalizeOptions(tree, options) {
34
+ var _a, _b, _c, _d, _e;
35
+ const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
36
+ if ((_a = projectConfig === null || projectConfig === void 0 ? void 0 : projectConfig.targets) === null || _a === void 0 ? void 0 : _a.e2e) {
37
+ throw new Error(`Project ${options.project} already has an e2e target.
38
+ Rename or remove the existing e2e target.`);
39
+ }
40
+ if (!options.baseUrl &&
41
+ !options.devServerTarget &&
42
+ !projectConfig.targets.serve) {
43
+ throw new Error(`The project ${options.project} does not have a 'serve' target.
44
+ In this case you need to provide a devServerTarget,'<projectName>:<targetName>[:<configName>]', or a baseUrl option`);
45
+ }
46
+ (_b = options.directory) !== null && _b !== void 0 ? _b : (options.directory = 'src');
47
+ if (tree.exists((0, devkit_1.joinPathFragments)(projectConfig.root, options.directory))) {
48
+ throw new Error(`The project, ${options.project}, already has a '${options.directory}' directory.
49
+ This most likely means you already have Cypress setup in this project.
50
+ Make sure Cypress is not already setup in this project and try again.`);
51
+ }
52
+ const cyVersion = (0, cypress_version_1.installedCypressVersion)();
53
+ const cyFile = cyVersion && cyVersion < 10 ? 'cypress.json' : 'cypress.config.ts';
54
+ if (tree.exists((0, devkit_1.joinPathFragments)(projectConfig.root, cyFile))) {
55
+ throw new Error(`The project, ${options.project}, already has a '${cyFile}' file.
56
+ This means that Cypress is already setup in this project.
57
+ If you want to re-add Cypress to this project, remove the '${(0, devkit_1.joinPathFragments)(projectConfig.root, cyFile)}' file and try again.`);
58
+ }
59
+ return Object.assign(Object.assign({}, options), { bundler: (_c = options.bundler) !== null && _c !== void 0 ? _c : 'webpack', rootProject: projectConfig.root === '.', linter: (_d = options.linter) !== null && _d !== void 0 ? _d : linter_1.Linter.EsLint, devServerTarget: (_e = options.devServerTarget) !== null && _e !== void 0 ? _e : (projectConfig.targets.serve ? `${options.project}:serve` : undefined) });
60
+ }
61
+ function addFiles(tree, options) {
62
+ var _a;
63
+ const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
64
+ const cyVersion = (0, cypress_version_1.installedCypressVersion)();
65
+ const filesToUse = cyVersion && cyVersion < 10 ? 'v9' : 'v10';
66
+ const hasTsConfig = tree.exists((0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.json'));
67
+ (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files', filesToUse), projectConfig.root, Object.assign(Object.assign({}, options), { dir: (_a = options.directory) !== null && _a !== void 0 ? _a : 'src',
68
+ // create a tsconfig.cy.json if there is an existing tsconfig. aka being added to a new project
69
+ ext: options.js ? 'js' : 'ts', offsetFromRoot: (0, devkit_1.offsetFromRoot)(projectConfig.root), tsFileExt: hasTsConfig ? '.cy.json' : '.json', tsConfigPath: hasTsConfig
70
+ ? './tsconfig.json'
71
+ : (0, js_1.getRelativePathToRootTsConfig)(tree, projectConfig.root), tmpl: '' }));
72
+ if (hasTsConfig) {
73
+ (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.json'), (json) => {
74
+ json.references = json.references || [];
75
+ json.references.push({
76
+ path: './tsconfig.cy.json',
77
+ });
78
+ return json;
79
+ });
80
+ }
81
+ if (cyVersion && cyVersion < 7) {
82
+ (0, devkit_1.updateJson)(tree, (0, path_1.join)(projectConfig.root, 'cypress.json'), (json) => {
83
+ json.pluginsFile = './src/plugins/index';
84
+ return json;
85
+ });
86
+ }
87
+ else if (cyVersion < 10) {
88
+ const pluginPath = (0, path_1.join)(projectConfig.root, 'src/plugins/index.js');
89
+ if (tree.exists(pluginPath)) {
90
+ tree.delete(pluginPath);
91
+ }
92
+ }
93
+ if (options.js) {
94
+ (0, devkit_1.toJS)(tree);
95
+ }
96
+ }
97
+ function addTarget(tree, opts) {
98
+ var _a;
99
+ const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, opts.project);
100
+ const cyVersion = (0, cypress_version_1.installedCypressVersion)();
101
+ projectConfig.targets.e2e = {
102
+ executor: '@nrwl/cypress:cypress',
103
+ options: {
104
+ cypressConfig: (0, devkit_1.joinPathFragments)(projectConfig.root, cyVersion && cyVersion < 10 ? 'cypress.json' : 'cypress.config.ts'),
105
+ testingType: 'e2e',
106
+ },
107
+ };
108
+ if (opts.baseUrl) {
109
+ projectConfig.targets.e2e.options = Object.assign(Object.assign({}, projectConfig.targets.e2e.options), { baseUrl: opts.baseUrl });
110
+ }
111
+ else if (opts.devServerTarget) {
112
+ const parsedTarget = (0, devkit_1.parseTargetString)(opts.devServerTarget);
113
+ projectConfig.targets.e2e.options = Object.assign(Object.assign({}, projectConfig.targets.e2e.options), { devServerTarget: opts.devServerTarget, port: opts.port });
114
+ projectConfig.targets.e2e.configurations = {
115
+ [parsedTarget.configuration || 'production']: {
116
+ devServerTarget: `${opts.devServerTarget}${parsedTarget.configuration ? '' : ':production'}`,
117
+ },
118
+ };
119
+ const devServerProjectConfig = (0, devkit_1.readProjectConfiguration)(tree, parsedTarget.project);
120
+ if ((_a = devServerProjectConfig.targets) === null || _a === void 0 ? void 0 : _a['serve-static']) {
121
+ projectConfig.targets.e2e.configurations.ci = {
122
+ devServerTarget: `${parsedTarget.project}:serve-static`,
123
+ };
124
+ }
125
+ }
126
+ else {
127
+ throw new Error('Either baseUrl or devServerTarget must be provided');
128
+ }
129
+ (0, devkit_1.updateProjectConfiguration)(tree, opts.project, projectConfig);
130
+ }
131
+ exports.default = cypressE2EConfigurationGenerator;
132
+ exports.compat = (0, devkit_1.convertNxGenerator)(cypressE2EConfigurationGenerator);
133
+ //# sourceMappingURL=cypress-e2e-configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cypress-e2e-configuration.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/generators/cypress-e2e-configuration/cypress-e2e-configuration.ts"],"names":[],"mappings":";;;;AAAA,uCAeoB;AACpB,+BAAuD;AACvD,uCAAoC;AACpC,+BAA4B;AAC5B,uDAA8D;AAC9D,iEAAsE;AACtE,mDAAmD;AACnD,uCAAgD;AAiBhD,SAAsB,gCAAgC,CACpD,IAAU,EACV,OAA+B;;QAE/B,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7C,MAAM,KAAK,GAAwB,EAAE,CAAC;QACtC,IAAI,CAAC,IAAA,yCAAuB,GAAE,EAAE;YAC9B,KAAK,CAAC,I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OAAO,CAAC,GAAG,CAAC,OAAO,mCAC5B,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,KACpC,eAAe,EAAE,IAAI,CAAC,eAAe,EACrC,IAAI,EAAE,IAAI,CAAC,IAAI,GAChB,CAAC;QAEF,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG;YACzC,CAAC,YAAY,CAAC,aAAa,IAAI,YAAY,CAAC,EAAE;gBAC5C,eAAe,EAAE,GAAG,IAAI,CAAC,eAAe,GACtC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aACpC,EAAE;aACH;SACF,CAAC;QACF,MAAM,sBAAsB,GAAG,IAAA,iCAAwB,EACrD,IAAI,EACJ,YAAY,CAAC,OAAO,CACrB,CAAC;QACF,IAAI,MAAA,sBAAsB,CAAC,OAAO,0CAAG,cAAc,CAAC,EAAE;YACpD,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,GAAG;gBAC5C,eAAe,EAAE,GAAG,YAAY,CAAC,OAAO,eAAe;aACxD,CAAC;SACH;KACF;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;KACvE;IAED,IAAA,mCAA0B,EAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AAChE,CAAC;AAED,kBAAe,gCAAgC,CAAC;AACnC,QAAA,MAAM,GAAG,IAAA,2BAAkB,EAAC,gCAAgC,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { getGreeting } from '../support/app.po';
2
+
3
+ describe('<%= project %>', () => {
4
+ beforeEach(() => cy.visit('/'));
5
+
6
+ it('should display welcome message', () => {
7
+ // Custom command example, see `../support/commands.ts` file
8
+ cy.login('my-email@something.com', 'myPassword');
9
+
10
+ // Function helper example, see `../support/app.po.ts` file
11
+ getGreeting().contains(/Welcome/);
12
+ });
13
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "Using fixtures to represent data",
3
+ "email": "hello@cypress.io"
4
+ }
@@ -0,0 +1 @@
1
+ export const getGreeting = () => cy.get('h1');
@@ -0,0 +1,33 @@
1
+ // ***********************************************
2
+ // This example commands.js shows you how to
3
+ // create various custom commands and overwrite
4
+ // existing commands.
5
+ //
6
+ // For more comprehensive examples of custom
7
+ // commands please read more here:
8
+ // https://on.cypress.io/custom-commands
9
+ // ***********************************************
10
+ <% if (linter === 'eslint') { %>
11
+ // eslint-disable-next-line @typescript-eslint/no-namespace<% } %>
12
+ declare namespace Cypress {<% if (linter === 'eslint') { %>
13
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars<% } %>
14
+ interface Chainable<Subject> {
15
+ login(email: string, password: string): void;
16
+ }
17
+ }
18
+ //
19
+ // -- This is a parent command --
20
+ Cypress.Commands.add('login', (email, password) => {
21
+ console.log('Custom command example: Login', email, password);
22
+ });
23
+ //
24
+ // -- This is a child command --
25
+ // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
26
+ //
27
+ //
28
+ // -- This is a dual command --
29
+ // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
30
+ //
31
+ //
32
+ // -- This will overwrite an existing command --
33
+ // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
@@ -0,0 +1,17 @@
1
+ // ***********************************************************
2
+ // This example support/index.js is processed and
3
+ // loaded automatically before your test files.
4
+ //
5
+ // This is a great place to put global configuration and
6
+ // behavior that modifies Cypress.
7
+ //
8
+ // You can change the location of this file or turn off
9
+ // automatically serving support files with the
10
+ // 'supportFile' configuration option.
11
+ //
12
+ // You can read more here:
13
+ // https://on.cypress.io/configuration
14
+ // ***********************************************************
15
+
16
+ // Import commands.js using ES2015 syntax:
17
+ import './commands';
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from 'cypress';
2
+ import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
3
+
4
+ export default defineConfig({
5
+ e2e: nxE2EPreset(__dirname, {
6
+ cypressDir: "<%= dir %>",
7
+ <% if (bundler === 'vite'){ %>bundler: 'vite',<% } %>
8
+ })
9
+ });
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "<%= tsConfigPath %>",
3
+ "compilerOptions": {
4
+ "sourceMap": false,
5
+ "outDir": "<%= offsetFromRoot %>dist/out-tsc",
6
+ "allowJs": true,
7
+ "types": ["cypress", "node"]
8
+ },
9
+ "include": ["<%= dir %>/**/*.ts", "<%= dir %>/**/*.js", "cypress.config.ts"]
10
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "Using fixtures to represent data",
3
+ "email": "hello@cypress.io"
4
+ }
@@ -0,0 +1,13 @@
1
+ import { getGreeting } from '../support/app.po';
2
+
3
+ describe('<%= project %>', () => {
4
+ beforeEach(() => cy.visit('/'));
5
+
6
+ it('should display welcome message', () => {
7
+ // Custom command example, see `../support/commands.ts` file
8
+ cy.login('my-email@something.com', 'myPassword');
9
+
10
+ // Function helper example, see `../support/app.po.ts` file
11
+ getGreeting().contains(/Welcome/);
12
+ });
13
+ });
@@ -0,0 +1,22 @@
1
+ // ***********************************************************
2
+ // This example plugins/index.js can be used to load plugins
3
+ //
4
+ // You can change the location of this file or turn off loading
5
+ // the plugins file with the 'pluginsFile' configuration option.
6
+ //
7
+ // You can read more here:
8
+ // https://on.cypress.io/plugins-guide
9
+ // ***********************************************************
10
+
11
+ // This function is called when a project is opened or re-opened (e.g. due to
12
+ // the project's config changing)
13
+
14
+ const { preprocessTypescript } = require('@nx/cypress/plugins/preprocessor');
15
+
16
+ module.exports = (on, config) => {
17
+ // `on` is used to hook into various events Cypress emits
18
+ // `config` is the resolved Cypress config
19
+
20
+ // Preprocess Typescript file using Nx helper
21
+ on('file:preprocessor', preprocessTypescript(config));
22
+ };
@@ -0,0 +1 @@
1
+ export const getGreeting = () => cy.get('h1');