{"__v":1,"_id":"56993ff47465970d00650b8f","category":{"__v":16,"_id":"56954a95fe18811700c9bfdf","pages":["56954a97fe18811700c9c01d","56954a97fe18811700c9c01e","56954a97fe18811700c9c01f","56954a97fe18811700c9c020","56954a97fe18811700c9c021","56954a97fe18811700c9c022","56954a97fe18811700c9c023","56954a97fe18811700c9c024","56954a97fe18811700c9c025","56954a97fe18811700c9c026","56954a97fe18811700c9c027","56954a97fe18811700c9c028","56954a97fe18811700c9c029","5696cda524490c3700170a05","5697efe61c4dc8230054268e","5697efe72cf4060d004eaa75","56993ff47465970d00650b8f","56a7a155dfdabc0d000ae910","56a7a155b5d0920d0051cd81","56a7a1a6cf6d771700baeee3","56a7a1a63d33bc2100793d5d","56a7a23097e8b00d0096d209","56a7a230ea3e3417000df4b1","56a7a25acf6d771700baeee6","56a7a25a03f28c0d00a545bf","56a7a2b83d33bc2100793d60","56a7a2b8b5d0920d0051cd82","56b27fe42db51f0d0044e566"],"project":"568fde81b700ce0d002f4b43","version":"56954a94fe18811700c9bfda","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-01-09T16:40:53.584Z","from_sync":false,"order":4,"slug":"guides","title":"Guides"},"parentDoc":null,"project":"568fde81b700ce0d002f4b43","user":"568fffce769f210d0013258f","version":{"__v":6,"_id":"56954a94fe18811700c9bfda","project":"568fde81b700ce0d002f4b43","createdAt":"2016-01-12T18:48:52.007Z","releaseDate":"2016-01-12T18:48:52.007Z","categories":["56954a95fe18811700c9bfdb","56954a95fe18811700c9bfdc","56954a95fe18811700c9bfdd","56954a95fe18811700c9bfde","56954a95fe18811700c9bfdf","56954a95fe18811700c9bfe0","56954a95fe18811700c9bfe1","56954a95fe18811700c9bfe2","56954a95fe18811700c9bfe3","56954a95fe18811700c9bfe4","5695649fdcaf0d1700cb8721","5696c1168560a60d00e2c1d6","56a7a32e79395317007c1ad6","5898fc3eec49fb0f004c2663","589cc675ea37da23004e05e1"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"foo","version_clean":"0.0.0","version":"0.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-01-15T18:52:36.941Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"# Contents\n\n- :fa-angle-right: [Configuration Options](#section-configuration-options)\n  - [Global](#section-global)\n  - [Timeouts](#section-timeouts)\n  - [Folders](#section-folders)\n  - [Screenshots](#section-screenshots)\n  - [Videos](#section-videos)\n  - [Browser](#section-browser)\n  - [Web Server](#section-web-server)\n  - [Viewport](#section-viewport)\n  - [Animation](#section-animation)\n- :fa-angle-right: [Overriding Options](#section-overriding-options)\n  - [Command Line](#section-command-line)\n  - [Environment Variables](#section-environment-variables)\n- :fa-angle-right: [Resolved Configuration](#section-resolved-configuration)\n\n***\n\n# Configuration Options\n\nWhen a project is added to Cypress, a `cypress.json` file is created in your project. This file contains your `projectId` and any configuration values you supply.\n\n[block:code]\n{\n    \"codes\": [\n        {\n            \"code\": \"{\\n  \\\"projectId\\\": \\\"128076ed-9868-4e98-9cef-98dd8b705d75\\\"\\n}\\n\",\n            \"language\": \"json\"\n        }\n    ]\n}\n[/block]\n\nBy modifying the following values you can change the default behavior of Cypress.\n\nHere is a list of available options and their default values.\n\n## Global\n\nOption | Default | Description\n----- | ---- | ----\n`baseUrl` | `null` | Base url to prefix to [`cy.visit`](https://on.cypress.io/api/visit) or [`cy.request`](https://on.cypress.io/api/request) command\n`env` | `{}` | [Environment Variables](https://on.cypress.io/guides/environment-variables)\n`ignoreTestFiles` | `*.hot-update.js` | A string or array of glob patterns for ignoring test files that would otherwise be shown in your tests list. Under the hood Cypress is using `minimatch` with the options: `{dot: true, matchBase: true}`. We suggest you using [http://globtester.com](http://globtester.com) to test what files would match.\n`port` |  | Port to use for Cypress\n`numTestsKeptInMemory` | `50` | The number of tests for which snapshots and command data are kept in memory. Reduce this number if you are seeing extremely high memory consumption in your browser.\n`reporter` | `spec` | The [reporter](https://on.cypress.io/guides/reporters) used during headless or CI runs\n`reporterOptions` | `null` | The [reporter options](https://on.cypress.io/guides/reporters#section-reporter-options) used. Supported options depend on the reporter.\n`screenshotOnHeadlessFailure` | `true` | Whether to take a screenshot automatically on test failure when running headlessly or in CI\n`watchForFileChanges` | `true` | Whether Cypress will watch and restart tests on file changes\n\n***\n\n## Timeouts\n\nOption | Default | Description\n----- | ---- | ----\n`defaultCommandTimeout` | `4000` | Time, in milliseconds, to wait until most DOM based commands are considered timed out\n`execTimeout` | `60000` | Time, in milliseconds, to wait for a system command to finish executing during [`cy.exec`](https://on.cypress.io/api/exec) command\n`pageLoadTimeout` | `60000` | Time, in milliseconds, to wait until [`cy.visit`](https://on.cypress.io/api/visit), [`cy.go`](https://on.cypress.io/api/go), [`cy.reload`](https://on.cypress.io/api/reload), or a page load times out\n`requestTimeout` | `5000` | Time, in milliseconds, to wait for an XHR request during [`cy.wait`](wait) command\n`responseTimeout` | `30000` | Time, in milliseconds, to wait until a response for [`cy.request`](https://on.cypress.io/api/request), [`cy.wait`](https://on.cypress.io/api/wait), [`cy.fixture`](https://on.cypress.io/api/fixture), [`cy.getCookie`](https://on.cypress.io/api/getcookie), [`cy.getCookies`](https://on.cypress.io/api/getcookies), [`cy.setCookie`](https://on.cypress.io/api/setcookie), [`cy.clearCookie`](https://on.cypress.io/api/clearcookie) and [`cy.clearCookies`](https://on.cypress.io/api/clearcookies), and [`cy.screenshot`](https://on.cypress.io/api/screenshot) commands\n\n***\n\n## Folders\n\nTo turn off the use of `fixture` folders, pass `false` into the configuration option.\n\nOption | Default | Description\n----- | ---- | ----\n`fixturesFolder`    | `cypress/fixtures`    | Where Cypress will look for fixture files\n`integrationFolder` | `cypress/integration` | Where Cypress will look for integration test files\n`supportFile` | `cypress/support` | Path to a file to load before your test files. File is compiled and bundled as test files are. Pass `false` to turn off.\n`screenshotsFolder`     | `cypress/screenshots`     | Where Cypress will automatically save screenshots from [`cy.screenshot()`](https://on.cypress.io/api/screenshot) or during test failures when running headlessly.\n`videosFolder`     | `cypress/videos`     | Where Cypress will automatically save the video of the test run when running headlessly.\n\n***\n\n## Screenshots\n\nOption | Default | Description\n----- | ---- | ----\n`screenshotsFolder`     | `cypress/screenshots`     | Where Cypress will automatically save screenshots from [`cy.screenshot()`](https://on.cypress.io/api/screenshot) or during test failures when running headlessly.\n`screenshotOnHeadlessFailure` | `true` | Whether Cypress will automatically take a screenshot when a test fails when running tests headlessly or in CI.\n`trashAssetsBeforeHeadlessRuns` | `true` | Whether Cypress will trash assets within the `screenshotsFolder` and `videosFolder` before headless test runs.\n\n***\n\n## Videos\n\nOption | Default | Description\n----- | ---- | ----\n`videoRecording`     | `true`     | Whether Cypress will record a video of the test run when running headlessly.\n`videoCompression` | `32` | The quality setting for the video compression, in Constant Rate Factor (CRF). The value can be `false` to disable compression or a value between `0` and `51`, where a lower value results in better quality (at the expense of a higher file size).\n`videosFolder`     | `cypress/videos`     | Where Cypress will automatically save the video of the test run when running headlessly.\n`trashAssetsBeforeHeadlessRuns` | `true` | Whether Cypress will trash assets within the `screenshotsFolder` and `videosFolder` before headless test runs.\n\n***\n\n## Browser\n\nOption | Default | Description\n----- | ---- | ----\n`chromeWebSecurity`    | true    | Whether Chome Web Security for `same-origin policy` and `insecure mixed content` is enabled. [Read more about this here.](https://on.cypress.io/guides/web-security)\n\n***\n\n## Web Server\n\nOption | Default | Description\n----- | ---- | ----\n`fileServerFolder`    | root project folder    | Where Cypress will attempt to serve your application files\n\n***\n\n## Viewport\n\nOption | Default | Description\n----- | ---- | ----\n`viewportWidth` | `1000` | Default width in pixels for [`cy.viewport`](https://on.cypress.io/api/viewport)\n`viewportHeight` | `660` | Default height in pixels for  [`cy.viewport`](https://on.cypress.io/api/viewport)\n\n***\n\n## Animations\n\nOption | Default | Description\n----- | ---- | ----\n`waitForAnimations` | `true` | Whether to wait for elements to finish animating before applying commands\n`animationDistanceThreshold` | `5` | The distance in pixels an element must exceed to be considered animating\n\n***\n\n# Overriding Options\n\nBesides modifying your `cypress.json` you can also change configuration options by the **Command Line** or from your system **Environment Variabes**.\n\n## Command Line\n\nWhen [running Cypress from the Command Line](https://github.com/cypress-io/cypress-cli#cypress-open-1) you can pass the `--config` flag.\n\nBe sure to separate multiple values with a **comma**.\n\nExample:\n\n[block:code]\n{\n    \"codes\": [\n        {\n            \"code\": \"## you can pass --config to cypress open or cypress run\\ncypress open --config watchForFileChanges=false,waitForAnimations=false\\n\\ncypress run --config integrationFolder=tests,fixturesFolder=false\\n\\ncypress run --record --config viewportWidth=1280,viewportHeight=720\\n\",\n            \"language\": \"shell\"\n        }\n    ]\n}\n[/block]\n\n***\n\n## Environment Variables\n\nYou can also use environment variables to override configuration values. This is especially useful in CI or when working locally. This gives you the ability to change configuration options without modifying any code or build scripts.\n\nBy default, any environment variable that matches a cooresponding configuration key will override its default value.\n\n[block:code]\n{\n    \"codes\": [\n        {\n            \"code\": \"## change the viewport width + height with environment variables\\nexport CYPRESS_VIEWPORT_WIDTH=800\\nexport CYPRESS_VIEWPORT_HEIGHT=600\\n\",\n            \"language\": \"shell\"\n        }\n    ]\n}\n[/block]\n\nWe automatically normalize both the key and the value.\n\nKeys are automatically camel cased, and we will automatically convert values into `Number` and `Boolean`.\n\n[block:code]\n{\n    \"codes\": [\n        {\n            \"code\": \"## both of these are valid\\nexport CYPRESS_pageLoadTimeout=100000\\nexport CYPRESS_PAGE_LOAD_TIMEOUT=100000\\n\",\n            \"language\": \"shell\"\n        }\n    ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Make sure to prefix your environment variables with **CYPRESS_** else they will be ignored.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Environment variables which do not match configuration keys will instead be set as regular environment variables for use in your tests with `Cypress.env()`.\\n\\nYou can [read more about Environment Variables](https://on.cypress.io/environment-variables).\"\n}\n[/block]\n\n***\n\n# Resolved Configuration\n\nWhen you open a Cypress project, we will display the resolved configuration to you.\n\nThis makes it easy to understand and see where different values came from.\n\n![Resolved Configuration](https://cloud.githubusercontent.com/assets/1271364/22704601/47c9881e-ed36-11e6-81a0-725778038902.png)","excerpt":"Configure global, network, folder, viewport, and animation options","slug":"configuration","type":"basic","title":"Configuration"}

Configuration

Configure global, network, folder, viewport, and animation options

# Contents - :fa-angle-right: [Configuration Options](#section-configuration-options) - [Global](#section-global) - [Timeouts](#section-timeouts) - [Folders](#section-folders) - [Screenshots](#section-screenshots) - [Videos](#section-videos) - [Browser](#section-browser) - [Web Server](#section-web-server) - [Viewport](#section-viewport) - [Animation](#section-animation) - :fa-angle-right: [Overriding Options](#section-overriding-options) - [Command Line](#section-command-line) - [Environment Variables](#section-environment-variables) - :fa-angle-right: [Resolved Configuration](#section-resolved-configuration) *** # Configuration Options When a project is added to Cypress, a `cypress.json` file is created in your project. This file contains your `projectId` and any configuration values you supply. [block:code] { "codes": [ { "code": "{\n \"projectId\": \"128076ed-9868-4e98-9cef-98dd8b705d75\"\n}\n", "language": "json" } ] } [/block] By modifying the following values you can change the default behavior of Cypress. Here is a list of available options and their default values. ## Global Option | Default | Description ----- | ---- | ---- `baseUrl` | `null` | Base url to prefix to [`cy.visit`](https://on.cypress.io/api/visit) or [`cy.request`](https://on.cypress.io/api/request) command `env` | `{}` | [Environment Variables](https://on.cypress.io/guides/environment-variables) `ignoreTestFiles` | `*.hot-update.js` | A string or array of glob patterns for ignoring test files that would otherwise be shown in your tests list. Under the hood Cypress is using `minimatch` with the options: `{dot: true, matchBase: true}`. We suggest you using [http://globtester.com](http://globtester.com) to test what files would match. `port` | | Port to use for Cypress `numTestsKeptInMemory` | `50` | The number of tests for which snapshots and command data are kept in memory. Reduce this number if you are seeing extremely high memory consumption in your browser. `reporter` | `spec` | The [reporter](https://on.cypress.io/guides/reporters) used during headless or CI runs `reporterOptions` | `null` | The [reporter options](https://on.cypress.io/guides/reporters#section-reporter-options) used. Supported options depend on the reporter. `screenshotOnHeadlessFailure` | `true` | Whether to take a screenshot automatically on test failure when running headlessly or in CI `watchForFileChanges` | `true` | Whether Cypress will watch and restart tests on file changes *** ## Timeouts Option | Default | Description ----- | ---- | ---- `defaultCommandTimeout` | `4000` | Time, in milliseconds, to wait until most DOM based commands are considered timed out `execTimeout` | `60000` | Time, in milliseconds, to wait for a system command to finish executing during [`cy.exec`](https://on.cypress.io/api/exec) command `pageLoadTimeout` | `60000` | Time, in milliseconds, to wait until [`cy.visit`](https://on.cypress.io/api/visit), [`cy.go`](https://on.cypress.io/api/go), [`cy.reload`](https://on.cypress.io/api/reload), or a page load times out `requestTimeout` | `5000` | Time, in milliseconds, to wait for an XHR request during [`cy.wait`](wait) command `responseTimeout` | `30000` | Time, in milliseconds, to wait until a response for [`cy.request`](https://on.cypress.io/api/request), [`cy.wait`](https://on.cypress.io/api/wait), [`cy.fixture`](https://on.cypress.io/api/fixture), [`cy.getCookie`](https://on.cypress.io/api/getcookie), [`cy.getCookies`](https://on.cypress.io/api/getcookies), [`cy.setCookie`](https://on.cypress.io/api/setcookie), [`cy.clearCookie`](https://on.cypress.io/api/clearcookie) and [`cy.clearCookies`](https://on.cypress.io/api/clearcookies), and [`cy.screenshot`](https://on.cypress.io/api/screenshot) commands *** ## Folders To turn off the use of `fixture` folders, pass `false` into the configuration option. Option | Default | Description ----- | ---- | ---- `fixturesFolder` | `cypress/fixtures` | Where Cypress will look for fixture files `integrationFolder` | `cypress/integration` | Where Cypress will look for integration test files `supportFile` | `cypress/support` | Path to a file to load before your test files. File is compiled and bundled as test files are. Pass `false` to turn off. `screenshotsFolder` | `cypress/screenshots` | Where Cypress will automatically save screenshots from [`cy.screenshot()`](https://on.cypress.io/api/screenshot) or during test failures when running headlessly. `videosFolder` | `cypress/videos` | Where Cypress will automatically save the video of the test run when running headlessly. *** ## Screenshots Option | Default | Description ----- | ---- | ---- `screenshotsFolder` | `cypress/screenshots` | Where Cypress will automatically save screenshots from [`cy.screenshot()`](https://on.cypress.io/api/screenshot) or during test failures when running headlessly. `screenshotOnHeadlessFailure` | `true` | Whether Cypress will automatically take a screenshot when a test fails when running tests headlessly or in CI. `trashAssetsBeforeHeadlessRuns` | `true` | Whether Cypress will trash assets within the `screenshotsFolder` and `videosFolder` before headless test runs. *** ## Videos Option | Default | Description ----- | ---- | ---- `videoRecording` | `true` | Whether Cypress will record a video of the test run when running headlessly. `videoCompression` | `32` | The quality setting for the video compression, in Constant Rate Factor (CRF). The value can be `false` to disable compression or a value between `0` and `51`, where a lower value results in better quality (at the expense of a higher file size). `videosFolder` | `cypress/videos` | Where Cypress will automatically save the video of the test run when running headlessly. `trashAssetsBeforeHeadlessRuns` | `true` | Whether Cypress will trash assets within the `screenshotsFolder` and `videosFolder` before headless test runs. *** ## Browser Option | Default | Description ----- | ---- | ---- `chromeWebSecurity` | true | Whether Chome Web Security for `same-origin policy` and `insecure mixed content` is enabled. [Read more about this here.](https://on.cypress.io/guides/web-security) *** ## Web Server Option | Default | Description ----- | ---- | ---- `fileServerFolder` | root project folder | Where Cypress will attempt to serve your application files *** ## Viewport Option | Default | Description ----- | ---- | ---- `viewportWidth` | `1000` | Default width in pixels for [`cy.viewport`](https://on.cypress.io/api/viewport) `viewportHeight` | `660` | Default height in pixels for [`cy.viewport`](https://on.cypress.io/api/viewport) *** ## Animations Option | Default | Description ----- | ---- | ---- `waitForAnimations` | `true` | Whether to wait for elements to finish animating before applying commands `animationDistanceThreshold` | `5` | The distance in pixels an element must exceed to be considered animating *** # Overriding Options Besides modifying your `cypress.json` you can also change configuration options by the **Command Line** or from your system **Environment Variabes**. ## Command Line When [running Cypress from the Command Line](https://github.com/cypress-io/cypress-cli#cypress-open-1) you can pass the `--config` flag. Be sure to separate multiple values with a **comma**. Example: [block:code] { "codes": [ { "code": "## you can pass --config to cypress open or cypress run\ncypress open --config watchForFileChanges=false,waitForAnimations=false\n\ncypress run --config integrationFolder=tests,fixturesFolder=false\n\ncypress run --record --config viewportWidth=1280,viewportHeight=720\n", "language": "shell" } ] } [/block] *** ## Environment Variables You can also use environment variables to override configuration values. This is especially useful in CI or when working locally. This gives you the ability to change configuration options without modifying any code or build scripts. By default, any environment variable that matches a cooresponding configuration key will override its default value. [block:code] { "codes": [ { "code": "## change the viewport width + height with environment variables\nexport CYPRESS_VIEWPORT_WIDTH=800\nexport CYPRESS_VIEWPORT_HEIGHT=600\n", "language": "shell" } ] } [/block] We automatically normalize both the key and the value. Keys are automatically camel cased, and we will automatically convert values into `Number` and `Boolean`. [block:code] { "codes": [ { "code": "## both of these are valid\nexport CYPRESS_pageLoadTimeout=100000\nexport CYPRESS_PAGE_LOAD_TIMEOUT=100000\n", "language": "shell" } ] } [/block] [block:callout] { "type": "info", "body": "Make sure to prefix your environment variables with **CYPRESS_** else they will be ignored." } [/block] [block:callout] { "type": "warning", "body": "Environment variables which do not match configuration keys will instead be set as regular environment variables for use in your tests with `Cypress.env()`.\n\nYou can [read more about Environment Variables](https://on.cypress.io/environment-variables)." } [/block] *** # Resolved Configuration When you open a Cypress project, we will display the resolved configuration to you. This makes it easy to understand and see where different values came from. ![Resolved Configuration](https://cloud.githubusercontent.com/assets/1271364/22704601/47c9881e-ed36-11e6-81a0-725778038902.png)