240 lines
12 KiB
JSON
240 lines
12 KiB
JSON
{
|
|
"githubRoot": "https://github.com/nrwl/nx/blob/master",
|
|
"name": "cypress",
|
|
"description": "The Nx Plugin for Cypress contains executors and generators allowing your workspace to use the powerful Cypress integration testing capabilities.",
|
|
"root": "/packages/cypress",
|
|
"source": "/packages/cypress/src",
|
|
"documentation": [
|
|
{
|
|
"name": "Overview",
|
|
"id": "overview",
|
|
"path": "/packages/cypress",
|
|
"file": "shared/cypress-plugin",
|
|
"content": "\n\nCypress is an e2e test runner built for modern web. It has a lot of great features:\n\n- Time travel\n- Real-time reloads\n- Automatic waiting\n- Spies, stubs, and clocks\n- Network traffic control\n- Screenshots and videos\n\n## Setting Up Cypress\n\n### Generating Applications\n\nBy default, when creating a new frontend application, Nx will use Cypress to create the e2e tests project.\n\n```bash\nnx g @nrwl/web:app frontend\n```\n\n### Creating a Cypress E2E project for an existing project\n\nYou can create a new Cypress E2E project for an existing project.\n\nIf the `@nrwl/cypress` package is not installed, install the version that matches your `@nrwl/workspace` version.\n\n```bash\nyarn add --dev @nrwl/cypress\n```\n\n```bash\nnpm install --save-dev @nrwl/cypress\n```\n\nNext, generate an E2E project based on an existing project.\n\n```bash\nnx g @nrwl/cypress:cypress-project your-app-name-e2e --project=your-app-name\n```\n\nReplace `your-app-name` with the app's name as defined in your `workspace.json` file.\n\n## Using Cypress\n\n### Testing Applications\n\nSimply run `nx e2e frontend-e2e` to execute e2e tests with Cypress.\n\nBy default, Cypress will run in headless mode. You will have the result of all the tests and errors (if any) in your terminal. Screenshots and videos will be accessible in `dist/apps/frontend/screenshots` and `dist/apps/frontend/videos`.\n\n### Watching for Changes\n\nWith, `nx e2e frontend-e2e --watch` Cypress will start in the application mode.\n\nRunning Cypress with `--watch` is a great way to enhance dev workflow - you can build up test files with the application running and Cypress will re-run those tests as you enhance and add to the suite.\n\nCypress doesn't currently re-run your tests after changes are made to application code when it runs in “headed” mode.\n\n### Using Cypress in the Headed Mode\n\nYou can run Cypress in headed mode to see your app being tested. To do this, pass in the `--watch` option. E.g: `nx frontend-e2e --watch`\n\n### Testing Against Prod Build\n\nYou can run your e2e test against a production build like this: `nx e2e frontend-e2e --prod`.\n\n## Configuration\n\n### Specifying a Custom Url to Test\n\nThe `baseUrl` property provides you the ability to test an application hosted on a specific domain.\n\n```bash\nnx e2e frontend-e2e --baseUrl=https://frontend.com\n```\n\n> If no `baseUrl` and no `devServerTarget` are provided, Cypress will expect to have the `baseUrl` property in the `cypress.json` file, or will error.\n\n### Using cypress.json\n\nIf you need to fine tune your Cypress setup, you can do so by modifying `cypress.json` in the e2e project. For instance, you can easily add your `projectId` to save all the screenshots and videos into your Cypress dashboard. The complete configuration is documented on [the official website](https://docs.cypress.io/guides/references/configuration.html#Options).\n\n## More Documentation\n\nReact Nx Tutorial\n\n- [Step 2: Add E2E Tests](/react-tutorial/02-add-e2e-test)\n- [Step 3: Display Todos](/react-tutorial/03-display-todos)\n\nAngular Nx Tutorial\n\n- [Step 2: Add E2E Tests](/angular-tutorial/02-add-e2e-test)\n- [Step 3: Display Todos](/angular-tutorial/03-display-todos)\n"
|
|
}
|
|
],
|
|
"generators": [
|
|
{
|
|
"name": "init",
|
|
"factory": "./src/generators/init/init#cypressInitGenerator",
|
|
"schema": {
|
|
"$schema": "http://json-schema.org/schema",
|
|
"$id": "NxCypressInit",
|
|
"cli": "nx",
|
|
"title": "Add Cypress Configuration to the workspace",
|
|
"description": "Add Cypress Configuration to the workspace.",
|
|
"type": "object",
|
|
"properties": {
|
|
"skipPackageJson": {
|
|
"type": "boolean",
|
|
"default": false,
|
|
"description": "Do not add dependencies to `package.json`."
|
|
}
|
|
},
|
|
"presets": []
|
|
},
|
|
"description": "Initialize the `@nrwl/cypress` plugin.",
|
|
"aliases": ["ng-add"],
|
|
"hidden": true,
|
|
"implementation": "/packages/cypress/src/generators/init/init#cypressInitGenerator.ts",
|
|
"path": "/packages/cypress/src/generators/init/schema.json"
|
|
},
|
|
{
|
|
"name": "cypress-project",
|
|
"factory": "./src/generators/cypress-project/cypress-project#cypressProjectGenerator",
|
|
"schema": {
|
|
"$schema": "http://json-schema.org/schema",
|
|
"$id": "NxCypressProjectGeneratorSchema",
|
|
"cli": "nx",
|
|
"title": "Create Cypress Configuration for the workspace",
|
|
"description": "Create Cypress Configuration for the workspace.",
|
|
"type": "object",
|
|
"properties": {
|
|
"project": {
|
|
"type": "string",
|
|
"description": "The name of the frontend project to test.",
|
|
"$default": { "$source": "projectName" }
|
|
},
|
|
"baseUrl": {
|
|
"type": "string",
|
|
"description": "The address (with the port) which your application is running on."
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Name of the E2E Project.",
|
|
"$default": { "$source": "argv", "index": 0 },
|
|
"x-prompt": "What name would you like to use for the e2e project?"
|
|
},
|
|
"directory": {
|
|
"type": "string",
|
|
"description": "A directory where the project is placed."
|
|
},
|
|
"linter": {
|
|
"description": "The tool to use for running lint checks.",
|
|
"type": "string",
|
|
"enum": ["eslint", "tslint", "none"],
|
|
"default": "eslint"
|
|
},
|
|
"js": {
|
|
"description": "Generate JavaScript files rather than TypeScript files.",
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"skipFormat": {
|
|
"description": "Skip formatting files.",
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"setParserOptionsProject": {
|
|
"type": "boolean",
|
|
"description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
|
|
"default": false
|
|
},
|
|
"standaloneConfig": {
|
|
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside workspace.json.",
|
|
"type": "boolean"
|
|
},
|
|
"skipPackageJson": {
|
|
"type": "boolean",
|
|
"default": false,
|
|
"description": "Do not add dependencies to `package.json`."
|
|
}
|
|
},
|
|
"required": ["name"],
|
|
"presets": []
|
|
},
|
|
"description": "Add a Cypress E2E Project.",
|
|
"hidden": true,
|
|
"implementation": "/packages/cypress/src/generators/cypress-project/cypress-project#cypressProjectGenerator.ts",
|
|
"aliases": [],
|
|
"path": "/packages/cypress/src/generators/cypress-project/schema.json"
|
|
}
|
|
],
|
|
"executors": [
|
|
{
|
|
"name": "cypress",
|
|
"implementation": "/packages/cypress/src/executors/cypress/cypress.impl.ts",
|
|
"schema": {
|
|
"title": "Cypress Target",
|
|
"description": "Cypress target option for Build Facade.",
|
|
"type": "object",
|
|
"outputCapture": "pipe",
|
|
"cli": "nx",
|
|
"properties": {
|
|
"cypressConfig": {
|
|
"type": "string",
|
|
"description": "The path of the Cypress configuration json file."
|
|
},
|
|
"watch": {
|
|
"type": "boolean",
|
|
"description": "Recompile and run tests when files change.",
|
|
"default": false
|
|
},
|
|
"tsConfig": {
|
|
"type": "string",
|
|
"description": "The path of the Cypress tsconfig configuration json file."
|
|
},
|
|
"devServerTarget": {
|
|
"type": "string",
|
|
"description": "Dev server target to run tests against."
|
|
},
|
|
"headed": {
|
|
"type": "boolean",
|
|
"description": "Displays the browser instead of running headlessly. Set this to `true` if your run depends on a Chrome extension being loaded.",
|
|
"default": false
|
|
},
|
|
"headless": {
|
|
"type": "boolean",
|
|
"description": "Hide the browser instead of running headed (default for cypress run).",
|
|
"default": false,
|
|
"x-deprecated": true
|
|
},
|
|
"exit": {
|
|
"type": "boolean",
|
|
"description": "Whether or not the Cypress Test Runner will stay open after running tests in a spec file.",
|
|
"default": true
|
|
},
|
|
"key": {
|
|
"type": "string",
|
|
"description": "The key cypress should use to run tests in parallel/record the run (CI only)."
|
|
},
|
|
"record": {
|
|
"type": "boolean",
|
|
"description": "Whether or not Cypress should record the results of the tests.",
|
|
"default": false
|
|
},
|
|
"parallel": {
|
|
"type": "boolean",
|
|
"description": "Whether or not Cypress should run its tests in parallel (CI only).",
|
|
"default": false
|
|
},
|
|
"baseUrl": {
|
|
"type": "string",
|
|
"description": "The address (with the port) which your application is running on."
|
|
},
|
|
"browser": {
|
|
"type": "string",
|
|
"description": "The browser to run tests in."
|
|
},
|
|
"env": {
|
|
"type": "object",
|
|
"description": "A key-value Pair of environment variables to pass to Cypress runner."
|
|
},
|
|
"spec": {
|
|
"type": "string",
|
|
"description": "A comma delimited glob string that is provided to the Cypress runner to specify which spec files to run. i.e. `**examples/**,**actions.spec**`."
|
|
},
|
|
"copyFiles": {
|
|
"type": "string",
|
|
"description": "A regex string that is used to choose what additional integration files to copy to the dist folder.",
|
|
"x-deprecated": true
|
|
},
|
|
"ciBuildId": {
|
|
"oneOf": [{ "type": "string" }, { "type": "number" }],
|
|
"description": "A unique identifier for a run to enable grouping or parallelization."
|
|
},
|
|
"group": {
|
|
"type": "string",
|
|
"description": "A named group for recorded runs in the Cypress dashboard."
|
|
},
|
|
"ignoreTestFiles": {
|
|
"type": "string",
|
|
"description": "A String or Array of glob patterns used to ignore test files that would otherwise be shown in your list of tests. Cypress uses minimatch with the options: `{dot: true, matchBase: true}`. We suggest using https://globster.xyz to test what files would match."
|
|
},
|
|
"reporter": {
|
|
"type": "string",
|
|
"description": "The reporter used during cypress run."
|
|
},
|
|
"reporterOptions": {
|
|
"type": "string",
|
|
"description": "The reporter options used. Supported options depend on the reporter."
|
|
},
|
|
"skipServe": {
|
|
"type": "boolean",
|
|
"description": "Skip dev-server build.",
|
|
"default": false
|
|
},
|
|
"testingType": {
|
|
"type": "string",
|
|
"description": "Specify the type of tests to execute.",
|
|
"enum": ["component", "e2e"],
|
|
"default": "e2e"
|
|
},
|
|
"tag": {
|
|
"type": "string",
|
|
"description": "A comma delimited list to identify a run with.",
|
|
"aliases": ["t"]
|
|
}
|
|
},
|
|
"additionalProperties": true,
|
|
"required": ["cypressConfig"],
|
|
"presets": []
|
|
},
|
|
"description": "Run Cypress E2E tests.",
|
|
"aliases": [],
|
|
"hidden": false,
|
|
"path": "/packages/cypress/src/executors/cypress/schema.json"
|
|
}
|
|
]
|
|
}
|