docs: inline the cypress.json comment, switch to javascript lang

This commit is contained in:
Brian Mann
2017-06-28 00:21:51 -04:00
parent 07ed16a9d9
commit 215bf3ede4
5 changed files with 38 additions and 61 deletions
+12 -8
View File
@@ -54,9 +54,10 @@ Set multiple configuration options with an object literal.
**Get all configuration options.**
***cypress.json***
```json
```javascript
// cypress.json
{
"defaultCommandTimeout": 10000
}
@@ -70,9 +71,10 @@ Cypress.config() // => {defaultCommandTimeout: 10000, pageLoadTimeout: 30000, ..
**Return just a single configuration option value.**
***cypress.json***
```json
```javascript
// cypress.json
{
"pageLoadTimeout": 60000
}
@@ -90,9 +92,10 @@ Cypress.config("pageLoadTimeout") // => 60000
Any value you change will be permanently changed for the remainder of your tests.
{% endnote %}
***cypress.json***
```json
```javascript
// cypress.json
{
"viewportWidth": 1280,
"viewportHeight": 720
@@ -115,9 +118,10 @@ Cypress.config("viewportWidth") // => 800
**You can set multiple values by passing an object literal.**
***cypress.json***
```json
```javascript
// cypress.json
{
"defaultCommandTimeout": 4000,
"pageLoadTimeout": 30000,
+12 -8
View File
@@ -54,9 +54,10 @@ Set multiple environment variables with an object literal.
**Get all environment variables.**
***cypress.json***
```json
```javascript
// cypress.json
{
"env": {
"foo": "bar",
@@ -73,9 +74,10 @@ Cypress.env() // => {foo: "bar", baz: "quux"}
**Return just a single environment variable value.**
***cypress.json***
```json
```javascript
// cypress.json
{
"env": {
"foo": "bar",
@@ -97,9 +99,10 @@ Cypress.env("baz") // => quux
Any value you change will be permanently changed for the remainder of your tests.
{% endnote %}
***cypress.json***
```json
```javascript
// cypress.json
{
"env": {
"foo": "bar",
@@ -118,9 +121,10 @@ Cypress.env("host") // => http://server.dev.local
**You can set multiple values by passing an object literal.**
***cypress.json***
```json
```javascript
// cypress.json
{
"env": {
"foo": "bar",
@@ -41,9 +41,9 @@ When your tests are running, you can use the {% url `Cypress.env` env %} functio
Any key/value you set in your {% url 'configuration' configuration %} under the `env` key will become an environment variable.
***cypress.json***
```javascript
// cypress.json
```json
{
"projectId": "128076ed-9868-4e98-9cef-98dd8b705d75",
"env": {
@@ -77,9 +77,9 @@ You can create your own `cypress.env.json` file that Cypress will automatically
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.
***cypress.env.json***
```javascript
// cypress.env.json
```json
{
"host": "veronica.dev.local",
"api_server": "http://localhost:8888/api/v1/"
+6 -6
View File
@@ -28,9 +28,9 @@ Say you have the following directory structure:
***To specify the path to your custom reporter:***
***cypress.json***
```javascript
// cypress.json
```json
{
"reporter": "reporters/custom.js"
}
@@ -46,9 +46,9 @@ cypress run --reporter reporters/custom.js
If you installed a custom reporter through npm, specify the package name:
***cypress.json***
```javascript
// cypress.json
```json
{
"reporter": "mochawesome"
}
@@ -68,9 +68,9 @@ You need to install any peer dependencies the reporter requires, even if they're
Some reporters accept options that customize their behavior. These can be specified in your `cypress.json` or via the command line:
***cypress.json***
```javascript
// cypress.json
```json
{
"reporter": "junit",
"reporterOptions": {
@@ -194,9 +194,9 @@ 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 %}.
***cypress.json***
```javascript
// cypress.json
```json
{
"waitForAnimations": false,
"animationDistanceThreshold": 50
@@ -308,37 +308,6 @@ it('does not forget to return a promise', function(){
See {% url "`cy.visit()`" visit %} documentation.
## {% fa fa-exclamation-triangle red %} Passing `cy.server({stub: false})` is now deprecated
In previous versions of Cypress, to prevent Cypress from stubbing routes you had to explicitly tell your server not to stub routes like this:
```javascript
cy.server({stub: false})
cy.route(...)
```
You no longer have to do this. Whether a {% url "`cy.route()`" route %} is stubbed or not is simply based on whether or not you specified a response in {% url "`cy.route()`" route %}.
## {% fa fa-exclamation-triangle red %} Passing `cy.route({stub: false})` is now deprecated
In previous versions of Cypress, {% url "`cy.route()`" route %} would require a `response` unless you specified `stub: false` in its options.
You used to have to write this:
```javascript
cy.server()
cy.route({url: /posts/, stub: false})
```
This is now deprecated because Cypress automatically stubs {% url "`cy.route()`" route %} based on whether or not it has a `response` property.
```javascript
cy.server()
cy.route(/users/, [{}, {}]) // stubbed because this has a response argument
cy.route({url: /comments/, response: []}) // stubbed because this has a response property
cy.route(/posts/) // not stubbed because there is no response argument or property
```
# CLI Errors
## {% fa fa-exclamation-triangle red %} You passed the `--record` flag but did not provide us your Record Key.
@@ -416,9 +385,9 @@ When your application navigates to a superdomain outside of the current origin-p
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 %}.
***cypress.json***
```javascript
// cypress.json
{
"chromeWebSecurity": false
}