docs: rules for cy.request, add command requirements to other custom requirements

This commit is contained in:
Brian Mann
2017-06-28 00:23:09 -04:00
parent 215bf3ede4
commit aba991c8a0
3 changed files with 42 additions and 11 deletions
+17 -9
View File
@@ -17,8 +17,6 @@ cy.request(options)
## Usage
`cy.request()` cannot be chained off any other cy commands, so should be chained off of `cy` for clarity.
**{% fa fa-check-circle green %} Correct Usage**
```javascript
@@ -27,7 +25,7 @@ cy.request('http://dev.local/seed')
## Arguments
**{% fa fa-angle-right %} url** ***(String, Glob, RegExp)***
**{% fa fa-angle-right %} url** ***(String)***
The `url` to make the request to.
@@ -42,8 +40,9 @@ If you provide a non fully qualified domain name (FQDN), Cypress will make its b
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`.
***cypress.json***
```json
// cypress.json
{
"baseUrl": "http://localhost:1234"
}
@@ -92,11 +91,7 @@ You can also set options for `cy.request`'s `baseUrl` and `responseTimeout` glob
- `status`
- `body`
- `headers`
- `duration`.
## Timeouts {% helper_icon timeout %}
`cy.request()` will wait for the response for the duration of the {% url `responseTimeout` configuration#Timeouts %} or the `timeout` passed in the options object of the command.
- `duration`
# Examples
@@ -209,6 +204,19 @@ Before sending the HTTP request, we automatically attach cookies that would have
In other words, `cy.request()` transparently performs all of the underlying functions as if it came from the browser.
# Rules
## Requirements {% helper_icon requirements %}
{% requirements request cy.request %}
## Assertions {% helper_icon assertions %}
{% assertions once cy.request %}
## Timeouts {% helper_icon timeout %}
{% timeouts request cy.request %}
# Command Log