From b516d7170ab083127fc258b8130c5e6445b6fdd8 Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Fri, 23 Aug 2019 12:49:15 -0400 Subject: [PATCH 01/33] Add blank 3.5.0 changelog --- source/_changelogs/3.5.0.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 source/_changelogs/3.5.0.md diff --git a/source/_changelogs/3.5.0.md b/source/_changelogs/3.5.0.md new file mode 100644 index 0000000000..4feb47abc9 --- /dev/null +++ b/source/_changelogs/3.5.0.md @@ -0,0 +1,13 @@ +# 3.5.0 + +*Released X/X/2019* + +**Features:** + +**Bugfixes:** + +**Misc:** + +**Documentation Changes:** + +**Dependency Updates** From 6d988c6e30af25b0f11c6585b5d14d4e15c3362b Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Fri, 23 Aug 2019 12:54:21 -0400 Subject: [PATCH 02/33] Add loopback proxy config was originally in #1950 --- source/guides/references/proxy-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/guides/references/proxy-configuration.md b/source/guides/references/proxy-configuration.md index a70798ed63..99b6a3b590 100644 --- a/source/guides/references/proxy-configuration.md +++ b/source/guides/references/proxy-configuration.md @@ -69,7 +69,7 @@ This section refers to your operating system's environment variables, *not* {% u Cypress automatically reads from your system's `HTTP_PROXY` environment variable and uses that proxy for all HTTP and HTTPS traffic. If an `HTTPS_PROXY` environment variable is set, HTTPS traffic will use that proxy instead. -To bypass the proxy for certain domains, a `NO_PROXY` environment variable can be set to a comma-separated list of domain names to not proxy traffic for. By default, traffic to `localhost` will not be proxied. +To bypass the proxy for certain domains, a `NO_PROXY` environment variable can be set to a comma-separated list of domain names to not proxy traffic for. By default, traffic to `localhost` will not be proxied. To make Cypress send traffic for `localhost` through the proxy, pass `<-loopback>` in `NO_PROXY`. If an uppercase and a lowercase version of the proxy settings are supplied (for example, `HTTP_PROXY` and `http_proxy` are both set), the lowercase variable will be preferred. From b42cfa44cd5cb2c5d169174f326ca010fbfa8d64 Mon Sep 17 00:00:00 2001 From: Clare So Date: Fri, 23 Aug 2019 16:19:46 -0400 Subject: [PATCH 03/33] Add note for opening a local file. (#1990) Co-authored-by: Jennifer Shehane --- source/api/commands/visit.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/api/commands/visit.md b/source/api/commands/visit.md index ffd7ff08a2..07cde77d3f 100644 --- a/source/api/commands/visit.md +++ b/source/api/commands/visit.md @@ -24,6 +24,7 @@ cy.visit(options) ```javascript cy.visit('http://localhost:3000') // Yields the window of the remote page +cy.visit('./pages/hello.html') ``` ## Arguments @@ -34,6 +35,9 @@ The URL to visit. Cypress will prefix the URL with the `baseUrl` configured in your {% url 'network options' configuration#Global %} if you've set one. +You may also specify the relative path of an html file. The path is relative to the root +directory of the Cypress installation. Note that the `file://` prefix is not needed. + **{% fa fa-angle-right %} options** ***(Object)*** Pass in an options object to control the behavior of `cy.visit()`. From d8d9b67be1de10f6bd0bf9b09af347b007751e0f Mon Sep 17 00:00:00 2001 From: ccodecamp <8499102+ccodecamp@users.noreply.github.com> Date: Wed, 28 Aug 2019 02:34:21 +1000 Subject: [PATCH 04/33] Adding documentation for addition of presets for following viewports * Adding documentation for addition of presets for following viewports: 1) iPhone-XR, 2) iPhone-X, 3) Samsung-S10, 4) Samsung-Note9 * Update source/api/commands/viewport.md Thank-you :) Co-Authored-By: Jennifer Shehane Co-authored-by: null Co-authored-by: Jennifer Shehane --- source/api/commands/viewport.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/api/commands/viewport.md b/source/api/commands/viewport.md index 91851aa45f..6ae95e43b9 100644 --- a/source/api/commands/viewport.md +++ b/source/api/commands/viewport.md @@ -47,11 +47,15 @@ A preset dimension to set the viewport. Preset supports the following options: | `macbook-11` | 1366 | 768 | | `ipad-2` | 768 | 1024 | | `ipad-mini` | 768 | 1024 | +| `iphone-xr` | 414 | 896 | +| `iphone-x` | 375 | 812 | | `iphone-6+` | 414 | 736 | | `iphone-6` | 375 | 667 | | `iphone-5` | 320 | 568 | | `iphone-4` | 320 | 480 | | `iphone-3` | 320 | 480 | +| `samsung-s10` | 360 | 760 | +| `samsung-note9` | 414 | 846 | **{% fa fa-angle-right %} orientation** ***(String)*** From 87b1b69416699d3783e2d1e98d4efd7ecc0cf352 Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Tue, 27 Aug 2019 12:37:35 -0400 Subject: [PATCH 05/33] Add note in 'history' of viewport indicating the version new presets were added - alphabetize preset options --- source/api/commands/viewport.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/source/api/commands/viewport.md b/source/api/commands/viewport.md index 6ae95e43b9..21095958ab 100644 --- a/source/api/commands/viewport.md +++ b/source/api/commands/viewport.md @@ -42,20 +42,20 @@ A preset dimension to set the viewport. Preset supports the following options: | Preset | width | height | | ----------- | ----- | ------ | -| `macbook-15` | 1440 | 900 | -| `macbook-13` | 1280 | 800 | -| `macbook-11` | 1366 | 768 | | `ipad-2` | 768 | 1024 | | `ipad-mini` | 768 | 1024 | -| `iphone-xr` | 414 | 896 | -| `iphone-x` | 375 | 812 | -| `iphone-6+` | 414 | 736 | -| `iphone-6` | 375 | 667 | -| `iphone-5` | 320 | 568 | -| `iphone-4` | 320 | 480 | | `iphone-3` | 320 | 480 | -| `samsung-s10` | 360 | 760 | +| `iphone-4` | 320 | 480 | +| `iphone-5` | 320 | 568 | +| `iphone-6` | 375 | 667 | +| `iphone-6+` | 414 | 736 | +| `iphone-x` | 375 | 812 | +| `iphone-xr` | 414 | 896 | +| `macbook-11` | 1366 | 768 | +| `macbook-13` | 1280 | 800 | +| `macbook-15` | 1440 | 900 | | `samsung-note9` | 414 | 846 | +| `samsung-s10` | 360 | 760 | **{% fa fa-angle-right %} orientation** ***(String)*** @@ -240,6 +240,7 @@ When clicking on `viewport` within the command log, the console outputs the foll {% imgTag /img/api/viewport/console-log-shows-width-and-height-of-tested-viewport.png "Console Log viewport" %} {% history %} +{% url "3.5.0" changelog#0-9-0 %} | Added support for presets `iphone-xr`, `iphone-x`, `samsung-s10`, and `samsung-note9` {% url "0.9.0" changelog#0-9-0 %} | `cy.viewport()` command added {% endhistory %} From ae24e63b117b03efab4d386a5bb3ae86f6f79f9e Mon Sep 17 00:00:00 2001 From: Zach Bloomquist Date: Tue, 17 Sep 2019 16:40:59 -0400 Subject: [PATCH 06/33] Add cy.visit() qs option (#2042) --- source/api/commands/visit.md | 1 + 1 file changed, 1 insertion(+) diff --git a/source/api/commands/visit.md b/source/api/commands/visit.md index 07cde77d3f..e9c050990d 100644 --- a/source/api/commands/visit.md +++ b/source/api/commands/visit.md @@ -48,6 +48,7 @@ Option | Default | Description `method` | `GET` | The HTTP method to use in the visit. Can be `GET` or `POST`. `body` | `null` | An optional body to send along with a `POST` request. If it is a string, it will be passed along unmodified. If it is an object, it will be URL encoded to a string and sent with a `Content-Type: application/x-www-urlencoded` header. `headers` | `{}` | An object that maps HTTP header names to values to be sent along with the request. *Note:* `headers` will only be sent for the initial `cy.visit()` request, not for any subsequent requests. +`qs` | `null` | Query parameters to append to the `url` of the request `log` | `true` | {% usage_options log %} `auth` | `null` | Adds Basic Authorization headers `failOnStatusCode` | `true` | Whether to fail on response codes other than `2xx` and `3xx` From b27cf76a443436e89b3891acb68e86652dacabec Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Tue, 24 Sep 2019 12:32:11 -0400 Subject: [PATCH 07/33] Add examples of using the qs arg to pass in query parameters. --- source/api/commands/visit.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/source/api/commands/visit.md b/source/api/commands/visit.md index e9c050990d..d68bff2dc6 100644 --- a/source/api/commands/visit.md +++ b/source/api/commands/visit.md @@ -145,6 +145,29 @@ cy.visit('http://localhost:3000/#/users', { }) ``` +### Add query paramaters + +You can provide query parameters as an object to `cy.visit()` by passing `qs` to `options`. + +```js +// visits http://localhost:3500/users?page=1&role=admin +cy.visit('http://localhost:3500/users', { + qs: { + page: '1', + role: 'admin' + } +}) +``` + +The parameters passed to `qs` will be merged into existing query parameters on the `url`. + +```js +// visits http://example.com/users?page=1&admins +cy.visit('http://example.com/users?page=1', { + qs: { 'admins' } +}) +``` + ### Submit a form To send a request that looks like a user submitting an HTML form, use a `POST` method with a `body` containing the form values: From 92b93fac6ad4052e3a4e417036165b710757dea6 Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Tue, 1 Oct 2019 18:02:10 -0400 Subject: [PATCH 08/33] Began writing changelog for 3.5.0 --- source/_changelogs/3.5.0.md | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/source/_changelogs/3.5.0.md b/source/_changelogs/3.5.0.md index 4feb47abc9..49cefb0018 100644 --- a/source/_changelogs/3.5.0.md +++ b/source/_changelogs/3.5.0.md @@ -4,10 +4,59 @@ **Features:** +- Cypress app crash: "port" option should be a number or string {% issue 3250 %} +- Support `NO_PROXY=<-loopback>`, always have `NO_PROXY=localhost` otherwise {% issue 4780 %} +- CSS problems on plugins error {% issue 4959 %} +- moved Simulated click fixes {% issue 2956 %} +- Handle browser not found object better {% issue 4966 %} +- Error: Could not start Xvfb. Install Xvfb and run Cypress again. {% issue 5110 %} +- `cy.visit()` results in ERR_SSL_VERSION_OR_CIPHER_MISMATCH {% issue 771 %} +- `cy.visit()` and URL encoding {% issue 5034 %} +- validate inputs to "cy" commands better {% issue 2953 %} +- {% url "`cy.viewport()`" viewport %} now allows for viewport sizes up to 4,000 pixels. {% issue 5181 %} +- {% url "`cy.viewport()`" viewport %} accepts new size presets for `iphone-xr`, `iphone-x`, `samsung-s10` and `samsung-note9`. Addresses {% issue 4967 %}. +- Bundled Node Version 8.2 is too old {% issue 2253 %} +- Large XHR response objects can exceed the maximum header size. {% issue 76 %} +- Upgrade to the latest version of Electron {% issue 3568 %} +- write EPROTO: SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure when visiting https site {% issue4394 %} +- Cookies are not sent using fetch from electron client {% issue 4433 %} +- Using apollo-client breaks the tests when run with electron {% issue 5044 %} +- Fix bug where Chrome policy warnings are not active {% issue 4986 %} +- ECC SSL Certificates not supported {% issue 4368 %} +- Add `--config-file` CLI argument {% issue 1369 %} +- Random failures over Regexp: Invalid regular expression {% issue 1746 %} +- Correct reason not visible when element is detached from DOM {% issue 4946 %} +- Should not truncate full url during {% url "`cy.request()`" request %} in stdout {% issue 3145 %} +- Allow using external Node when running tasks / plugins {% issue 4432 %} + **Bugfixes:** +- Selector Playground doesn't highlight element currently being hovered over {% issue 4872 %} +- `Cypress.env()` now properly escapes `` tags in the configuration file {% issue 4952 %} +- `response.body` isn't converted to JSON if `content-type` is `application/vnd.api+json` {% issue 5165 %} +- `dest.end` error crash during run exit on GitLab CI / Windows {% issue 2181 %} +- `onFocus` event incorrectly fires on a hidden element starting on v3.3.2 {% issue 4898 %} +- jQuery v3 types are looking for Sizzle types {% issue 5245 %} +- Cypress + TypeScript 3.6.2 errors due to outdated jQuery types {% issue 5065 %} +- Cannot click on `readonly` inputs / textarea {% issue 4874 %} +- Test runs infinitely with combination of async error, 'fail' event, and `done` callback, Cypress hangs up when using `done` within a `before` hook after `cy.request`. `beforeEach` with `done` causes tests to hang indefinitely when `done()` called in `promise.then()`.Mixing `cy.on()`/`cy.once()` with a one-argument `it()` function causes test to hang. Addresses {% issue 1075 %}, {% issue 2478 %}, {% issue 3349 %}, and {% issue 4790 %}. + **Misc:** +- We now warn when using `cypress run` from the binary directly (not from an npm module) since this is not its intended use. Addresses {% issue 1573 %}. +- We now warn on {% url "`cy.visit('file://...)`" visit %} to explain that this url format is not supported and suggest visiting relative HTML file. Addresses {% issue 4452 %}. +- Setting `CYPRESS_ENV` to an unexpected value leads will not throw an error {% issue 1621 %} +- Scrolling the specs list now only scrolls the list of spec files and no longer scrolls the search and filter bar. Addresses {% issue 4904 %}. +- We fixed some layout issues within the Test Runner that were introduced in {% url "3.4.1" changelog#3-4-1 %}. Addresses {% issue 4888 %}, {% issue 4912 %}, and {% issue 4959 %}. +- Stub / spy counter badge is cut off {% issue 4822 %} +- We're continuing to make process in converting our codebase from CoffeeScript to JavaScript. Addresses {% issue 2690 %} in {% PR 5107 %}. + **Documentation Changes:** **Dependency Updates** + +- Upgraded `electron` from `2.0.18` to `5.0.10`. Addressed in {% PR 4720 %}. +- Upgraded `node` from `8.9.3` to `12.4.0`. Addressed in {% PR 4720 %}. +- Upgaded `jquery` from `2.2.4` to `3.1.1`. Addressed in {% PR 1229 %}. +- Upgraded `sanitize-filename` from `1.6.1` to `1.6.3`. Addressed in {% PR 5216 %}. +- Upgraded `@cypress/get-windows-proxy` from `1.5.4` to `1.6.0`. Addressed in {% PR 5108 %}. From 66a7fd163f78f522cc1637b4450adffe1241bd4f Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Wed, 2 Oct 2019 12:03:49 -0400 Subject: [PATCH 09/33] Document config-file argument (#1630) * Update docs to include 'config-file' flag + refer to any use of 'cypress.json' as configuration file instead. * package-lock * fix grammar / typo * add configFile to module-api * Revert package-lock.json Co-authored-by: Zach Bloomquist --- source/api/commands/exec.md | 4 +- source/api/commands/readfile.md | 4 +- source/api/commands/request.md | 3 +- source/api/commands/task.md | 2 +- source/api/commands/viewport.md | 2 +- source/api/commands/visit.md | 6 +- source/api/commands/writefile.md | 2 +- source/api/cypress-api/config.md | 8 +-- source/api/cypress-api/custom-commands.md | 2 +- source/api/cypress-api/env.md | 24 ++++--- source/examples/examples/recipes.md | 2 +- source/faq/questions/using-cypress-faq.md | 6 +- .../writing-and-organizing-tests.md | 16 ++--- .../getting-started/testing-your-app.md | 4 +- source/guides/guides/command-line.md | 62 +++++++++++++++---- .../guides/guides/continuous-integration.md | 2 +- source/guides/guides/environment-variables.md | 21 +++---- source/guides/guides/module-api.md | 46 +++++++------- source/guides/guides/web-security.md | 4 +- source/guides/references/best-practices.md | 4 +- source/guides/references/configuration.md | 12 ++-- source/guides/references/error-messages.md | 10 ++- .../tooling/intelligent-code-completion.md | 4 +- source/guides/tooling/plugins-guide.md | 2 +- source/guides/tooling/reporters.md | 28 ++++++++- 25 files changed, 167 insertions(+), 113 deletions(-) diff --git a/source/api/commands/exec.md b/source/api/commands/exec.md index 6120d6d7db..1a8a25bfec 100644 --- a/source/api/commands/exec.md +++ b/source/api/commands/exec.md @@ -29,7 +29,7 @@ cy.exec('npm run build') **{% fa fa-angle-right %} command** ***(String)*** -The system command to be executed from the project root (the directory that contains `cypress.json`). +The system command to be executed from the project root (the directory that contains the default `cypress.json` configuration file). **{% fa fa-angle-right %} options** ***(Object)*** @@ -156,7 +156,7 @@ A command must exit within the `execTimeout` or Cypress will kill the command's # Command Log -***List the contents of cypress.json*** +***List the contents of the default `cypress.json` configuration file*** ```javascript if (Cypress.platform === 'win32') { diff --git a/source/api/commands/readfile.md b/source/api/commands/readfile.md index 390740cf4f..78cffa2830 100644 --- a/source/api/commands/readfile.md +++ b/source/api/commands/readfile.md @@ -25,7 +25,7 @@ cy.readFile('menu.json') **{% fa fa-angle-right %} filePath** ***(String)*** -A path to a file within the project root (the directory that contains `cypress.json`). +A path to a file within the project root (the directory that contains the default `cypress.json` configuration file). **{% fa fa-angle-right %} encoding** ***(String)*** @@ -192,7 +192,7 @@ cy.readFile('some/nested/path/story.txt').should('eq', 'Once upon a time...') # Command Log -***List the contents of cypress.json*** +***List the contents of the default `cypress.json` configuration file*** ```javascript cy.readFile('cypress.json') diff --git a/source/api/commands/request.md b/source/api/commands/request.md index c74a15f240..5bd71647a8 100644 --- a/source/api/commands/request.md +++ b/source/api/commands/request.md @@ -37,11 +37,10 @@ cy.visit('http://localhost:8080/app') cy.request('users/1.json') // url is http://localhost:8080/users/1.json ``` -2. If you make a `cy.request()` prior to visiting a page, Cypress uses the host configured as the `baseUrl` property inside of `cypress.json`. +2. If you make a `cy.request()` prior to visiting a page, Cypress uses the host configured as the `baseUrl` property inside of of your {% url "configuration file" configuration %}. ```json // cypress.json - { "baseUrl": "http://localhost:1234" } diff --git a/source/api/commands/task.md b/source/api/commands/task.md index bcea90b8ea..41be8b6f74 100644 --- a/source/api/commands/task.md +++ b/source/api/commands/task.md @@ -249,7 +249,7 @@ If multiple task objects use the same key, the later registration will overwrite # Command Log -***List the contents of `cypress.json`*** +### List the contents of the default `cypress.json` configuration file ```javascript cy.task('readJson', 'cypress.json') diff --git a/source/api/commands/viewport.md b/source/api/commands/viewport.md index 21095958ab..1fa1f32143 100644 --- a/source/api/commands/viewport.md +++ b/source/api/commands/viewport.md @@ -181,7 +181,7 @@ When hovering over each command, Cypress will automatically display the snapshot By default, until you issue a `cy.viewport()` command, Cypress sets the width to `1000px` and the height to `660px` by default. -You can {% url 'change these default dimensions' configuration#Viewport %} by adding the following to your `cypress.json`: +You can {% url 'change these default dimensions' configuration#Viewport %} by adding the following to your configuration file (`cypress.json` by default): ```json { diff --git a/source/api/commands/visit.md b/source/api/commands/visit.md index d68bff2dc6..94fbc4d931 100644 --- a/source/api/commands/visit.md +++ b/source/api/commands/visit.md @@ -212,7 +212,7 @@ cy.visit('127.0.0.1:3000') // Visits http://127.0.0.1:3000 ### Cypress can optionally act as your web server -Cypress will automatically attempt to serve your files if you don't provide a host. The path should be relative to your project's root folder (where `cypress.json` is located). +Cypress will automatically attempt to serve your files if you don't provide a host. The path should be relative to your project's root folder (where the `cypress.json` file is generated by default). Having Cypress serve your files is useful in simple projects and example apps, but isn't recommended for real apps. It is always better to run your own server and provide the url to Cypress. @@ -222,9 +222,9 @@ cy.visit('app/index.html') ## Prefixes -### Visit is automatically prefixed with `baseUrl`. +### Visit is automatically prefixed with `baseUrl` -Configure `baseUrl` in the `cypress.json` file to prevent repeating yourself in every single `cy.visit()` command. Read more about {% url 'configuration' configuration %}. +Configure `baseUrl` in the your {% url 'configuration' configuration %} file (`cypress.json` by default) to prevent repeating yourself in every `cy.visit()` command. ```json { diff --git a/source/api/commands/writefile.md b/source/api/commands/writefile.md index f305646db6..e2a818a7d4 100644 --- a/source/api/commands/writefile.md +++ b/source/api/commands/writefile.md @@ -24,7 +24,7 @@ cy.writeFile('menu.json') **{% fa fa-angle-right %} filePath** ***(String)*** -A path to a file within the project root (the directory that contains `cypress.json`). +A path to a file within the project root (the directory that contains the default `cypress.json`). **{% fa fa-angle-right %} contents** ***(String, Array, or Object)*** diff --git a/source/api/cypress-api/config.md b/source/api/cypress-api/config.md index 240ba93461..3ebc285660 100644 --- a/source/api/cypress-api/config.md +++ b/source/api/cypress-api/config.md @@ -45,7 +45,7 @@ Set multiple configuration options with an object literal. ## No Arguments -### Get all configuration options +### Get all configuration options from {% url 'configuration' configuration %} file (`cypress.json` by default) ```json { @@ -62,7 +62,7 @@ Cypress.config() // => {defaultCommandTimeout: 10000, pageLoadTimeout: 30000, .. ## Name -### Return just a single configuration option value +### Return a single configuration option from {% url 'configuration' configuration %} file (`cypress.json` by default) ```json { @@ -76,7 +76,7 @@ Cypress.config('pageLoadTimeout') // => 60000 ## Name and Value -### Change the values of your configuration options from within tests +### Change the values of configuration options from configuration file (`cypress.json` by default) from within your tests {% note warning Scope %} Remember, any changes that you make to configuration using this API will only be in effect for the remainder of the tests _in the same spec file._ @@ -97,7 +97,7 @@ Cypress.config('viewportWidth') // => 800 ## Object -### Set multiple values by passing an object literal +### Override multiple options from configuration file (`cypress.json` by default) by passing an object literal ```json { diff --git a/source/api/cypress-api/custom-commands.md b/source/api/cypress-api/custom-commands.md index fc82683f05..40b055cd64 100644 --- a/source/api/cypress-api/custom-commands.md +++ b/source/api/cypress-api/custom-commands.md @@ -262,7 +262,7 @@ Cypress.Commands.overwrite('visit', (originalFn, url, options) => { {% note info %} We see many of our users creating their own `visitApp` command. We commonly see that all you're doing is swapping out base urls for `development` vs `production` environments. -This is usually unnecessary because Cypress is already configured to swap out baseUrl's that both `cy.visit()` and `cy.request()` use. Just set the `baseUrl` config property in `cypress.json` and override it with environment variable `CYPRESS_BASE_URL`. +This is usually unnecessary because Cypress is already configured to swap out baseUrl's that both `cy.visit()` and `cy.request()` use. Set the `baseUrl` configuration property in your {% url "configuration" configuration %} file (`cypress.json` by default) and override it with environment variable `CYPRESS_BASE_URL`. For more complex use cases feel free to overwrite existing commands. {% endnote %} diff --git a/source/api/cypress-api/env.md b/source/api/cypress-api/env.md index 72c569e250..84d066ab68 100644 --- a/source/api/cypress-api/env.md +++ b/source/api/cypress-api/env.md @@ -41,10 +41,9 @@ Set multiple environment variables with an object literal. ## No Arguments -**Get all environment variables.** +### Get all environment variables from configuration file (`cypress.json` by default) -```javascript -// cypress.json +```json { "env": { "foo": "bar", @@ -59,10 +58,9 @@ Cypress.env() // => {foo: "bar", baz: "quux"} ## Name -**Return a single environment variable value.** +### Return a single environment variable from configuration file (`cypress.json` by default) -```javascript -// cypress.json +```json { "env": { "foo": "bar", @@ -78,14 +76,13 @@ Cypress.env('baz') // => quux ## Name and Value -**Cypress allows you to change the values of your environment variables from within your tests.** +### Change environment variables from configuration file (`cypress.json` by default) from within your tests {% note warning Scope %} Remember, any changes that you make to environment variables using this API will only be in effect for the remainder of the tests _in the same spec file._ {% endnote %} -```javascript -// cypress.json +```json { "env": { "foo": "bar", @@ -102,7 +99,7 @@ Cypress.env('host') // => http://server.dev.local ## Object -**You can set multiple values by passing an object literal.** +### Override multiple values from configuration file (`cypress.json` by default) by passing an object literal. ```javascript // cypress.json @@ -140,6 +137,7 @@ module.exports = (on, config) => { return config } ``` + ```js // cypress/integration/secrets_spec.js describe('Environment variable set in plugin', () => { @@ -158,17 +156,17 @@ describe('Environment variable set in plugin', () => { # Notes -**Why would I ever need to use environment variables?** +## Why would I ever need to use environment variables? The {% url 'Environment Variables' environment-variables %} guide explains common use cases. -**Can I pass in environment variables from the command line?** +## Can I pass in environment variables from the command line? Yes. You can do that and much more. The {% url 'Environment Variables' environment-variables %} guide explains the other ways you can set environment variables for your tests. -**Why is it `Cypress.env` and not `cy.env`?** +## Why is it `Cypress.env` and not `cy.env`? As a rule of thumb anything you call from `Cypress` affects global state. Anything you call from `cy` affects local state. diff --git a/source/examples/examples/recipes.md b/source/examples/examples/recipes.md index b6d264eccd..ea360bc3a3 100644 --- a/source/examples/examples/recipes.md +++ b/source/examples/examples/recipes.md @@ -88,4 +88,4 @@ Recipe | Description {% url 'Visual Regression Testing' https://github.com/mjhea0/cypress-visual-regression %} | Adding visual regression testing to Cypress {% url 'Code coverage' https://github.com/paulfalgout/cypress-coverage-example %} | Cypress with Coverage reports {% url 'Cucumber' https://github.com/TheBrainFamily/cypress-cucumber-example %} | Example usage of Cypress with Cucumber -{% url 'Jest' https://github.com/TheBrainFamily/jest-runner-cypress-example %} | Example for the jest-runner-cypress \ No newline at end of file +{% url 'Jest' https://github.com/TheBrainFamily/jest-runner-cypress-example %} | Example for the jest-runner-cypress diff --git a/source/faq/questions/using-cypress-faq.md b/source/faq/questions/using-cypress-faq.md index e91c8aff82..1443ad64c3 100644 --- a/source/faq/questions/using-cypress-faq.md +++ b/source/faq/questions/using-cypress-faq.md @@ -274,11 +274,11 @@ Yes, you can pass configuration to Cypress via environment variables, CLI argume ## {% fa fa-angle-right %} Can I override or change the default user agent the browser uses? -Yes. {% url "You can override this with `userAgent` in `cypress.json`." configuration#Browser %} +Yes. {% url "You can override this with `userAgent` in your configuration file (`cypress.json` by default)." configuration#Browser %} ## {% fa fa-angle-right %} Can I block traffic going to specific domains? I want to block Google Analytics or other providers. -Yes. {% url "You can set this with `blacklistHosts` in `cypress.json`." configuration#Browser %} +Yes. {% url "You can set this with `blacklistHosts` in your configuration file (`cypress.json` by default)." configuration#Browser %} Also, check out our {% url 'Stubbing Google Analytics Recipe' recipes#Stubbing-and-spying %}. @@ -336,7 +336,7 @@ It is possible to upload files in your application but it's different based on h ## {% fa fa-angle-right %} What is the projectId for? -The `projectId` is a 6 character string that helps identify your project once you've {% url "set up your tests to record" runs %}. It's generated by Cypress and typically is found in your {% url `cypress.json` configuration %} file. +The `projectId` is a 6 character string that helps identify your project once you've {% url "set up your tests to record" runs %}. It's generated by Cypress and typically is found in your {% url "configuration file (`cypress.json` by default)" configuration %} file. ```json { diff --git a/source/guides/core-concepts/writing-and-organizing-tests.md b/source/guides/core-concepts/writing-and-organizing-tests.md index dcecd42672..3e9ecf1f0b 100644 --- a/source/guides/core-concepts/writing-and-organizing-tests.md +++ b/source/guides/core-concepts/writing-and-organizing-tests.md @@ -56,14 +56,14 @@ After adding a new project, Cypress will automatically scaffold out a suggested - index.js ``` -***Configuring Folder Structure*** +## Configuring Folder Structure While Cypress allows to configure where your tests, fixtures, and support files are located, if you're starting your first project, we recommend you use the above structure. -You can modify the folder configuration in your `cypress.json`. See {% url 'configuration' configuration#Folders-Files %} for more detail. +You can modify the folder configuration in your configuration file. See {% url 'configuration' configuration#Folders-Files %} for more detail. {% note info "What files should I add to my '.gitignore file' ?" %} -Cypress will create a {% url `screenshotsFolder` configuration#Screenshots %} and a {% url `videosFolder` configuration#Videos %} to store the screenshots and videos taken during the testing of your application. Many users will opt to add these folders to their `.gitignore` file. Additionally, if you are storing sensitive environment variables in your `cypress.json` or {% url `cypress.env.json` environment-variables#Option-2-cypress-env-json %}, these should also be ignored when you check into source control. +Cypress will create a {% url `screenshotsFolder` configuration#Screenshots %} and a {% url `videosFolder` configuration#Videos %} to store the screenshots and videos taken during the testing of your application. Many users will opt to add these folders to their `.gitignore` file. Additionally, if you are storing sensitive environment variables in your configuration file (`cypress.json` by default) or {% url `cypress.env.json` environment-variables#Option-2-cypress-env-json %}, these should also be ignored when you check into source control. {% endnote %} ## Fixture Files @@ -335,14 +335,14 @@ Remember to use {% url `.only` writing-and-organizing-tests#Excluding-and-Includ ### Files -- {% url `cypress.json` configuration %} -- {% url `cypress.env.json` environment-variables %} +- {% url "Configuration file (`cypress.json`) by default" configuration %} +- {% url "`cypress.env.json`" environment-variables %} ### Folders -- `cypress/integration/` -- `cypress/support/` -- `cypress/plugins/` +- Integration directory (`cypress/integration/` by default) +- Support directory (`cypress/support/` by default) +- Plugins directory (`cypress/plugins/` by default) The folder, the files within the folder, and all child folders and their files (recursively) are watched. diff --git a/source/guides/getting-started/testing-your-app.md b/source/guides/getting-started/testing-your-app.md index 469b9527bb..38e3cd7744 100644 --- a/source/guides/getting-started/testing-your-app.md +++ b/source/guides/getting-started/testing-your-app.md @@ -96,7 +96,7 @@ If you've started your server, then you should see your application loaded and w If you think ahead, you'll quickly realize that you're going to be typing this URL a lot, since every test is going to need to visit some page of your application. Luckily, Cypress provides a {% url "configuration option" configuration %} for this. Let's leverage that now. -Open up `cypress.json`, which you will find in your project root (where you installed Cypress.) It starts out empty: +Open up your {% url "configuration file" configuration %} (`cypress.json` in your project directory, by default) It starts out empty: ```json {} @@ -113,7 +113,7 @@ Let's add the `baseUrl` option. This will automatically **prefix** {% url `cy.visit()` visit %} and {% url `cy.request()` request %} commands with this baseUrl. {% note info %} -Whenever you modify `cypress.json`, Cypress will automatically reboot itself and kill any open browsers. This is normal. Just click on the spec file again to relaunch the browser. +Whenever you modify your configuration file, Cypress will automatically reboot itself and kill any open browsers. This is normal. Just click on the spec file again to relaunch the browser. {% endnote %} We can now visit a relative path and omit the hostname and port. diff --git a/source/guides/guides/command-line.md b/source/guides/guides/command-line.md index 0ecbfa0fdc..44bd338a22 100644 --- a/source/guides/guides/command-line.md +++ b/source/guides/guides/command-line.md @@ -82,6 +82,7 @@ Option | Description `--browser`, `-b` | {% urlHash "Specify a different browser to run tests in" cypress-run-browser-lt-browser-name-or-path-gt %} `--ci-build-id` | {% urlHash "Specify a unique identifier for a run to enable grouping or parallelization." cypress-run-ci-build-id-lt-id-gt %} `--config`, `-c` | {% urlHash "Specify configuration" cypress-run-config-lt-config-gt %} +`--config-file`, `-C` | {% urlHash "Specify configuration file" cypress-run-config-file-lt-config-file-gt %} `--env`, `-e` | {% urlHash "Specify environment variables" cypress-run-env-lt-env-gt %} `--group` | {% urlHash "Group recorded tests together under a single run" cypress-run-group-lt-name-gt %} `--headed` | {% urlHash "Display the Electron browser instead of running headlessly" cypress-run-headed %} @@ -128,15 +129,29 @@ Only valid when providing a `--group` or `--parallel` flag. Read our {% url "par ### `cypress run --config ` -Read more about {% url 'environment variables' environment-variables %} and {% url 'configuration' configuration %}. +Set {% url 'configuration' configuration %} values. Separate multiple values with a comma. The values set here override any values set in your configuration file. ```shell cypress run --config pageLoadTimeout=100000,watchForFileChanges=false ``` +### `cypress run --config-file ` + +You can specify a path to a JSON file where {% url 'configuration' configuration %} values are set. This defaults to `cypress.json`. + +```shell +cypress run --config-file tests/cypress-config.json +``` + +You can pass `false` to disable the use of a configuration file entirely. + +```shell +cypress run --config-file false +``` + ### `cypress run --env ` -Pass a single string variable. +Set Cypress {% url 'environment variables' environment-variables %}. ```shell cypress run --env host=api.dev.local @@ -220,10 +235,6 @@ cypress run --port 8080 ### `cypress run --project ` -By default, Cypress expects your `cypress.json` to be found where your `package.json` is. However, you can point Cypress to run in a different location. - -This enables you to install Cypress in a top level `node_modules` folder but run Cypress in a nested folder. This is also helpful when you have multiple Cypress projects in your repo. - To see this in action we've set up an {% url 'example repo to demonstrate this here' https://github.com/cypress-io/cypress-test-nested-projects %}. ```shell @@ -298,12 +309,13 @@ cypress open [options] ### Options: -Options passed to `cypress open` will automatically be applied to the project you open. These persist on all projects until you quit the Cypress Test Runner. These options will also override values in `cypress.json`. +Options passed to `cypress open` will automatically be applied to the project you open. These persist on all projects until you quit the Cypress Test Runner. These options will also override values in your configuration file (`cypress.json` by default). Option | Description ------ | --------- `--browser`, `-b` | {% urlHash "Specify a different browser to run tests in" cypress-open-browser-lt-browser-path-gt %} `--config`, `-c` | {% urlHash "Specify configuration" cypress-open-config-lt-config-gt %} +`--config-file`, `-C` | {% urlHash "Specify configuration file" cypress-open-config-file-lt-config-file-gt %} `--detached`, `-d` | Open Cypress in detached mode `--env`, `-e` | {% urlHash "Specify environment variables" cypress-open-env-lt-env-gt %} `--global` | {% urlHash "Run in global mode" cypress-open-global %} @@ -327,16 +339,46 @@ Currently, only browsers in the Chrome family are supported. ### `cypress open --config ` +Set {% url 'configuration' configuration %} values. Separate multiple values with a comma. The values set here override any values set in your configuration file. + +```shell +cypress run --config pageLoadTimeout=100000,watchForFileChanges=false +``` + +### `cypress open --config-file ` + +You can specify a path to a JSON file where {% url 'configuration' configuration %} values are set. This defaults to `cypress.json`. + ```shell -cypress open --config pageLoadTimeout=100000,watchForFileChanges=false +cypress open --config-file tests/cypress-config.json +``` + +You can pass `false` to disable the use of a configuration file entirely. + +```shell +cypress open --config-file false ``` ### `cypress open --env ` +Set Cypress {% url 'environment variables' environment-variables %}. + ```shell cypress open --env host=api.dev.local ``` +Pass several variables using commas and no spaces. Numbers are automatically converted from strings. + +```shell +cypress open --env host=api.dev.local,port=4222 +``` + +Pass an object as a JSON in a string. + +```shell +cypress open --env flags='{"feature-a":true,"feature-b":false}' +``` + ### `cypress open --global` Opening Cypress in global mode is useful if you have multiple nested projects but want to share a single global installation of Cypress. In this case you can add each nested project to the Cypress in global mode, thus giving you a nice UI to switch between them. @@ -353,10 +395,6 @@ cypress open --port 8080 ### `cypress open --project ` -By default, Cypress expects your `cypress.json` to be found where your `package.json` is. However, you can point Cypress to run in a different location. - -This enables you to install Cypress in a top level `node_modules` folder but run Cypress in a nested folder. This is also helpful when you have multiple Cypress projects in your repo. - To see this in action we've set up an {% url 'example repo to demonstrate this here' https://github.com/cypress-io/cypress-test-nested-projects %}. ```shell diff --git a/source/guides/guides/continuous-integration.md b/source/guides/guides/continuous-integration.md index 69a3eb3cc1..e488a452d7 100644 --- a/source/guides/guides/continuous-integration.md +++ b/source/guides/guides/continuous-integration.md @@ -381,7 +381,7 @@ You can set various environment variables to modify how Cypress runs. ### Configuration Values -You can set any configuration value as an environment variable. This overrides values in your `cypress.json`. +You can set any configuration value as an environment variable. This overrides values in your configuration file (`cypress.json` by default). ***Typical use cases would be modifying things like:*** diff --git a/source/guides/guides/environment-variables.md b/source/guides/guides/environment-variables.md index 3964de47ba..62b2b8734c 100644 --- a/source/guides/guides/environment-variables.md +++ b/source/guides/guides/environment-variables.md @@ -16,7 +16,7 @@ Environment variables can be changed easily - especially when running in CI. cy.request('https://api.acme.corp') // this will break on other environments ``` -### We can move this into an environment variable. +### We can move this into a Cypress environment variable: ```javascript cy.request(Cypress.env('EXTERNAL_API')) // points to a dynamic env var @@ -29,11 +29,12 @@ However, you **do not** need to use environment variables to point to the origin {% url `cy.visit()` visit %} and {% url `cy.request()` request %} are automatically prefixed with this value - avoiding the need to specify them. -`baseUrl` can be set in your `cypress.json` - and then you can use an environment variable to override it. +`baseUrl` can be set in your configuration file (`cypress.json` by default) - and then you can use an environment variable to override it. ```shell CYPRESS_baseUrl=https://staging.app.com cypress run ``` + {% endnote %} # Setting @@ -42,7 +43,7 @@ There are 5 different ways to set environment variables. Each has a slightly dif ***To summarize you can:*** -- {% urlHash "Set in `cypress.json`" Option-1-cypress-json %} +- {% urlHash "Set in your configuration file" Option-1-configuration-file %} - {% urlHash "Create a `cypress.env.json`" Option-2-cypress-env-json %} - {% urlHash "Export as `CYPRESS_*`" Option-3-CYPRESS %} - {% urlHash "Pass in the CLI as `--env`" Option-4-env %} @@ -52,12 +53,11 @@ Don't feel obligated to pick just one method. It is common to use one strategy f When your tests are running, you can use the {% url `Cypress.env` env %} function to access the values of your environment variables. -## Option #1: `cypress.json` +## Option #1: configuration file -Any key/value you set in your {% url 'configuration' configuration %} under the `env` key will become an environment variable. +Any key/value you set in your {% url "configuration file (`cypress.json` by default)" configuration %} under the `env` key will become an environment variable. -```javascript -// cypress.json +```json { "projectId": "128076ed-9868-4e98-9cef-98dd8b705d75", "env": { @@ -87,12 +87,11 @@ Cypress.env('some') // 'value' ## Option #2: `cypress.env.json` -You can create your own `cypress.env.json` file that Cypress will automatically check. Values in here will overwrite conflicting environment variables in `cypress.json`. +You can create your own `cypress.env.json` file that Cypress will automatically check. Values in here will overwrite conflicting environment variables in your {% url "configuration file (`cypress.json` by default)" configuration %}. This strategy is useful because if you add `cypress.env.json` to your `.gitignore` file, the values in here can be different for each developer machine. -```javascript -// cypress.env.json +```json { "host": "veronica.dev.local", "api_server": "http://localhost:8888/api/v1/" @@ -124,7 +123,7 @@ Cypress.env('api_server') // 'http://localhost:8888/api/v1/' Any environment variable on your machine that starts with either `CYPRESS_` or `cypress_` will automatically be added and made available to you. -Conflicting values will override values from `cypress.json` and `cypress.env.json` files. +Conflicting values will override values from your configuration file (`cypress.json` by default) and `cypress.env.json` files. Cypress will *strip off* the `CYPRESS_` when adding your environment variables. diff --git a/source/guides/guides/module-api.md b/source/guides/guides/module-api.md index c01ad340b9..018d99d1ef 100644 --- a/source/guides/guides/module-api.md +++ b/source/guides/guides/module-api.md @@ -18,21 +18,22 @@ Just like the {% url "Command Line options" command-line %} for `cypress run`, y Option | Type | Description ------ | ---- | --------- -`browser` | *String* | Specify different browser to run tests in, either by name or by filesystem path -`ciBuildId` | *String* | Specify a unique identifier for a run to enable {% url "grouping" parallelization#Grouping-test-runs %} or {% url "parallelization" parallelization %} -`config` | *Object* | Specify {% url "configuration" configuration %} -`env` | *Object* | Specify {% url "environment variables" environment-variables %} -`group` | *String* | {% url "Group" parallelization#Grouping-test-runs %} recorded tests together under a single run -`headed` | *Boolean* | Display the Electron browser instead of running headlessly -`key` | *String* | Specify your secret record key -`exit` | *Boolean* | Whether to close Cypress after all tests run -`parallel` | *Boolean* | Run recorded specs in {% url "parallel" parallelization %} across multiple machines -`port` | *Number* | Override default port -`project` | *String* | Path to a specific project -`record` | *Boolean* | Whether to record the test run -`reporter` | *String* | Specify a {% url "Mocha reporter" reporters %} -`reporterOptions` | *Object* | Specify {% url "Mocha reporter" reporters %} options -`spec` | *String* | Specify the specs to run +`browser` | *string* | Specify different browser to run tests in, either by name or by filesystem path +`ciBuildId` | *string* | Specify a unique identifier for a run to enable {% url "grouping" parallelization#Grouping-test-runs %} or {% url "parallelization" parallelization %} +`config` | *object* | Specify {% url "configuration" configuration %} +`configFile` | *string | boolean* | Path to the config file to be used. If `false` is passed, no config file will be used. +`env` | *object* | Specify {% url "environment variables" environment-variables %} +`group` | *string* | {% url "Group" parallelization#Grouping-test-runs %} recorded tests together under a single run +`headed` | *boolean* | Display the Electron browser instead of running headlessly +`key` | *string* | Specify your secret record key +`exit` | *boolean* | Whether to close Cypress after all tests run +`parallel` | *boolean* | Run recorded specs in {% url "parallel" parallelization %} across multiple machines +`port` | *number* | Override default port +`project` | *string* | Path to a specific project +`record` | *boolean* | Whether to record the test run +`reporter` | *string* | Specify a {% url "Mocha reporter" reporters %} +`reporterOptions` | *object* | Specify {% url "Mocha reporter" reporters %} options +`spec` | *string* | Specify the specs to run ```javascript const cypress = require('cypress') @@ -118,13 +119,14 @@ Just like the {% url "Command Line options" command-line %}, you can pass option Option | Type | Description ------ | ---- | --------- -`browser` | *String* | Specify a filesystem path to a custom browser -`config` | *Options* | Specify {% url "configuration" configuration %} -`detached` | *Boolean* | Open Cypress in detached mode -`env` | *Object* | Specify {% url "environment variables" environment-variables %} -`global` | *Boolean* | Run in global mode -`port` | *Number* | Override default port -`project` | *String* | Path to a specific project +`browser` | *string* | Specify a filesystem path to a custom browser +`config` | *object* | Specify {% url "configuration" configuration %} +`configFile` | *string | boolean* | Path to the config file to be used. If `false` is passed, no config file will be used. +`detached` | *boolean* | Open Cypress in detached mode +`env` | *object* | Specify {% url "environment variables" environment-variables %} +`global` | *boolean* | Run in global mode +`port` | *number* | Override default port +`project` | *string* | Path to a specific project ### Example diff --git a/source/guides/guides/web-security.md b/source/guides/guides/web-security.md index eaf3b72698..b54abeb7f2 100644 --- a/source/guides/guides/web-security.md +++ b/source/guides/guides/web-security.md @@ -241,7 +241,7 @@ One last thing to consider here is that every once in a while we discover bugs i To start, you will need to understand that *not all browsers expose a way to turn off web security*. Some do, some don't. If you rely on disabling web security, you will not be able to run tests on browsers that do not support this feature. -**Setting `chromeWebSecurity` to `false` allows you to do the following:** +## Setting `chromeWebSecurity` to `false` allows you to do the following: - Display insecure content - Navigate to any superdomain without cross-origin errors @@ -251,7 +251,7 @@ One thing you may notice though is that Cypress still enforces visiting a single Still here? That's cool, let's disable web security! -***Set `chromeWebSecurity` to `false` in `cypress.json` and we'll take care of the rest.*** +### Set `chromeWebSecurity` to `false` in your {% url "configuration file (`cypress.json` by default)" configuration %}` and we'll take care of the rest ```json { diff --git a/source/guides/references/best-practices.md b/source/guides/references/best-practices.md index ab4f2a3def..fdf941edf8 100644 --- a/source/guides/references/best-practices.md +++ b/source/guides/references/best-practices.md @@ -578,7 +578,7 @@ We have {% url 'examples showing you how to start and stop your web server' cont {% endnote %} {% note success %} -{% fa fa-check-circle green %} **Best Practice:** Set a `baseUrl` in your `cypress.json` file. +{% fa fa-check-circle green %} **Best Practice:** Set a `baseUrl` in your {% url "configuration file (`cypress.json` by default)" configuration %}. {% endnote %} Adding a {% url "`baseUrl`" configuration#Global %} in your configuration allows you to omit passing the `baseUrl` to commands like {% url "`cy.visit()`" visit %} and {% url "`cy.request()`" request %}. Cypress assumes this is the url you want to use. @@ -595,7 +595,7 @@ As soon as it encounters a {% url "`cy.visit()`" visit %}, Cypress then switches By setting the `baseUrl`, you can avoid this reload altogether. Cypress will load the main window in the `baseUrl` you specified as soon as your tests start. -### cypress.json +### Configuration file (`cypress.json` by default) ```json { diff --git a/source/guides/references/configuration.md b/source/guides/references/configuration.md index 8432e33b70..d7fd34534d 100644 --- a/source/guides/references/configuration.md +++ b/source/guides/references/configuration.md @@ -4,11 +4,9 @@ title: Configuration When a project is added to Cypress, a `cypress.json` file is created in the project. This file is used to store the `projectId` ({% url 'after configuring your tests to record' projects#Setup %}) and any configuration values you supply. -```json -{ - "projectId": "jd90q7" -} -``` +{% note warning Change Configuration File %} +You can change the configuration file or turn off the use of a configuration file by using the {% url "`--config-file` flag" command-line#cypress-open-config-file-lt-config-file-gt %}. +{% endnote %} # Options @@ -133,7 +131,7 @@ While this may take a bit more work than other options - it yields you the most You can also use {% url 'environment variables' environment-variables %} to override configuration values. This is especially useful in {% url 'Continuous Integration' continuous-integration %} 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 corresponding configuration key will override the `cypress.json` value. +By default, any environment variable that matches a corresponding configuration key will override the configuration file (`cypress.json` by default) value. ```shell export CYPRESS_VIEWPORT_WIDTH=800 @@ -250,4 +248,4 @@ You can turn this option off if the application or site you're testing **does no ## Intelligent Code Completion -IntelliSense is available for Cypress while editing your `cypress.json` file. {% url "Learn how to set up Intelligent Code Completion." intelligent-code-completion %} +IntelliSense is available for Cypress while editing your configuration file. {% url "Learn how to set up Intelligent Code Completion." intelligent-code-completion %} diff --git a/source/guides/references/error-messages.md b/source/guides/references/error-messages.md index 717b844ad7..42b641fefa 100644 --- a/source/guides/references/error-messages.md +++ b/source/guides/references/error-messages.md @@ -190,9 +190,9 @@ Cypress will continuously attempt to interact with the element until it eventual cy.get('#modal button').click({ waitForAnimations: false }) ``` -You can globally disable animation error checking, or increase the threshold by modifying the {% url 'configuration' configuration %} in your {% url 'configuration' configuration %}. +You can globally disable animation error checking, or increase the threshold by modifying the {% url 'configuration' configuration %}. -### cypress.json +### Configuration file (`cypress.json` by default) ```json { @@ -505,11 +505,9 @@ When your application navigates to a superdomain outside of the current origin-p 2. You are testing a page that uses Single sign-on (SSO). In this case your web server is likely redirecting you between superdomains, so you receive this error message. You can likely get around this redirect problem by using {% url `cy.request()` request %} to manually handle the session yourself. -If you find yourself stuck and can't work around these issues you can just set this in your `cypress.json` file. But before doing so you should really understand and {% url 'read about the reasoning here' web-security %}. - -```javascript -// cypress.json +If you find yourself stuck and can't work around these issues you can set this in your {% url "configuration file (`cypress.json` by default)" configuration %}. But before doing so you should really understand and {% url 'read about the reasoning here' web-security %}. +```json { "chromeWebSecurity": false } diff --git a/source/guides/tooling/intelligent-code-completion.md b/source/guides/tooling/intelligent-code-completion.md index 4e041ec0f2..96384e9b1f 100644 --- a/source/guides/tooling/intelligent-code-completion.md +++ b/source/guides/tooling/intelligent-code-completion.md @@ -88,7 +88,7 @@ Adding a {% url "`tsconfig.json`" http://www.typescriptlang.org/docs/handbook/ts ## Features: -When editing the {% url "`cypress.json`" configuration %} file, you can use our {% url "json schema file" https://on.cypress.io/cypress.schema.json %} to get intelligent tooltips in your IDE for each configuration property. +When editing the {% url "configuration file (`cypress.json` by default)" configuration %}, you can use our {% url "json schema file" https://on.cypress.io/cypress.schema.json %} to get intelligent tooltips in your IDE for each configuration property. ### Property help when writing and hovering on configuration keys @@ -102,7 +102,7 @@ When editing the {% url "`cypress.json`" configuration %} file, you can use our Intelligent code completion using JSON schemas is supported by default in {% url "Visual Studio Code" https://code.visualstudio.com/ %} and {% url "Visual Studio" https://www.visualstudio.com/ %}. All other editors will require extra configuration or plugins for JSON schema support. -To set up in {% url "Visual Studio Code" https://code.visualstudio.com/ %} you can open `Preferences / Settings / User Settings` and add the `json.schemas` property. +To set up in {% url "Visual Studio Code" https://code.visualstudio.com/ %} you can open `Preferences / Settings / User Settings` and add the `json.schemas` property. Make sure to replace `cypress.json` with your configuration file if not the default. ```json { diff --git a/source/guides/tooling/plugins-guide.md b/source/guides/tooling/plugins-guide.md index aa62fce577..bc015013dd 100644 --- a/source/guides/tooling/plugins-guide.md +++ b/source/guides/tooling/plugins-guide.md @@ -20,7 +20,7 @@ You can {% url "check out the API docs here" writing-a-plugin %}. ## Configuration -With plugins, you can programmatically alter the resolved configuration and environment variables that come from `cypress.json`, {% url `cypress.env.json` environment-variables#Option-2-cypress-env-json %}, the CLI, or system environment variables. +With plugins, you can programmatically alter the resolved configuration and environment variables that come from {% url "your configuration file (`cypress.json` by default)" configuration %}, {% url `cypress.env.json` environment-variables#Option-2-cypress-env-json %}, the {% url "command line" command-line %}, or system environment variables. This enables you to do things like: diff --git a/source/guides/tooling/reporters.md b/source/guides/tooling/reporters.md index da549fe5bf..fe44f76a35 100644 --- a/source/guides/tooling/reporters.md +++ b/source/guides/tooling/reporters.md @@ -25,9 +25,31 @@ Once you've read through the documentation below, we invite you to experience th # Reporter Options -Some reporters accept options that customize their behavior. These can be specified in your `cypress.json` or via the command line: +### Command line + +```shell +cypress run --reporter reporters/custom.js +``` + +We also support passing an absolute path to the reporter. + +## npm Reporters + +### Specify package name in configuration file (`cypress.json` by default) when installing a custom reporter through npm + +```json +{ + "reporter": "mochawesome" +} +``` + +### Command line + + + +# Reporter Options -***cypress.json*** +Some reporters accept options that customize their behavior. These can be specified in your configuration file (`cypress.json` by default) or via {% url "command line" command-line %} options: ```json { @@ -131,7 +153,7 @@ We need to install several dependencies. npm install --save-dev mocha mochawesome mochawesome-merge mochawesome-report-generator ``` -We need to configure the reporter in `cypress.json` to skip the HTML report generation and save each individual JSON file in the `cypress/results` folder. +We need to configure the reporter in your {% url "configuration file (`cypress.json` by default)" configuration %} to skip the HTML report generation and save each individual JSON file in the `cypress/results` folder. ```json { From c7a712b05013433e2b0319424581e5b705aa3fe9 Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Tue, 1 Oct 2019 19:00:11 -0400 Subject: [PATCH 10/33] Updated more copy of changelog --- source/_changelogs/3.5.0.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/source/_changelogs/3.5.0.md b/source/_changelogs/3.5.0.md index 49cefb0018..6aa22df559 100644 --- a/source/_changelogs/3.5.0.md +++ b/source/_changelogs/3.5.0.md @@ -4,7 +4,7 @@ **Features:** -- Cypress app crash: "port" option should be a number or string {% issue 3250 %} + - Support `NO_PROXY=<-loopback>`, always have `NO_PROXY=localhost` otherwise {% issue 4780 %} - CSS problems on plugins error {% issue 4959 %} - moved Simulated click fixes {% issue 2956 %} @@ -25,21 +25,20 @@ - ECC SSL Certificates not supported {% issue 4368 %} - Add `--config-file` CLI argument {% issue 1369 %} - Random failures over Regexp: Invalid regular expression {% issue 1746 %} -- Correct reason not visible when element is detached from DOM {% issue 4946 %} -- Should not truncate full url during {% url "`cy.request()`" request %} in stdout {% issue 3145 %} +- Cypress now displays a more precise error message when checking an element's visibility if an element is detached from the DOM. Addresses {% issue 4946 %}. +- We now display up to 2,000 characters of HTTP properties values contained in error messages during {% url "`cy.request()`" request %}. Addresses {% issue 3145 %}. - Allow using external Node when running tasks / plugins {% issue 4432 %} **Bugfixes:** -- Selector Playground doesn't highlight element currently being hovered over {% issue 4872 %} -- `Cypress.env()` now properly escapes `` tags in the configuration file {% issue 4952 %} -- `response.body` isn't converted to JSON if `content-type` is `application/vnd.api+json` {% issue 5165 %} -- `dest.end` error crash during run exit on GitLab CI / Windows {% issue 2181 %} -- `onFocus` event incorrectly fires on a hidden element starting on v3.3.2 {% issue 4898 %} -- jQuery v3 types are looking for Sizzle types {% issue 5245 %} -- Cypress + TypeScript 3.6.2 errors due to outdated jQuery types {% issue 5065 %} -- Cannot click on `readonly` inputs / textarea {% issue 4874 %} -- Test runs infinitely with combination of async error, 'fail' event, and `done` callback, Cypress hangs up when using `done` within a `before` hook after `cy.request`. `beforeEach` with `done` causes tests to hang indefinitely when `done()` called in `promise.then()`.Mixing `cy.on()`/`cy.once()` with a one-argument `it()` function causes test to hang. Addresses {% issue 1075 %}, {% issue 2478 %}, {% issue 3349 %}, and {% issue 4790 %}. +- We fixed an issue introduced in {% url "3.4.0" changelog#3-4-0 %} that would cause the Selector Playground to not properly highlight the current hovered element. Fixes {% issue 4872 %} +- {% url "`Cypress.env()`" env %} now properly escapes `