333 lines
27 KiB
JSON
333 lines
27 KiB
JSON
{
|
|
"githubRoot": "https://github.com/nrwl/nx/blob/master",
|
|
"name": "cypress",
|
|
"packageName": "@nrwl/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": "Cypress is a test runner built for the 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> Info about [Cypress Component Testing can be found here](/cypress/cypress-component-testing)\n\nIf the `@nrwl/cypress` package is not installed, install the version that matches your `nx` package version.\n\n```bash\nyarn add --dev @nrwl/cypress\n```\n\n```bash\nnpm install --save-dev @nrwl/cypress\n```\n\n## E2E Testing\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\nTo generate an E2E project based on an existing project, run the following generator\n\n```bash\nnx g @nrwl/cypress:cypress-project your-app-name-e2e --project=your-app-name\n```\n\nOptionally, you can use the `--baseUrl` option if you don't want cypress plugin to serve `your-app-name`.\n\n```bash\nnx g @nrwl/cypress:cypress-project your-app-name-e2e --baseUrl=http://localhost:4200\n```\n\nReplace `your-app-name` with the app's name as defined in your `tsconfig.base.json` file or the `name` property of your `package.json`.\n\n### Testing Applications\n\nRun `nx e2e frontend-e2e` to execute e2e tests with Cypress.\n\nYou can run your e2e test against a production build by using the `production` [configuration](https://nx.dev/recipe/use-executor-configurations#use-executor-configurations)\n\n```bash\nnx e2e frontend-e2e --configuration=production\n```\n\nBy default, Cypress will run in headless mode. You will have the result of all the tests and errors (if any) in your\nterminal. Screenshots and videos will be accessible in `dist/cypress/apps/frontend/screenshots` and `dist/cypress/apps/frontend/videos`.\n\n### Watching for Changes (Headed Mode)\n\nWith, `nx e2e frontend-e2e --watch` Cypress will start in headed mode where you can see your application being tested.\n\nRunning Cypress with `--watch` is a great way to enhance dev workflow - you can build up test files with the application\nrunning and Cypress will re-run those tests as you enhance and add to the suite.\n\n```bash\nnx e2e frontend-e2e --watch\n```\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\n> the cypress config file, or will error.\n\n## Using cypress.config.ts\n\nIf you need to fine tune your Cypress setup, you can do so by modifying `cypress.config.ts` in the project root. For\ninstance,\nyou can easily add your `projectId` to save all the screenshots and videos into your Cypress dashboard. The complete\nconfiguration is documented\non [the official website](https://docs.cypress.io/guides/references/configuration.html#Options).\n\n## Environment Variables\n\nIf you're needing to pass a variable to cypress that you wish to not commit to your repository, i.e. API keys, or dynamic values based on configurations, i.e. API Urls. This is where [Cypress environment variables](https://docs.cypress.io/guides/guides/environment-variables) can be used.\n\nThere are a handful of ways to pass environment variables to Cypress, but the most common is going to be via the [`cypress.env.json` file](https://docs.cypress.io/guides/guides/environment-variables#Option-1-configuration-file), the [env executor option for cypress](https://nx.dev/packages/cypress/executors/cypress#env) or the commandline.\n\nCreate a `cypress.env.json` file in the projects root i.e. `apps/my-cool-app-e2e/cypress.env.json`. Cypress will automatically pick up this file. This method is helpful for configurations that you want to not commit. Just don't forget to add the file to the `.gitignore` and add documentation so people in your repo know what values to popluate in their local copy of the `cypress.env.json` file.\n\nUsing [@nrwl/cypress:cypress](/packages/cypress/executors/cypress) env executor option is a good way to add values you want to define that you don't mine commit to the repository, such as a base API url. You can leverage [target configurations](/reference/project-configuration#targets) to define different values as well.\n\nOptionally, you can pass environment variables via the commandline with the `--env` flag.\n\n{% callout type=\"warning\" title=\"Executor options and --env\" %}\nWhen using the `--env` flag, this will not be merged with any values used in the `env` executor option.\n{% /callout %}\n\n```bash\nnx e2e frontend-e2e --env.API_URL=\"https://api.my-nx-website.com\" --env.API_KEY=\"abc-123\"\n```\n"
|
|
},
|
|
{
|
|
"name": "Component Testing",
|
|
"id": "cypress-component-testing",
|
|
"file": "shared/cypress-component-testing",
|
|
"content": "# Cypress Component Testing\n\n> Component testing requires Cypress v10 and above.\n> See our [guide for more information](/cypress/v10-migration-guide) to migrate to Cypress v10.\n\nUnlike [E2E testing](/packages/cypress), component testing does not create a new project. Instead, Cypress component testing is added\ndirectly to a project, like [Jest](/packages/jest)\n\n## Add Component Testing to a Project\n\n> Currently only [@nrwl/react](/packages/react/generators/cypress-component-configuration) and [@nrwl/angular](/packages/angular/generators/cypress-component-configuration) plugins support component testing\n\nUse the `cypress-component-configuration` generator from the respective plugin to add component testing to a project.\n\n```bash\nnx g @nrwl/react:cypress-component-configuration --project=your-project\n\nnx g @nrwl/angular:cypress-component-configuration --project=your-project\n```\n\nYou can optionally pass in `--generate-tests` to create component tests for all components within the library.\n\nComponent testing leverages a build target within your workspace as the base for running the tests. The build target is usually an app within the workspace. By default, the generator attempts to find the build target for you based on the project usage, but you can manually specify the build target to use via the `--build-target` option.\n\n```bash\nnx g @nrwl/react:cypress-component-configuration --project=your-project --build-target=my-react-app:build\n\nnx g @nrwl/angular:cypress-component-configuration --project=your-project --build-target=my-ng-app:build\n```\n\nThe build target option can be changed later via updating the `devServerTarget` option in the `component-test` target.\n\n{% callout type=\"warning\" title=\"Executor Options\" %}\nWhen using component testing make sure to set `skipServe: true` in the component test target options, otherwise `@nrwl/cypress` will attempt to run the build first which can slow down your component tests. `skipServe: true` is automatically set when using the `cypress-component-configuration` generator.\n{% /callout %}\n\n## Testing Projects\n\nRun `nx component-test your-lib` to execute the component 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\nterminal. Screenshots and videos will be accessible in `dist/cypress/libs/your-lib/screenshots` and `dist/cypress/libs/your-lib/videos`.\n\n## Watching for Changes (Headed Mode)\n\nWith, `nx component-test your-lib --watch` Cypress will start in headed mode. Where you can see your component being tested.\n\nRunning Cypress with `--watch` is a great way to iterate on your components since cypress will rerun your tests as you make those changes validating the new behavior.\n\n## More Information\n\nYou can read more on component testing in the [Cypress documentation](https://docs.cypress.io/guides/component-testing/writing-your-first-component-test).\n"
|
|
},
|
|
{
|
|
"name": "v10 Migration Guide",
|
|
"id": "v10-migration-guide",
|
|
"file": "shared/guides/cypress/cypress-v10-migration",
|
|
"content": "# Migrating to Cypress V10\n\nCypress v10 introduce new features, like component testing, along with some breaking changes.\n\nBefore continuing, make sure you have all your changes committed and have a clean working tree.\n\nYou can migrate an E2E project to v10 by running the following command:\n\n```bash\nnx g @nrwl/cypress:migrate-to-cypress-10\n```\n\nIn general, these are the steps taken to migrate your project:\n\n1. Migrates your existing `cypress.json` configuration to a new `cypress.config.ts` configuration file.\n - The `pluginsFile` option has been replaced for `setupNodeEvents`. We will import the file and add it to\n the `setupNodeEvents` config option. Double-check your plugins are working correctly.\n2. Rename all test files from `.spec.ts` to `.cy.ts`\n3. Rename the `support/index.ts` to `support/e2e.ts` and update any associated imports\n4. Rename the `integrations` folder to the `e2e` folder\n\nWe take the best effort to make this migration seamless, but there can be edge cases we didn't anticipate. So feel free to [open an issue](https://github.com/nrwl/nx/issues/new?assignees=&labels=type%3A+bug&template=1-bug.md) if you come across any problems.\n\nYou can also consult the [official Cypress migration guide](https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-version-10-0) if you get stuck and want to manually migrate your projects.\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", "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"],
|
|
"examplesFile": "Adding Cypress to an existing application requires two options. The name of the e2e app to create and what project that e2e app is for.\n\n```bash\nnx g cypress-project --name=my-app-e2e --project=my-app\n```\n\nWhen providing `--project` option, the generator will look for the `serve` target in that given project. This allows the [cypress executor](/packages/cypress/executors/cypress) to spin up the project and start the cypress runner.\n\nIf you prefer to not have the project served automatically, you can provide a `--base-url` argument in place of `--project`\n\n```bash\nnx g cypress-project --name=my-app-e2e --base-url=http://localhost:1234\n```\n\n{% callout type=\"note\" title=\"What about API Projects?\" %}\nYou can also run the `cypress-project` generator against API projects like a [Nest API](/packages/nest/generators/application#@nrwl/nest:application).\nIf there is a URL to visit then you can test it with Cypress!\n{% /callout %}\n",
|
|
"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"
|
|
},
|
|
{
|
|
"name": "cypress-component-project",
|
|
"factory": "./src/generators/cypress-component-project/cypress-component-project#cypressComponentProject",
|
|
"schema": {
|
|
"$schema": "http://json-schema.org/schema",
|
|
"$id": "NxCypressComponentProject",
|
|
"cli": "nx",
|
|
"title": "Set up Cypress component testing for a project",
|
|
"description": "Set up Cypress component test for a project.",
|
|
"type": "object",
|
|
"examples": [
|
|
{
|
|
"command": "nx g @nrwl/cypress:cypress-component-project --project=my-cool-lib ",
|
|
"description": "Add cypress component testing to an existing project named my-cool-lib"
|
|
}
|
|
],
|
|
"properties": {
|
|
"project": {
|
|
"type": "string",
|
|
"description": "The name of the project to add cypress component testing to",
|
|
"$default": { "$source": "projectName" },
|
|
"x-prompt": "What project should we add Cypress component testing to?"
|
|
}
|
|
},
|
|
"required": ["project"],
|
|
"examplesFile": "This is a framework-agnostic generator for adding component testing to a project.\n\n```bash\nnx g cypress-component-project --project=my-cool-project\n```\n\nRunning this generator, adds the required files to the specified project without any configurations for Cypress. It's best to use the framework specific generator, instead `cypress-component-project` directly\n\n- [React component testing](/packages/react/generators/cypress-component-configuration)\n- [Angular component testing](/packages/angular/generators/cypress-component-configuration)\n\nA new `component-test` target will be added to the specified project.\n\n```bash\nnx g component-test my-cool-project\n```\n\nRead more about [Cypress Component Testing](/cypress/cypress-component-testing)\n",
|
|
"presets": []
|
|
},
|
|
"description": "Set up Cypress Component Test for a project",
|
|
"hidden": true,
|
|
"implementation": "/packages/cypress/src/generators/cypress-component-project/cypress-component-project#cypressComponentProject.ts",
|
|
"aliases": [],
|
|
"path": "/packages/cypress/src/generators/cypress-component-project/schema.json"
|
|
},
|
|
{
|
|
"name": "migrate-to-cypress-10",
|
|
"factory": "./src/generators/migrate-to-cypress-ten/migrate-to-cypress-ten#migrateCypressProject",
|
|
"schema": {
|
|
"$schema": "http://json-schema.org/schema",
|
|
"$id": "NxCypressMigrateToTen",
|
|
"cli": "nx",
|
|
"title": "Migrate e2e project to Cypress 10",
|
|
"description": "Migrate Cypress e2e project from v8/v9 to Cypress v10.",
|
|
"type": "object",
|
|
"examples": [
|
|
{
|
|
"command": "nx g @nrwl/cypress:migrate-to-cypress-10",
|
|
"description": "Migrate existing cypress projects to Cypress v10"
|
|
}
|
|
],
|
|
"properties": {},
|
|
"presets": []
|
|
},
|
|
"description": "Migrate existing Cypress e2e projects to Cypress v10",
|
|
"hidden": true,
|
|
"implementation": "/packages/cypress/src/generators/migrate-to-cypress-ten/migrate-to-cypress-ten#migrateCypressProject.ts",
|
|
"aliases": [],
|
|
"path": "/packages/cypress/src/generators/migrate-to-cypress-ten/schema.json"
|
|
}
|
|
],
|
|
"executors": [
|
|
{
|
|
"name": "cypress",
|
|
"implementation": "/packages/cypress/src/executors/cypress/cypress.impl.ts",
|
|
"schema": {
|
|
"title": "Cypress Target",
|
|
"description": "Run Cypress for e2e, integration and component testing.",
|
|
"type": "object",
|
|
"outputCapture": "pipe",
|
|
"cli": "nx",
|
|
"presets": [
|
|
{
|
|
"name": "Starting Dev Server",
|
|
"keys": ["cypressConfig", "devServerTarget"]
|
|
},
|
|
{ "name": "Custom Base Url", "keys": ["cypressConfig", "baseUrl"] },
|
|
{
|
|
"name": "Component Testing",
|
|
"keys": [
|
|
"cypressConfig",
|
|
"devServerTarget",
|
|
"testingType",
|
|
"skipServe"
|
|
]
|
|
}
|
|
],
|
|
"properties": {
|
|
"cypressConfig": {
|
|
"type": "string",
|
|
"description": "The path of the Cypress configuration json file.",
|
|
"x-completion-type": "file",
|
|
"x-completion-glob": "cypress?(*)@(.js|.ts|.json)"
|
|
},
|
|
"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.",
|
|
"x-completion-type": "file",
|
|
"x-completion-glob": "tsconfig.*.json"
|
|
},
|
|
"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"],
|
|
"examplesFile": "Depending on your testing type, the Cypress executor is configured in different ways. The following are sample configurations that are created via the [cypress-project](/packages/cypress/generators/cypress-project) and [cypress-component-project](/packages/cypress/generators/cypress-component-project) generators.\n\n{% tabs %}\n{% tab label=\"E2E Testing\" %}\n\n```json\n\"targets\": {\n \"e2e\": {\n \"executor\": \"@nrwl/cypress:cypress\",\n \"options\": {\n \"cypressConfig\": \"apps/app-e2e/cypres.config.ts\",\n \"devServerTarget\": \"my-react-app:serve\",\n \"testingType\": \"e2e\"\n }\n }\n}\n```\n\n{% callout type=\"note\" title=\"API Testing\" %}\nAPI testing with Cypress is the same setup as e2e testing. Just change which `devServerTarget` is used!\n{% /callout %}\n\n### Providing a Base URL\n\nIf `devServerTarget` is provided, the url returned from started the dev server will be passed to cypress as the `baseUrl` option.\n\nDefining a `baseUrl` in the executor options will override the inferred `baseUrl` from the `devServerTarget`.\n\nThe `baseUrl` defined in the Cypress config file is the last value used if no url is found in the `devServerTarget` or executor options.\n\n### Static Serving\n\nWhen running in CI it doesn't make sense to start up a dev server since there aren't changes to watch for.\n\nYou can use [`@nrwl/web:file-server`](/packages/web/executors/file-server) to serve the pre-built static files of your frontend project.\n\nIn some _frontend_ application, add a 'static-serve' target.\n\n```json\n\"serve-static\": {\n \"executor\": \"@nrwl/web:file-server\",\n \"options\":{\n \"buildTarget\": \"frontend:build\"\n }\n}\n```\n\nIn the _e2e_ application add a configuration to change `devServerTarget` to point to the `static-serve` from the _frontend_ application\n\n```json\n\"e2e\": {\n //...\n \"configurations\": {\n \"ci\": {\n \"devServerTarget\": \"frontend:serve-static\"\n }\n }\n}\n```\n\n{% callout type=\"note\" title=\"What about Node projects?\" %}\nThe same can be done for backend node apps with [`@nrwl/js:node` executor](/packages/js/executors/node)\n{% /callout %}\n\n```bash\nnx e2e my-app-e2e --configuration=ci\n```\n\n{% /tab %}\n{% tab label=\"Component Testing\" %}\n\n{% callout type=\"note\" title=\"Cypress Component Testing\" %}\nWhen adding component testing to a project, it's best to use the framework specific generator, instead `cypress-component-project` directly.\n\n- [React component testing](/packages/react/generators/cypress-component-configuration)\n- [Angular component testing](/packages/angular/generators/cypress-component-configuration)\n\n{% /callout %}\n\n```json\n\"targets\": {\n \"component-test\": {\n \"executor\": \"@nrwl/cypress:cypress\",\n \"options\": {\n \"cypressConfig\": \"apps/app/cypres.config.ts\",\n \"devServerTarget\": \"my-react-app:build\",\n \"testingType\": \"component\",\n \"skipServe\": true\n }\n }\n}\n```\n\nIt's important `skipServe` is set to true. Nx doesn't need to run the `devServerTarget`, Cypress creates its own dev server for component testing.\nInstead, Nx needs to know what build target to create the correct configuration to pass to Cypress, which is why it's still used in component testing.\n\n{% /tab %}\n{% /tabs %}\n\n### Environment Variables\n\nUsing [executor configurations](/recipe/use-executor-configurations#use-executor-configurations) offers flexibility to set environment variables\n\n```json\n\"targets\": {\n \"e2e\": {\n \"executor\": \"@nrwl/cypress:cypress\",\n \"options\": {\n \"cypressConfig\": \"apps/app-e2e/cypres.config.ts\",\n \"devServerTarget\": \"my-react-app:serve\",\n \"testingType\": \"e2e\"\n },\n \"configurations\": {\n \"qa\": {\n \"env\": {\n \"API_URL\": \"https://api.qa.company.com\"\n }\n },\n \"dev\": {\n \"env\": {\n \"API_URL\": \"http://locahost:3333/api\"\n }\n }\n }\n }\n}\n```\n\nRead more on different ways to use [environment variables for cypress executor](/packages/cypress#environment-variables)\n"
|
|
},
|
|
"description": "Run Cypress E2E tests.",
|
|
"aliases": [],
|
|
"hidden": false,
|
|
"path": "/packages/cypress/src/executors/cypress/schema.json"
|
|
}
|
|
]
|
|
}
|