@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.
- package/CHANGELOG.md +8 -0
- package/LICENSE +22 -0
- package/README.md +63 -0
- package/executors.json +16 -0
- package/generators.json +66 -0
- package/index.d.ts +5 -0
- package/index.js +14 -0
- package/index.js.map +1 -0
- package/migrations.json +53 -0
- package/package.json +59 -0
- package/plugins/cypress-preset.d.ts +62 -0
- package/plugins/cypress-preset.js +53 -0
- package/plugins/cypress-preset.js.map +1 -0
- package/src/executors/cypress/compat.d.ts +2 -0
- package/src/executors/cypress/compat.js +6 -0
- package/src/executors/cypress/compat.js.map +1 -0
- package/src/executors/cypress/cypress.impl.d.ts +40 -0
- package/src/executors/cypress/cypress.impl.js +372 -0
- package/src/executors/cypress/cypress.impl.js.map +1 -0
- package/src/executors/cypress/schema.json +158 -0
- package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.d.ts +4 -0
- package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.js +104 -0
- package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.js.map +1 -0
- package/src/generators/convert-tslint-to-eslint/schema.json +44 -0
- package/src/generators/cypress-component-project/cypress-component-project.d.ts +4 -0
- package/src/generators/cypress-component-project/cypress-component-project.js +127 -0
- package/src/generators/cypress-component-project/cypress-component-project.js.map +1 -0
- package/src/generators/cypress-component-project/files/cypress/fixtures/example.json +5 -0
- package/src/generators/cypress-component-project/files/cypress/support/commands.ts__ext__ +34 -0
- package/src/generators/cypress-component-project/files/cypress/support/component-index.html +13 -0
- package/src/generators/cypress-component-project/files/cypress/support/component.ts__ext__ +17 -0
- package/src/generators/cypress-component-project/files/cypress/tsconfig.cy.json +17 -0
- package/src/generators/cypress-component-project/files/cypress.config.ts__ext__ +3 -0
- package/src/generators/cypress-component-project/schema.d.ts +5 -0
- package/src/generators/cypress-component-project/schema.json +33 -0
- package/src/generators/cypress-e2e-configuration/cypress-e2e-configuration.d.ts +18 -0
- package/src/generators/cypress-e2e-configuration/cypress-e2e-configuration.js +133 -0
- package/src/generators/cypress-e2e-configuration/cypress-e2e-configuration.js.map +1 -0
- package/src/generators/cypress-e2e-configuration/files/v10/__dir__/e2e/app.cy.ts__tmpl__ +13 -0
- package/src/generators/cypress-e2e-configuration/files/v10/__dir__/fixtures/example.json__tmpl__ +4 -0
- package/src/generators/cypress-e2e-configuration/files/v10/__dir__/support/app.po.ts__tmpl__ +1 -0
- package/src/generators/cypress-e2e-configuration/files/v10/__dir__/support/commands.ts__tmpl__ +33 -0
- package/src/generators/cypress-e2e-configuration/files/v10/__dir__/support/e2e.ts__tmpl__ +17 -0
- package/src/generators/cypress-e2e-configuration/files/v10/cypress.config.ts__tmpl__ +9 -0
- package/src/generators/cypress-e2e-configuration/files/v10/tsconfig__tsFileExt__ +10 -0
- package/src/generators/cypress-e2e-configuration/files/v9/__dir__/fixtures/example.json__tmpl__ +4 -0
- package/src/generators/cypress-e2e-configuration/files/v9/__dir__/integration/app.spec.ts__tmpl__ +13 -0
- package/src/generators/cypress-e2e-configuration/files/v9/__dir__/plugins/index.js +22 -0
- package/src/generators/cypress-e2e-configuration/files/v9/__dir__/support/app.po.ts__tmpl__ +1 -0
- package/src/generators/cypress-e2e-configuration/files/v9/__dir__/support/commands.ts__tmpl__ +33 -0
- package/src/generators/cypress-e2e-configuration/files/v9/__dir__/support/index.ts__tmpl__ +17 -0
- package/src/generators/cypress-e2e-configuration/files/v9/cypress.json +12 -0
- package/src/generators/cypress-e2e-configuration/files/v9/tsconfig__tsFileExt__ +10 -0
- package/src/generators/cypress-e2e-configuration/schema.json +91 -0
- package/src/generators/cypress-project/cypress-project.d.ts +13 -0
- package/src/generators/cypress-project/cypress-project.js +172 -0
- package/src/generators/cypress-project/cypress-project.js.map +1 -0
- package/src/generators/cypress-project/files/v10-and-after/cypress.config.ts__tmpl__ +10 -0
- package/src/generators/cypress-project/files/v10-and-after/src/e2e/app.cy.ts__tmpl__ +13 -0
- package/src/generators/cypress-project/files/v10-and-after/src/fixtures/example.json__tmpl__ +4 -0
- package/src/generators/cypress-project/files/v10-and-after/src/support/app.po.ts__tmpl__ +1 -0
- package/src/generators/cypress-project/files/v10-and-after/src/support/commands.ts__tmpl__ +33 -0
- package/src/generators/cypress-project/files/v10-and-after/src/support/e2e.ts__tmpl__ +17 -0
- package/src/generators/cypress-project/files/v10-and-after/tsconfig.json +10 -0
- package/src/generators/cypress-project/files/v9-and-under/cypress.json +12 -0
- package/src/generators/cypress-project/files/v9-and-under/src/fixtures/example.json__tmpl__ +4 -0
- package/src/generators/cypress-project/files/v9-and-under/src/integration/app.spec.ts__tmpl__ +13 -0
- package/src/generators/cypress-project/files/v9-and-under/src/plugins/index.js +22 -0
- package/src/generators/cypress-project/files/v9-and-under/src/support/app.po.ts__tmpl__ +1 -0
- package/src/generators/cypress-project/files/v9-and-under/src/support/commands.ts__tmpl__ +33 -0
- package/src/generators/cypress-project/files/v9-and-under/src/support/index.ts__tmpl__ +17 -0
- package/src/generators/cypress-project/files/v9-and-under/tsconfig.json +10 -0
- package/src/generators/cypress-project/schema.d.ts +15 -0
- package/src/generators/cypress-project/schema.json +79 -0
- package/src/generators/init/init.d.ts +5 -0
- package/src/generators/init/init.js +47 -0
- package/src/generators/init/init.js.map +1 -0
- package/src/generators/init/schema.d.ts +5 -0
- package/src/generators/init/schema.json +16 -0
- package/src/generators/migrate-to-cypress-11/conversion.util.d.ts +34 -0
- package/src/generators/migrate-to-cypress-11/conversion.util.js +241 -0
- package/src/generators/migrate-to-cypress-11/conversion.util.js.map +1 -0
- package/src/generators/migrate-to-cypress-11/migrate-to-cypress-11.d.ts +3 -0
- package/src/generators/migrate-to-cypress-11/migrate-to-cypress-11.js +85 -0
- package/src/generators/migrate-to-cypress-11/migrate-to-cypress-11.js.map +1 -0
- package/src/generators/migrate-to-cypress-11/schema.json +15 -0
- package/src/migrations/update-12-8-0/remove-typescript-plugin.d.ts +2 -0
- package/src/migrations/update-12-8-0/remove-typescript-plugin.js +89 -0
- package/src/migrations/update-12-8-0/remove-typescript-plugin.js.map +1 -0
- package/src/migrations/update-14-6-1/update-cypress-configs-presets.d.ts +3 -0
- package/src/migrations/update-14-6-1/update-cypress-configs-presets.js +111 -0
- package/src/migrations/update-14-6-1/update-cypress-configs-presets.js.map +1 -0
- package/src/migrations/update-14-7-0/update-cypress-version-if-10.d.ts +3 -0
- package/src/migrations/update-14-7-0/update-cypress-version-if-10.js +33 -0
- package/src/migrations/update-14-7-0/update-cypress-version-if-10.js.map +1 -0
- package/src/migrations/update-15-0-0/add-cypress-inputs.d.ts +2 -0
- package/src/migrations/update-15-0-0/add-cypress-inputs.js +48 -0
- package/src/migrations/update-15-0-0/add-cypress-inputs.js.map +1 -0
- package/src/migrations/update-15-0-0/update-cy-mount-usage.d.ts +5 -0
- package/src/migrations/update-15-0-0/update-cy-mount-usage.js +124 -0
- package/src/migrations/update-15-0-0/update-cy-mount-usage.js.map +1 -0
- package/src/migrations/update-15-1-0/cypress-11.d.ts +6 -0
- package/src/migrations/update-15-1-0/cypress-11.js +118 -0
- package/src/migrations/update-15-1-0/cypress-11.js.map +1 -0
- package/src/migrations/update-15-5-0/helpers.d.ts +3 -0
- package/src/migrations/update-15-5-0/helpers.js +40 -0
- package/src/migrations/update-15-5-0/helpers.js.map +1 -0
- package/src/migrations/update-15-5-0/update-to-cypress-12.d.ts +24 -0
- package/src/migrations/update-15-5-0/update-to-cypress-12.js +183 -0
- package/src/migrations/update-15-5-0/update-to-cypress-12.js.map +1 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
- package/src/plugins/preprocessor-vite.d.ts +32 -0
- package/src/plugins/preprocessor-vite.js +96 -0
- package/src/plugins/preprocessor-vite.js.map +1 -0
- package/src/utils/add-linter.d.ts +21 -0
- package/src/utils/add-linter.js +90 -0
- package/src/utils/add-linter.js.map +1 -0
- package/src/utils/ct-helpers.d.ts +16 -0
- package/src/utils/ct-helpers.js +86 -0
- package/src/utils/ct-helpers.js.map +1 -0
- package/src/utils/cypress-version.d.ts +5 -0
- package/src/utils/cypress-version.js +34 -0
- package/src/utils/cypress-version.js.map +1 -0
- package/src/utils/find-target-options.d.ts +16 -0
- package/src/utils/find-target-options.js +115 -0
- package/src/utils/find-target-options.js.map +1 -0
- package/src/utils/project-name.d.ts +3 -0
- package/src/utils/project-name.js +20 -0
- package/src/utils/project-name.js.map +1 -0
- package/src/utils/versions.d.ts +9 -0
- package/src/utils/versions.js +13 -0
- package/src/utils/versions.js.map +1 -0
|
@@ -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.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,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"fileServerFolder": ".",
|
|
3
|
+
"fixturesFolder": "./<%= dir %>/fixtures",
|
|
4
|
+
"integrationFolder": "./<%= dir %>/integration",
|
|
5
|
+
"modifyObstructiveCode": false,
|
|
6
|
+
"supportFile": "./<%= dir %>/support/index.<%= ext %>",
|
|
7
|
+
"pluginsFile": false,
|
|
8
|
+
"video": true,
|
|
9
|
+
"videosFolder": "<%= offsetFromRoot %>dist/cypress/<%= projectRoot %>/videos",
|
|
10
|
+
"screenshotsFolder": "<%= offsetFromRoot %>dist/cypress/<%= projectRoot %>/screenshots",
|
|
11
|
+
"chromeWebSecurity": false
|
|
12
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "NxCypressE2EConfigGenerator",
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"title": "Add a Cypress Configuration.",
|
|
6
|
+
"description": "Add a Cypress configuration to an existing project.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"project": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "The project to add a Cypress configuration to",
|
|
12
|
+
"$default": {
|
|
13
|
+
"$source": "projectName"
|
|
14
|
+
},
|
|
15
|
+
"x-priority": "important",
|
|
16
|
+
"x-prompt": "What project do you want to add Cypress to?"
|
|
17
|
+
},
|
|
18
|
+
"devServerTarget": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "A devServerTarget,'<projectName>:<targetName>[:<configName>], that will be used to run tests against. This is usually the app this project will be used in. Pass --baseUrl if you wish to not use a devServerTarget.",
|
|
21
|
+
"x-priority": "important"
|
|
22
|
+
},
|
|
23
|
+
"port": {
|
|
24
|
+
"oneOf": [
|
|
25
|
+
{
|
|
26
|
+
"type": "string",
|
|
27
|
+
"enum": ["cypress-auto"]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"type": "number"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"description": "Set the 'port' option on the e2e target. It's recommend to set a different port so you can run tests e2e targets in parallel. Most dev servers support using '0' to automatically find a free port. The value 'cypress-auto' can be used if the underlying dev server does not support automatically finding a free port.",
|
|
34
|
+
"x-priority": "important"
|
|
35
|
+
},
|
|
36
|
+
"baseUrl": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "The address (with the port) which your application is running on. If you wish to start your application when running the e2e target, then use --devServerTarget instead."
|
|
39
|
+
},
|
|
40
|
+
"directory": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "A directory where the project is placed relative from the project root",
|
|
43
|
+
"x-priority": "important",
|
|
44
|
+
"default": "cypress"
|
|
45
|
+
},
|
|
46
|
+
"linter": {
|
|
47
|
+
"description": "The tool to use for running lint checks.",
|
|
48
|
+
"type": "string",
|
|
49
|
+
"enum": ["eslint", "none"],
|
|
50
|
+
"default": "eslint"
|
|
51
|
+
},
|
|
52
|
+
"js": {
|
|
53
|
+
"description": "Generate JavaScript files rather than TypeScript files.",
|
|
54
|
+
"type": "boolean",
|
|
55
|
+
"default": false
|
|
56
|
+
},
|
|
57
|
+
"skipFormat": {
|
|
58
|
+
"description": "Skip formatting files.",
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"default": false,
|
|
61
|
+
"x-priority": "internal"
|
|
62
|
+
},
|
|
63
|
+
"setParserOptionsProject": {
|
|
64
|
+
"type": "boolean",
|
|
65
|
+
"description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
|
|
66
|
+
"default": false
|
|
67
|
+
},
|
|
68
|
+
"skipPackageJson": {
|
|
69
|
+
"type": "boolean",
|
|
70
|
+
"default": false,
|
|
71
|
+
"description": "Do not add dependencies to `package.json`.",
|
|
72
|
+
"x-priority": "internal"
|
|
73
|
+
},
|
|
74
|
+
"rootProject": {
|
|
75
|
+
"description": "Create a application at the root of the workspace",
|
|
76
|
+
"type": "boolean",
|
|
77
|
+
"default": false,
|
|
78
|
+
"hidden": true,
|
|
79
|
+
"x-priority": "internal"
|
|
80
|
+
},
|
|
81
|
+
"bundler": {
|
|
82
|
+
"description": "The Cypress bundler to use.",
|
|
83
|
+
"type": "string",
|
|
84
|
+
"enum": ["vite", "webpack", "none"],
|
|
85
|
+
"x-prompt": "Which Cypress bundler do you want to use?",
|
|
86
|
+
"default": "webpack"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"required": ["project"],
|
|
90
|
+
"examplesFile": "../../../docs/cypress-e2e-config-examples.md"
|
|
91
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
|
+
import { Schema } from './schema';
|
|
3
|
+
export interface CypressProjectSchema extends Schema {
|
|
4
|
+
projectName: string;
|
|
5
|
+
projectRoot: string;
|
|
6
|
+
rootProject: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated use cypressE2EConfigurationGenerator instead
|
|
10
|
+
**/
|
|
11
|
+
export declare function cypressProjectGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
12
|
+
export default cypressProjectGenerator;
|
|
13
|
+
export declare const cypressProjectSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cypressProjectSchematic = exports.cypressProjectGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const linter_1 = require("@nx/linter");
|
|
7
|
+
const js_1 = require("@nx/js");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const cypress_version_1 = require("../../utils/cypress-version");
|
|
10
|
+
const project_name_1 = require("../../utils/project-name");
|
|
11
|
+
const versions_1 = require("../../utils/versions");
|
|
12
|
+
const init_1 = require("../init/init");
|
|
13
|
+
const add_linter_1 = require("../../utils/add-linter");
|
|
14
|
+
function createFiles(tree, options) {
|
|
15
|
+
// if not installed or >v10 use v10 folder
|
|
16
|
+
// else use v9 folder
|
|
17
|
+
const cypressVersion = (0, cypress_version_1.installedCypressVersion)();
|
|
18
|
+
const cypressFiles = cypressVersion && cypressVersion < 10 ? 'v9-and-under' : 'v10-and-after';
|
|
19
|
+
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files', cypressFiles), options.projectRoot, Object.assign(Object.assign({ tmpl: '' }, options), { project: options.project || 'Project', ext: options.js ? 'js' : 'ts', offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot), rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(tree, options.projectRoot), bundler: options.bundler }));
|
|
20
|
+
if (cypressVersion && cypressVersion < 7) {
|
|
21
|
+
(0, devkit_1.updateJson)(tree, (0, path_1.join)(options.projectRoot, 'cypress.json'), (json) => {
|
|
22
|
+
json.pluginsFile = './src/plugins/index';
|
|
23
|
+
return json;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
else if (cypressVersion < 10) {
|
|
27
|
+
const pluginPath = (0, path_1.join)(options.projectRoot, 'src/plugins/index.js');
|
|
28
|
+
if (tree.exists(pluginPath)) {
|
|
29
|
+
tree.delete(pluginPath);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (options.js) {
|
|
33
|
+
(0, devkit_1.toJS)(tree);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function addProject(tree, options) {
|
|
37
|
+
var _a, _b, _c, _d, _e;
|
|
38
|
+
let e2eProjectConfig;
|
|
39
|
+
const detectedCypressVersion = (_a = (0, cypress_version_1.installedCypressVersion)()) !== null && _a !== void 0 ? _a : versions_1.cypressVersion;
|
|
40
|
+
const cypressConfig = detectedCypressVersion < 10 ? 'cypress.json' : 'cypress.config.ts';
|
|
41
|
+
if (options.baseUrl) {
|
|
42
|
+
e2eProjectConfig = {
|
|
43
|
+
root: options.projectRoot,
|
|
44
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src'),
|
|
45
|
+
projectType: 'application',
|
|
46
|
+
targets: {
|
|
47
|
+
e2e: {
|
|
48
|
+
executor: '@nrwl/cypress:cypress',
|
|
49
|
+
options: {
|
|
50
|
+
cypressConfig: (0, devkit_1.joinPathFragments)(options.projectRoot, cypressConfig),
|
|
51
|
+
baseUrl: options.baseUrl,
|
|
52
|
+
testingType: 'e2e',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
tags: [],
|
|
57
|
+
implicitDependencies: options.project ? [options.project] : undefined,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
else if (options.project) {
|
|
61
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
62
|
+
if (!project.targets) {
|
|
63
|
+
devkit_1.logger.warn((0, devkit_1.stripIndents) `
|
|
64
|
+
NOTE: Project, "${options.project}", does not have any targets defined and a baseUrl was not provided. Nx will use
|
|
65
|
+
"${options.project}:serve" as the devServerTarget. But you may need to define this target within the project, "${options.project}".
|
|
66
|
+
`);
|
|
67
|
+
}
|
|
68
|
+
const devServerTarget = ((_b = project.targets) === null || _b === void 0 ? void 0 : _b.serve) && ((_d = (_c = project.targets) === null || _c === void 0 ? void 0 : _c.serve) === null || _d === void 0 ? void 0 : _d.defaultConfiguration)
|
|
69
|
+
? `${options.project}:serve:${project.targets.serve.defaultConfiguration}`
|
|
70
|
+
: `${options.project}:serve`;
|
|
71
|
+
e2eProjectConfig = {
|
|
72
|
+
root: options.projectRoot,
|
|
73
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src'),
|
|
74
|
+
projectType: 'application',
|
|
75
|
+
targets: {
|
|
76
|
+
e2e: {
|
|
77
|
+
executor: '@nrwl/cypress:cypress',
|
|
78
|
+
options: {
|
|
79
|
+
cypressConfig: (0, devkit_1.joinPathFragments)(options.projectRoot, cypressConfig),
|
|
80
|
+
devServerTarget,
|
|
81
|
+
testingType: 'e2e',
|
|
82
|
+
},
|
|
83
|
+
configurations: {
|
|
84
|
+
production: {
|
|
85
|
+
devServerTarget: `${options.project}:serve:production`,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
tags: [],
|
|
91
|
+
implicitDependencies: options.project ? [options.project] : undefined,
|
|
92
|
+
};
|
|
93
|
+
if ((_e = project.targets) === null || _e === void 0 ? void 0 : _e['serve-static']) {
|
|
94
|
+
e2eProjectConfig.targets.e2e.configurations.ci = {
|
|
95
|
+
devServerTarget: `${options.project}:serve-static`,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
throw new Error(`Either project or baseUrl should be specified.`);
|
|
101
|
+
}
|
|
102
|
+
if (detectedCypressVersion < 7) {
|
|
103
|
+
e2eProjectConfig.targets.e2e.options.tsConfig = (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.json');
|
|
104
|
+
}
|
|
105
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.projectName, e2eProjectConfig);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* @deprecated use cypressE2EConfigurationGenerator instead
|
|
109
|
+
**/
|
|
110
|
+
function cypressProjectGenerator(host, schema) {
|
|
111
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const options = normalizeOptions(host, schema);
|
|
113
|
+
const tasks = [];
|
|
114
|
+
const cypressVersion = (0, cypress_version_1.installedCypressVersion)();
|
|
115
|
+
// if there is an installed cypress version, then we don't call
|
|
116
|
+
// init since we want to keep the existing version that is installed
|
|
117
|
+
if (!cypressVersion) {
|
|
118
|
+
tasks.push(yield (0, init_1.cypressInitGenerator)(host, options));
|
|
119
|
+
}
|
|
120
|
+
if (schema.bundler === 'vite') {
|
|
121
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
|
122
|
+
vite: versions_1.viteVersion,
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
createFiles(host, options);
|
|
126
|
+
addProject(host, options);
|
|
127
|
+
const installTask = yield (0, add_linter_1.addLinterToCyProject)(host, Object.assign(Object.assign({}, options), { cypressDir: 'src', linter: schema.linter, project: options.projectName, overwriteExisting: true }));
|
|
128
|
+
tasks.push(installTask);
|
|
129
|
+
if (!options.skipFormat) {
|
|
130
|
+
yield (0, devkit_1.formatFiles)(host);
|
|
131
|
+
}
|
|
132
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
exports.cypressProjectGenerator = cypressProjectGenerator;
|
|
136
|
+
function normalizeOptions(host, options) {
|
|
137
|
+
const { layoutDirectory, projectDirectory } = (0, devkit_1.extractLayoutDirectory)(options.directory);
|
|
138
|
+
const appsDir = layoutDirectory !== null && layoutDirectory !== void 0 ? layoutDirectory : (0, devkit_1.getWorkspaceLayout)(host).appsDir;
|
|
139
|
+
let projectName;
|
|
140
|
+
let projectRoot;
|
|
141
|
+
let maybeRootProject;
|
|
142
|
+
let isRootProject = false;
|
|
143
|
+
const projects = (0, devkit_1.getProjects)(host);
|
|
144
|
+
// nx will set the project option for generators when ran within a project.
|
|
145
|
+
// since the root project will always be set for standlone projects we can just check it here.
|
|
146
|
+
if (options.project) {
|
|
147
|
+
maybeRootProject = projects.get(options.project);
|
|
148
|
+
}
|
|
149
|
+
if ((maybeRootProject === null || maybeRootProject === void 0 ? void 0 : maybeRootProject.root) === '.' ||
|
|
150
|
+
// should still check to see if we are in a standalone based workspace
|
|
151
|
+
(!maybeRootProject &&
|
|
152
|
+
Array.from(projects.values()).some((config) => config.root === '.'))) {
|
|
153
|
+
projectName = options.name;
|
|
154
|
+
projectRoot = options.name;
|
|
155
|
+
isRootProject = true;
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
projectName = (0, project_name_1.filePathPrefix)(projectDirectory ? `${projectDirectory}-${options.name}` : options.name);
|
|
159
|
+
projectRoot = projectDirectory
|
|
160
|
+
? (0, devkit_1.joinPathFragments)(appsDir, (0, devkit_1.names)(projectDirectory).fileName, options.name)
|
|
161
|
+
: (0, devkit_1.joinPathFragments)(appsDir, options.name);
|
|
162
|
+
}
|
|
163
|
+
options.linter = options.linter || linter_1.Linter.EsLint;
|
|
164
|
+
options.bundler = options.bundler || 'webpack';
|
|
165
|
+
return Object.assign(Object.assign({}, options), {
|
|
166
|
+
// other generators depend on the rootProject flag down stream
|
|
167
|
+
rootProject: isRootProject, projectName,
|
|
168
|
+
projectRoot });
|
|
169
|
+
}
|
|
170
|
+
exports.default = cypressProjectGenerator;
|
|
171
|
+
exports.cypressProjectSchematic = (0, devkit_1.convertNxGenerator)(cypressProjectGenerator);
|
|
172
|
+
//# sourceMappingURL=cypress-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cypress-project.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/generators/cypress-project/cypress-project.ts"],"names":[],"mappings":";;;;AAAA,uCAqBoB;AACpB,uCAAoC;AAEpC,+BAAuD;AAEvD,+BAA4B;AAC5B,iEAAsE;AACtE,2DAA0D;AAC1D,mDAAmE;AACnE,uCAAoD;AAGpD,uDAA8D;AAQ9D,SAAS,WAAW,CAAC,IAAU,EAAE,OAA6B;IAC5D,0CAA0C;IAC1C,qBAAqB;IACrB,MAAM,cAAc,GAAG,IAAA,yCAAuB,GAAE,CAAC;IACjD,MAAM,YAAY,GAChB,cAAc,IAAI,cAAc,GAAG,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC;IAE3E,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,WAAI,EAAC,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,EACxC,OAAO,CAAC,WAAW,gCAEjB,IAAI,EAAE,EAAE,IACL,OAAO,KACV,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,SAAS,EACrC,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAC7B,cAAc,EAAE,IAAA,uBAAc,EAAC,OAAO,CAAC,WAAW,CAAC,EACnD,gBAAgB,EAAE,IAAA,kCAA6B,EAC7C,IAAI,EACJ,OAAO,CAAC,WAAW,CACpB,EACD,OAAO,EAAE,OAAO,CAAC,OAAO,IAE3B,CAAC;IAEF,IAAI,cAAc,IAAI,cAAc,GAAG,CAAC,EAAE;QACxC,IAAA,mBAAU,EAAC,IAAI,EAAE,IAAA,WAAI,EAAC,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE;YACnE,IAAI,CAAC,WAAW,GAAG,qBAAqB,CAAC;YACzC,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;KACJ;SAAM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AI,CAAC;QAC3B,aAAa,GAAG,IAAI,CAAC;KACtB;SAAM;QACL,WAAW,GAAG,IAAA,6BAAc,EAC1B,gBAAgB,CAAC,CAAC,CAAC,GAAG,gBAAgB,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CACxE,CAAC;QACF,WAAW,GAAG,gBAAgB;YAC5B,CAAC,CAAC,IAAA,0BAAiB,EACf,OAAO,EACP,IAAA,cAAK,EAAC,gBAAgB,CAAC,CAAC,QAAQ,EAChC,OAAO,CAAC,IAAI,CACb;YACH,CAAC,CAAC,IAAA,0BAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;KAC9C;IAED,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,eAAM,CAAC,MAAM,CAAC;IACjD,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,SAAS,CAAC;IAC/C,uCACK,OAAO;QACV,8DAA8D;QAC9D,WAAW,EAAE,aAAa,EAC1B,WAAW;QACX,WAAW,IACX;AACJ,CAAC;AAED,kBAAe,uBAAuB,CAAC;AAC1B,QAAA,uBAAuB,GAAG,IAAA,2BAAkB,EACvD,uBAAuB,CACxB,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 <%= project %>');
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -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,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"fileServerFolder": ".",
|
|
3
|
+
"fixturesFolder": "./src/fixtures",
|
|
4
|
+
"integrationFolder": "./src/integration",
|
|
5
|
+
"modifyObstructiveCode": false,
|
|
6
|
+
"supportFile": "./src/support/index.<%= ext %>",
|
|
7
|
+
"pluginsFile": false,
|
|
8
|
+
"video": true,
|
|
9
|
+
"videosFolder": "<%= offsetFromRoot %>dist/cypress/<%= projectRoot %>/videos",
|
|
10
|
+
"screenshotsFolder": "<%= offsetFromRoot %>dist/cypress/<%= projectRoot %>/screenshots",
|
|
11
|
+
"chromeWebSecurity": false
|
|
12
|
+
}
|
|
@@ -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 <%= project %>');
|
|
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');
|
|
@@ -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.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,15 @@
|
|
|
1
|
+
import { Linter } from '@nx/linter';
|
|
2
|
+
|
|
3
|
+
export interface Schema {
|
|
4
|
+
project?: string;
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
name: string;
|
|
7
|
+
directory?: string;
|
|
8
|
+
linter?: Linter;
|
|
9
|
+
js?: boolean;
|
|
10
|
+
skipFormat?: boolean;
|
|
11
|
+
setParserOptionsProject?: boolean;
|
|
12
|
+
standaloneConfig?: boolean;
|
|
13
|
+
skipPackageJson?: boolean;
|
|
14
|
+
bundler?: 'webpack' | 'vite' | 'none';
|
|
15
|
+
}
|