Remove #section- from all all inter-page links

This commit is contained in:
Jennifer Mann
2017-05-19 12:01:36 -04:00
parent bfb0660eaf
commit 4eee975aba
73 changed files with 240 additions and 237 deletions
+6 -6
View File
@@ -15,23 +15,23 @@ You'd typically use `cy.and` when you are making multiple assertions about the s
| | |
|--- | --- |
| **Returns** | the current subject but (in some cases) a new subject |
| **Timeout** | the assertion will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | the assertion will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.and( *chainers* )](#section-chainers-usage)
# [cy.and( *chainers* )](#chainers-usage)
Make an assertion about the current subject using assertion chainers.
# [cy.and( *chainers*, *value* )](#section-chainers-with-value-usage)
# [cy.and( *chainers*, *value* )](#chainers-with-value-usage)
Make an assertion about the value of the current subject.
Some chai methods and chai-jQuery methods return a new (different) subject for chain-ability.
# [cy.and( *chainers*, *method*, *value* )](#section-chainers-with-method-and-value-usage)
# [cy.and( *chainers*, *method*, *value* )](#chainers-with-method-and-value-usage)
Make an assertion about the subject by calling a method and providing a value to that method.
# [cy.and( *function* )](#section-function-usage)
# [cy.and( *function* )](#function-usage)
Pass a function that can have any number of explicit assertions written within it.
@@ -233,7 +233,7 @@ cy.find("input", {timeout: 10000}).should("have.value", "foo").and("have.class",
## How do I know which assertions change the subject and which keep it the same?
The chainers that come from [Chai](https://on.cypress.io/guides/bundled-tools#section-chai) or [Chai-jQuery](https://on.cypress.io/guides/bundled-tools#section-chai-jquery) will always document what they return.
The chainers that come from [Chai](https://on.cypress.io/guides/bundled-tools#chai) or [Chai-jQuery](https://on.cypress.io/guides/bundled-tools#chai-jquery) will always document what they return.
Alternatively, it is very easy to use Cypress itself to figure this out.
+2 -2
View File
@@ -13,9 +13,9 @@ Assign an alias to a route or DOM element for use later. Reference the alias lat
| | |
|--- | --- |
| **Returns** | the DOM element or route being aliased |
| **Timeout** | the alias will retry the chain of commands before the alias assignment for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | the alias will retry the chain of commands before the alias assignment for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.as( *text* )](#section-usage)
# [cy.as( *text* )](#usage)
Create an alias to be used later, passing the name of the alias as a parameter.
+2 -2
View File
@@ -11,9 +11,9 @@ Make the DOM element found in the previous command lose focus.
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.blur` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.blur` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.blur()](#section-usage)
# [cy.blur()](#usage)
Blur the DOM element from the previous command.
+5 -5
View File
@@ -11,17 +11,17 @@ Check the checkboxes or radios within the current subject.
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.check` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) or the duration of the `timeout` specified in the command's [options](#section-options). |
| **Timeout** | `cy.check` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) or the duration of the `timeout` specified in the command's [options](#options). |
# [cy.check()](#section-usage)
# [cy.check()](#usage)
Checks checkboxes or radios.
# [cy.check( *value* )](#section-value-usage)
# [cy.check( *value* )](#value-usage)
Checks the checkbox or radio with the matching value.
# [cy.check( *values* )](#section-values-usage)
# [cy.check( *values* )](#values-usage)
Checks the checkboxes or radios with the matching values.
@@ -34,7 +34,7 @@ Pass in an options object to change the default behavior of `cy.check`.
Option | Default | Notes
--- | --- | ---
`interval` | `16` | Interval which to retry a check
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry the check
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry the check
`force` | `false` | Forces check, disables error checking prior to check
`log` | `true` | whether to display command in command log
`multiple` | `false` | Enables serially checking multiple elements
+4 -4
View File
@@ -9,13 +9,13 @@ Get the children of each DOM element in the set of matched DOM elements.
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.children` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.children` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.children()](#section-usage)
# [cy.children()](#usage)
Get the children of each DOM element in the set of matched DOM elements.
# [cy.children( *selector* )](#section-selector-usage)
# [cy.children( *selector* )](#selector-usage)
The `.children()` method optionally accepts a selector expression. If the selector is supplied, the DOM elements will be filtered by testing whether they match it.
@@ -29,7 +29,7 @@ Pass in an options object to change the default behavior of `cy.children`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry getting the element
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry getting the element
# Usage
+3 -3
View File
@@ -19,9 +19,9 @@ Prior to clearing, if the element isn't currently focused, Cypress will issue a
| | |
|--- | --- |
| **Returns** | the element that was typed into |
| **Timeout** | `cy.clear` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) or the duration of the `timeout` specified in the command's [options](#section-options).|
| **Timeout** | `cy.clear` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) or the duration of the `timeout` specified in the command's [options](#options).|
# [cy.clear()](#section-usage)
# [cy.clear()](#usage)
Clears the value of an `<input>` or `<textarea>`.
@@ -35,7 +35,7 @@ Option | Default | Notes
--- | --- | ---
`force` | `false` | Forces clear, disables error checking prior to clear
`interval` | `16` | Interval which to retry type
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry the type
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry the type
`log` | `true` | whether to display command in command log
# Usage
+3 -3
View File
@@ -11,9 +11,9 @@ Cypress automatically clears all cookies **before** each test to prevent state f
| | |
|--- | --- |
| **Returns** | `null` |
| **Timeout** | `cy.clearCookie` will wait up for the duration of [`responseTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) for the automation server to process this command. |
| **Timeout** | `cy.clearCookie` will wait up for the duration of [`responseTimeout`](https://on.cypress.io/guides/configuration#timeouts) for the automation server to process this command. |
# [cy.clearCookie( *name* )](#section-usage)
# [cy.clearCookie( *name* )](#usage)
Clears a browser cookie by its name.
@@ -25,7 +25,7 @@ Pass in an options object to change the default behavior of `cy.clearCookie`.
Option | Default | Notes
--- | --- | ---
`timeout` | [`responseTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to wait for the `cy.clearCookie` command to be processed
`timeout` | [`responseTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to wait for the `cy.clearCookie` command to be processed
`log` | `true` | whether to display command in command log
# Usage
+3 -3
View File
@@ -11,9 +11,9 @@ Cypress automatically invokes this command **before** each test to prevent state
| | |
|--- | --- |
| **Returns** | `null` |
| **Timeout** | `cy.clearCookies` will wait up for the duration of [`responseTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) for the automation server to process this command.|
| **Timeout** | `cy.clearCookies` will wait up for the duration of [`responseTimeout`](https://on.cypress.io/guides/configuration#timeouts) for the automation server to process this command.|
# [cy.clearCookies()](#section-usage)
# [cy.clearCookies()](#usage)
Clears all the browser cookies.
@@ -25,7 +25,7 @@ Pass in an options object to change the default behavior of `cy.clearCookies`.
Option | Default | Notes
--- | --- | ---
`timeout` | [`responseTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to wait for the `cy.clearCookies` command to be processed
`timeout` | [`responseTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to wait for the `cy.clearCookies` command to be processed
`log` | `true` | whether to display command in command log
# Usage
@@ -13,15 +13,15 @@ Cypress automatically invokes this command **before** each test to prevent state
| **Returns** | the remote local storage object |
| **Timeout** | *cannot timeout* |
# [cy.clearLocalStorage()](#section-usage)
# [cy.clearLocalStorage()](#usage)
Clear all data in local storage.
# [cy.clearLocalStorage( *string* )](#section-usage)
# [cy.clearLocalStorage( *string* )](#usage)
Clears all keys in local storage matching the string.
# [cy.clearLocalStorage( *RegExp* )](#section-usage)
# [cy.clearLocalStorage( *RegExp* )](#usage)
Clears all keys in local storage matching the RegExp.
+6 -6
View File
@@ -8,26 +8,26 @@ description: ''
Cypress automatically scrolls the element into view prior to attempting the click.
By default, the click is issued at the exact center of the element. You can pass a [`position`](#section-position-usage) option to override this setting.
By default, the click is issued at the exact center of the element. You can pass a [`position`](#position-usage) option to override this setting.
**The following events are fired during click:** `mousedown`, `focus`, `mouseup`, `click`
| | |
|--- | --- |
| **Returns** | the existing DOM subject |
| **Timeout** | `cy.click` will wait and retry until the element is 'clickable' for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) or the duration of the `timeout` specified in the command's [options](#section-options) |
| **Timeout** | `cy.click` will wait and retry until the element is 'clickable' for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) or the duration of the `timeout` specified in the command's [options](#options) |
# [cy.click()](#section-usage)
# [cy.click()](#usage)
Click the DOM element.
# [cy.click( *position* )](#section-position-usage)
# [cy.click( *position* )](#position-usage)
Clicks the element at the specified position. The `center` position is the default position. Valid positions are `topLeft`, `top`, `topRight`, `left`, `center`, `right`, `bottomLeft`, `bottom`, and `bottomRight`.
![cypress-command-positions-diagram](https://cloud.githubusercontent.com/assets/1271364/25048528/fe0c6378-210a-11e7-96bc-3773f774085b.jpg)
# [cy.click( *x*, *y* )](#section-coordinates-usage)
# [cy.click( *x*, *y* )](#coordinates-usage)
You can pass a relative `x` and `y` coordinate which will calculate distance in pixels from the top left corner of the element and issue the click at the calculated coordinate.
@@ -50,7 +50,7 @@ Option | Default | Notes
`force` | `false` | Forces click, disables error checking prior to click
`multiple` | `false` | Enables serially clicking multiple elements
`interval` | `16` | Interval which to retry a click
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry the click
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry the click
`log` | `true` | whether to display command in command log
# Usage
+5 -5
View File
@@ -16,19 +16,19 @@ If you call `cy.clock` before visiting a page with [`cy.visit`](https://on.cypre
| | |
|--- | --- |
| **Returns** | a `clock` object. See [clock API](#section-clock-api) |
| **Returns** | a `clock` object. See [clock API](#clock-api) |
# [cy.clock()](#section-usage)
# [cy.clock()](#usage)
Replaces `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval` and `Date` and allows them to be controlled synchronously via [`cy.tick`](https://on.cypress.io/api/tick) or the yielded `clock` object (see [clock API](#section-clock-api)).
Replaces `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval` and `Date` and allows them to be controlled synchronously via [`cy.tick`](https://on.cypress.io/api/tick) or the yielded `clock` object (see [clock API](#clock-api)).
The clock starts at the unix epoch (timestamp of 0). This means that when you instantiate `new Date` in your application, it will have a time of `January 1st, 1970`.
# [cy.clock( *now* )](#section-specify-the-now-timestamp)
# [cy.clock( *now* )](#specify-the-now-timestamp)
Same as above, but starts the clock at the specified timestamp.
# [cy.clock( *now*, *functionNames* )](#section-specify-which-functions-to-override)
# [cy.clock( *now*, *functionNames* )](#specify-which-functions-to-override)
Same as above, but only overrides the functions in the array `functionNames`.
+3 -3
View File
@@ -9,9 +9,9 @@ Get the first DOM element that matches the selector whether it be itself or one
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.filter` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.filter` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.closest( *selector* )](#section-selector-usage)
# [cy.closest( *selector* )](#selector-usage)
For each DOM element in the set, get the first DOM element that matches the selector by testing the DOM element itself and traversing up through its ancestors in the DOM tree.
@@ -24,7 +24,7 @@ Pass in an options object to change the default behavior of `cy.closest`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry getting the element
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry getting the element
# Selector Usage
+6 -6
View File
@@ -16,21 +16,21 @@ Get the DOM element containing the text. DOM elements can contain *more* than th
| | |
|--- | --- |
| **Returns** | the deepest DOM element containing the text |
| **Timeout** | `cy.contains` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.contains` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.contains( *text* )](#section-text-usage)
# [cy.contains( *text* )](#text-usage)
Get the deepest DOM element containing the text.
# [cy.contains( *number* )](#section-number-usage)
# [cy.contains( *number* )](#number-usage)
Get the deepest DOM element containing the number.
# [cy.contains( *regexp* )](#section-regular-expression-usage)
# [cy.contains( *regexp* )](#regular-expression-usage)
Get the deepest DOM element containing the text matching the regular expression.
# [cy.contains( *selector*, *text* )](#section-selector-and-text-usage)
# [cy.contains( *selector*, *text* )](#selector-and-text-usage)
Specify a selector to filter DOM elements containing the text. Cypress will **ignore** it's default preference for the specified selector. Using a selector allows you to return more *shallow* elements in the tree which contain the specific text.
@@ -44,7 +44,7 @@ Pass in an options object to change the default behavior of `cy.contains`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry finding an element
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry finding an element
# Text Usage
+2 -2
View File
@@ -11,9 +11,9 @@ Double-click on the DOM element in the previous command.
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.dblclick` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.dblclick` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.dblclick()](#section-usage)
# [cy.dblclick()](#usage)
Double-click the current subject.
+1 -1
View File
@@ -13,7 +13,7 @@ Make sure you have your Developer Tools open for `cy.debug` to hit the breakpoin
| **Returns** | the subject from the previous command for further chaining. |
| **Timeout** | *cannot timeout* |
# [cy.debug()](#section-usage)
# [cy.debug()](#usage)
Debug the previous command.
+2 -2
View File
@@ -9,9 +9,9 @@ Get the document and work with its properties or methods.
| | |
|--- | --- |
| **Returns** | the `window.document` object |
| **Timeout** | `cy.document` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.document` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.document()](#section-usage)
# [cy.document()](#usage)
Get the document.
+2 -2
View File
@@ -15,9 +15,9 @@ You can stop the loop early by returning `false` in the callback function.
| | |
|--- | --- |
| **Returns** | the original array subject given to `cy.each()` |
| **Timeout** | `cy.each` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.each` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.each( *function* )](#section-usage)
# [cy.each( *function* )](#usage)
Iterate over an array-like structure.
+1 -1
View File
@@ -11,7 +11,7 @@ Ends the Cypress command chain and returns `null`. This is equivalent to the jQu
| **Returns** | `null` |
| **Timeout** | cannot timeout |
# [cy.end()](#section-usage)
# [cy.end()](#usage)
End the command chain.
+4 -4
View File
@@ -9,13 +9,13 @@ Get a DOM element in an array of elements at the specific index.
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.eq` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.eq` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.eq( *index* )](#section-index-usage)
# [cy.eq( *index* )](#index-usage)
Reduce the set of matched DOM elements to the one at the specified index.
# [cy.eq( *indexFromEnd* )](#section-index-from-end-usage)
# [cy.eq( *indexFromEnd* )](#index-from-end-usage)
Providing a negative number indicates a position starting from the end of the set, rather than the beginning.
@@ -29,7 +29,7 @@ Pass in an options object to change the default behavior of `cy.eq`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry getting the element
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry getting the element
# Index Usage
+3 -3
View File
@@ -17,9 +17,9 @@ The current working directory is set to the project root (the directory that con
| | |
|--- | --- |
| **Returns** | an object with the exit `code`, the `stdout`, and the `stderr` |
| **Timeout** | `cy.exec` will allow the command to execute for the duration of the [`execTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.exec` will allow the command to execute for the duration of the [`execTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.exec( *command* )](#section-command-usage)
# [cy.exec( *command* )](#command-usage)
Execute a system command.
@@ -32,7 +32,7 @@ Pass in an options object to change the default behavior of `cy.exec`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`execTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to allow the command to execute
`timeout` | [`execTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to allow the command to execute
`failOnNonZeroExit` | `true` | Fail if the command exits with a non-zero code
`env` | `{}` | Object of environment variables to set before the command executes (e.g. { USERNAME: 'johndoe' }). Will be merged with existing system environment variables
+3 -3
View File
@@ -9,9 +9,9 @@ Get DOM elements that match a specific selector. Opposite of [`cy.not()`](https:
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.filter` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.filter` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.filter( *selector* )](#section-selector-usage)
# [cy.filter( *selector* )](#selector-usage)
Reduce the set of matched DOM elements to those that match the selector.
@@ -24,7 +24,7 @@ Pass in an options object to change the default behavior of `cy.filter`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry getting the element
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry getting the element
# Selector Usage
+3 -3
View File
@@ -9,9 +9,9 @@ Get the descendents DOM elements of a specific selector.
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.find` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.find` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.find( *selector* )](#section-selector-usage)
# [cy.find( *selector* )](#selector-usage)
Get the descendants of each DOM element in the current set of matched DOM elements within the selector.
@@ -24,7 +24,7 @@ Pass in an options object to change the default behavior of `cy.find`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry getting the element
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry getting the element
# Selector Usage
+3 -3
View File
@@ -9,9 +9,9 @@ Get the first DOM element within a set of DOM elements.
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.first` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.first` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.first()](#section-usage)
# [cy.first()](#usage)
Reduce the set of matched DOM elements to the first in the set.
@@ -24,7 +24,7 @@ Pass in an options object to change the default behavior of `cy.first`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry getting the element
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry getting the element
# Usage
+10 -10
View File
@@ -29,15 +29,15 @@ If an extension is omitted, Cypress will attempt to resolve the fixture by order
| | |
|--- | --- |
| **Returns** | the contents of the file, formatted by file extension |
| **Timeout** | `cy.fixture` will wait up for the duration of [`responseTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) for the server to process this command. |
| **Timeout** | `cy.fixture` will wait up for the duration of [`responseTimeout`](https://on.cypress.io/guides/configuration#timeouts) for the server to process this command. |
# [cy.fixture( *fixture* )](#section-single-fixture-usage)
# [cy.fixture( *fixture* )](#single-fixture-usage)
Loads the fixture at the specified filepath within the [`fixturesFolder`](https://on.cypress.io/guides/configuration#section-folders), which defaults to `cypress/fixtures`.
Loads the fixture at the specified filepath within the [`fixturesFolder`](https://on.cypress.io/guides/configuration#folders), which defaults to `cypress/fixtures`.
# [cy.fixture( *fixture*, *encoding* )](#section-encoding)
# [cy.fixture( *fixture*, *encoding* )](#encoding)
Loads the fixture at the specified filepath within the [`fixturesFolder`](https://on.cypress.io/guides/configuration#section-folders), which defaults to `cypress/fixtures`, using the encoding specified when reading the file.
Loads the fixture at the specified filepath within the [`fixturesFolder`](https://on.cypress.io/guides/configuration#folders), which defaults to `cypress/fixtures`, using the encoding specified when reading the file.
# Options
@@ -49,7 +49,7 @@ Pass in an options object to change the default behavior of `cy.fixture`.
Option | Default | Notes
--- | --- | ---
`timeout` | [`responseTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to wait for the `cy.fixture` command to be processed
`timeout` | [`responseTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to wait for the `cy.fixture` command to be processed
# Single Fixture Usage
@@ -65,7 +65,7 @@ cy.fixture("users.json")
cy.fixture("admin")
```
When no extension is passed to `cy.fixture`, Cypress will search for files with the specified name within the [`fixturesFolder`](https://on.cypress.io/guides/configuration#section-folders), which defaults to `cypress/fixtures`, and resolve the first one. The above example would resolve in the following order:
When no extension is passed to `cy.fixture`, Cypress will search for files with the specified name within the [`fixturesFolder`](https://on.cypress.io/guides/configuration#folders), which defaults to `cypress/fixtures`, and resolve the first one. The above example would resolve in the following order:
1. `{fixturesFolder}/admin.json`
2. `{fixturesFolder}/admin.js`
@@ -139,7 +139,7 @@ Cypress automatically determines the encoding for the following file types:
* `.tiff`
* `.zip`
For other types of files, they will be read as `utf8` by default. You can specify a different encoding by passing it as the [second argument](https://on.cypress.io/api/fixture#section--cy-fixture-fixture-encoding-section-encoding-).
For other types of files, they will be read as `utf8` by default. You can specify a different encoding by passing it as the [second argument](https://on.cypress.io/api/fixture#-cy-fixture-fixture-encoding-section-encoding-).
```javascript
cy.fixture("foo.bmp", "base64")
@@ -172,7 +172,7 @@ cy.route("GET", /users/, "fixture:users") // this works
cy.route("GET", /users/, "fx:users") // this also works
```
This saves you from having to explicitly load the fixture first (like [below](https://on.cypress.io/api/fixture#section-using-cy-then-to-access-fixture-data)).
This saves you from having to explicitly load the fixture first (like [below](https://on.cypress.io/api/fixture#using-cy-then-to-access-fixture-data)).
## Using cy.then to access fixture data
@@ -189,7 +189,7 @@ cy
## Using an alias to access a fixture
However if you still need access to the fixture data, instead of [yielding the fixture's data](https://on.cypress.io/api/fixture#section-using-cy-then-to-access-fixture-data), we can make use of [aliasing](https://on.cypress.io/guides/using-aliases).
However if you still need access to the fixture data, instead of [yielding the fixture's data](https://on.cypress.io/api/fixture#using-cy-then-to-access-fixture-data), we can make use of [aliasing](https://on.cypress.io/guides/using-aliases).
Using an alias provides the benefit of terseness and readability.
+2 -2
View File
@@ -11,9 +11,9 @@ Focus on a DOM element. If there is currently a different DOM element currently
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.focus` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.focus` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.focus()](#section-usage)
# [cy.focus()](#usage)
Focus on the DOM element found in the previous command.
+2 -2
View File
@@ -9,9 +9,9 @@ Get the DOM element that is currently focused.
| | |
|--- | --- |
| **Returns** | the current DOM element that is focused or `null` |
| **Timeout** | `cy.focused` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.focused` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.focused()](#section-usage)
# [cy.focused()](#usage)
Get the focused DOM element.
+4 -4
View File
@@ -11,13 +11,13 @@ Get one or more DOM elements by selector or [alias](https://on.cypress.io/guides
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.get` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.get` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.get( *selector* )](#section-selector-usage)
# [cy.get( *selector* )](#selector-usage)
Finds one or more DOM elements based on the selector.
# [cy.get( *alias* )](#section-alias-usage)
# [cy.get( *alias* )](#alias-usage)
{% note info New to Cypress? %}
[Read about using aliases first.](https://on.cypress.io/guides/using-aliases)
@@ -37,7 +37,7 @@ Pass in an options object to change the default behavior of `cy.get`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry getting the element
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry getting the element
# Selector Usage
+3 -3
View File
@@ -9,9 +9,9 @@ Get a browser cookie.
| | |
|--- | --- |
| **Returns** | a cookie object literal |
| **Timeout** | `cy.getCookie` will wait up for the duration of [`responseTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) for the automation server to process this command. |
| **Timeout** | `cy.getCookie` will wait up for the duration of [`responseTimeout`](https://on.cypress.io/guides/configuration#timeouts) for the automation server to process this command. |
# [cy.getCookie( *name* )](#section-usage)
# [cy.getCookie( *name* )](#usage)
Gets a browser cookie by its name.
@@ -35,7 +35,7 @@ Pass in an options object to change the default behavior of `cy.getCookie`.
Option | Default | Notes
--- | --- | ---
`timeout` | [`responseTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to wait for the `cy.getCookie` command to be processed
`timeout` | [`responseTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to wait for the `cy.getCookie` command to be processed
`log` | `true` | whether to display command in command log
# Usage
+3 -3
View File
@@ -9,9 +9,9 @@ Gets all of the browser cookies.
| | |
|--- | --- |
| **Returns** | an array of cookie objects |
| **Timeout** | `cy.getCookies` will wait up for the duration of [`responseTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) for the automation server to process this command. |
| **Timeout** | `cy.getCookies` will wait up for the duration of [`responseTimeout`](https://on.cypress.io/guides/configuration#timeouts) for the automation server to process this command. |
# [cy.getCookies()](#section-usage)
# [cy.getCookies()](#usage)
Gets the browser cookies.
@@ -35,7 +35,7 @@ Pass in an options object to change the default behavior of `cy.getCookies`.
Option | Default | Notes
--- | --- | ---
`timeout` | [`responseTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to wait for the `cy.getCookies` command to be processed
`timeout` | [`responseTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to wait for the `cy.getCookies` command to be processed
`log` | `true` | whether to display command in command log
# Usage
+4 -4
View File
@@ -9,13 +9,13 @@ Navigate back or forward to the previous or next URL in the browser's history. I
| | |
|--- | --- |
| **Returns** | the `window` object |
| **Timeout** | `cy.go` will retry for the duration of the [pageLoadTimeout](https://on.cypress.io/guides/configuration#section-timeouts) or the duration of the `timeout` specified in the command's [options](#section-options). |
| **Timeout** | `cy.go` will retry for the duration of the [pageLoadTimeout](https://on.cypress.io/guides/configuration#timeouts) or the duration of the `timeout` specified in the command's [options](#options). |
# [cy.go( *direction* )](#section-direction-usage)
# [cy.go( *direction* )](#direction-usage)
Navigate back or forward to the URL in a specific direction (`back` or `forward`).
# [cy.go( *number* )](#section-number-usage)
# [cy.go( *number* )](#number-usage)
Navigate back or forward going to the URL within a specific history position (-1 goes back one page, 1 goes forward one page).
@@ -28,7 +28,7 @@ Pass in an options object to change the default behavior of `cy.go`.
Option | Default | Notes
--- | --- | ---
`timeout` | [pageLoadTimeout](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry the visit
`timeout` | [pageLoadTimeout](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry the visit
`log` | `true` | whether to display command in command log
# Direction Usage
+1 -1
View File
@@ -11,7 +11,7 @@ Get the current URL hash. This is the same as [`cy.location().hash`](https://on.
| **Returns** | the current URL hash as a string, including the `#` character. If no `#` character is present, an empty string will be returned. |
| **Timeout** | *cannot timeout* |
# [cy.hash()](#section-usage)
# [cy.hash()](#usage)
Get the current URL hash.
+3 -3
View File
@@ -11,13 +11,13 @@ If you want to call a regular property that is not a function on the current sub
| | |
|--- | --- |
| **Returns** | the return value of the invoked property |
| **Timeout** | `cy.invoke` cannot timeout unless you've added assertions. The assertions will retry for the duration of [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.invoke` cannot timeout unless you've added assertions. The assertions will retry for the duration of [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.invoke( *functionName* )](#section-function-usage)
# [cy.invoke( *functionName* )](#function-usage)
Invokes the function with the specified name
# [cy.invoke( *functionName*, **arguments* )](#section-function-with-arguments-usage)
# [cy.invoke( *functionName*, **arguments* )](#function-with-arguments-usage)
Invokes the function with the specified name and forwards any additional arguments to the function call. There are no limits to the number of arguments.
+2 -2
View File
@@ -11,9 +11,9 @@ If you want to call a function on the current subject, use [`cy.invoke`](https:/
| | |
|--- | --- |
| **Returns** | the value of the property |
| **Timeout** | `cy.its` cannot timeout unless you've added assertions. The assertions will retry for the duration of [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.its` cannot timeout unless you've added assertions. The assertions will retry for the duration of [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.its( *propertyName* )](#section-usage)
# [cy.its( *propertyName* )](#usage)
Gets the property with the specified name.
+3 -3
View File
@@ -9,9 +9,9 @@ Get the last DOM element within a set of DOM elements.
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.last` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.last` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.last()](#section-usage)
# [cy.last()](#usage)
Reduce the set of matched DOM elements to the final one in the set.
@@ -24,7 +24,7 @@ Pass in an options object to change the default behavior of `cy.last`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry getting the element
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry getting the element
# Usage
+2 -2
View File
@@ -11,7 +11,7 @@ Get the remote `window.location` as a normalized object.
| **Returns** | location object detailed below |
| **Timeout** | *cannot timeout* |
# [cy.location()](#section-usage)
# [cy.location()](#usage)
Given a remote URL of `http://localhost:8000/app/index.html?q=dan#/users/123/edit`, an object would be returned with the following properties:
@@ -28,7 +28,7 @@ Key | Type | Returns
`search` | string | ?q=brian
`toString` | function | http://localhost:8000/app/index.html?q=brian#/users/123/edit
# [cy.location( *key* )](#section-key-usage)
# [cy.location( *key* )](#key-usage)
Get the specific value by key of the location object above.
+2 -2
View File
@@ -11,11 +11,11 @@ Print a message to the Command Log within Cypress.
| **Returns** | null |
| **Timeout** | *cannot timeout* |
# [cy.log( *message* )](#section-usage)
# [cy.log( *message* )](#usage)
Print the message to the Command Log.
# [cy.log( *message*, *arguments* )](#section-arguments-usage)
# [cy.log( *message*, *arguments* )](#arguments-usage)
Print the message to the Command Log, along with any arguments.
+4 -4
View File
@@ -9,13 +9,13 @@ Get the immediately following sibling of each DOM element in the set of matched
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.next` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.next` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.next()](#section-usage)
# [cy.next()](#usage)
Get the next sibling of the elements.
# [cy.next( *selector* )](#section-selector-usage)
# [cy.next( *selector* )](#selector-usage)
When a selector is provided, it retrieves the next sibling only if it matches that selector.
@@ -29,7 +29,7 @@ Pass in an options object to change the default behavior of `cy.next`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry getting the element
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry getting the element
# Usage
+3 -3
View File
@@ -9,9 +9,9 @@ Remove DOM elements from the set of DOM elements. Opposite of [`cy.filter()`](ht
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.not` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.not` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.not( *selector* )](#section-selector-usage)
# [cy.not( *selector* )](#selector-usage)
Remove the element(s) by it's selector from the elements
@@ -24,7 +24,7 @@ Pass in an options object to change the default behavior of `cy.not`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry getting the element
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry getting the element
# Selector Usage
+4 -4
View File
@@ -9,13 +9,13 @@ Get the parent DOM element of the DOM elements.
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.parent` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.parent` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.parent()](#section-usage)
# [cy.parent()](#usage)
Get the parent of each element in the current set of matched elements.
# [cy.parent( *selector* )](#section-selector-usage)
# [cy.parent( *selector* )](#selector-usage)
Get the parent of each element in the current set of matched elements filtered by selector.
@@ -29,7 +29,7 @@ Pass in an options object to change the default behavior of `cy.parent`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry getting the element
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry getting the element
# Usage
+4 -4
View File
@@ -9,13 +9,13 @@ Get the parents DOM elements of the DOM elements.
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.parents` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.parents` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.parents()](#section-usage)
# [cy.parents()](#usage)
Get the ancestors of each element in the current set of matched elements.
# [cy.parents( *selector* )](#section-selector-usage)
# [cy.parents( *selector* )](#selector-usage)
Get the ancestors of each element in the current set of matched elements filtered by selector
@@ -29,7 +29,7 @@ Pass in an options object to change the default behavior of `cy.parents`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry getting the element
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry getting the element
# Usage
+1 -1
View File
@@ -13,7 +13,7 @@ This does not set a `debugger` in your code, unlike [`cy.debug`](https://on.cypr
| **Returns** | the subject from the previous command for further chaining |
| **Timeout** | *cannot timeout* |
# [cy.pause()](#section-usage)
# [cy.pause()](#usage)
Stop command execution at the current command.
+4 -4
View File
@@ -9,13 +9,13 @@ Get the immediately preceding sibling of each element in the set of the elements
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.prev` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.prev` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.prev()](#section-usage)
# [cy.prev()](#usage)
Get the immediately preceding sibling of each element in the set of matched elements.
# [cy.prev( *selector* )](#section-selector-usage)
# [cy.prev( *selector* )](#selector-usage)
Get the immediately preceding sibling of each element in the set of matched elements filtered by selector.
@@ -29,7 +29,7 @@ Pass in an options object to change the default behavior of `cy.prev`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry getting the element
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry getting the element
# Usage
+4 -4
View File
@@ -9,13 +9,13 @@ Reads a file and returns its contents. JSON is automatically parsed into JavaScr
| | |
|--- | --- |
| **Returns** | the contents of the file |
| **Timeout** | `cy.readFile` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.readFile` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.readFile( *filePath* )](#section-usage)
# [cy.readFile( *filePath* )](#usage)
Reads the file at the `filePath`. The `filePath` is relative to the project's root.
# [cy.readFile( *filePath*, *encoding* )](#section-specify-encoding)
# [cy.readFile( *filePath*, *encoding* )](#specify-encoding)
Reads the file at the `filePath` with the `encoding`. The `filePath` is relative to the project's root.
@@ -29,7 +29,7 @@ Pass in an options object to change the default behavior of `cy.readFile`.
Option | Default | Notes
--- | --- | ---
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to wait for the `cy.readFile` command to be processed
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to wait for the `cy.readFile` command to be processed
# Usage
+4 -4
View File
@@ -9,13 +9,13 @@ Reload the page.
| | |
|--- | --- |
| **Returns** | the `window` object of the newly reloaded page |
| **Timeout** | `cy.reload` will retry for the duration of the [pageLoadTimeout](https://on.cypress.io/guides/configuration#section-timeouts) or the duration of the `timeout` specified in the command's [options](#section-options). |
| **Timeout** | `cy.reload` will retry for the duration of the [pageLoadTimeout](https://on.cypress.io/guides/configuration#timeouts) or the duration of the `timeout` specified in the command's [options](#options). |
# [cy.reload()](#section-usage)
# [cy.reload()](#usage)
Reload the page from the current URL.
# [cy.reload( *forceReload* )](#section-force-reload-usage)
# [cy.reload( *forceReload* )](#force-reload-usage)
Reload the current page, without using the cache if `forceReload` is true
@@ -27,7 +27,7 @@ Pass in an options object to change the default behavior of `cy.reload`.
Option | Default | Notes
--- | --- | ---
`timeout` | [pageLoadTimeout](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry the visit
`timeout` | [pageLoadTimeout](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry the visit
`log` | `true` | whether to display command in command log
# Usage
+6 -6
View File
@@ -9,21 +9,21 @@ Use `cy.request` to make HTTP requests. Great for talking to an external endpoin
| | |
|--- | --- |
| **Returns** | the `response` as an object literal. |
| **Timeout** | `cy.request` will wait for the response for the duration of the [responseTimeout](https://on.cypress.io/guides/configuration#section-timeouts) or the [`timeout`](#section-options) passed in the options object of the command. |
| **Timeout** | `cy.request` will wait for the response for the duration of the [responseTimeout](https://on.cypress.io/guides/configuration#timeouts) or the [`timeout`](#options) passed in the options object of the command. |
# [cy.request( *url* )](#section-url-usage)
# [cy.request( *url* )](#url-usage)
Makes a `GET` request using the specified url.
# [cy.request( *url*, *body* )](#section-url-and-body-usage)
# [cy.request( *url*, *body* )](#url-and-body-usage)
Make a `GET` request to the provided url with the provided body.
# [cy.request( *method*, *url* )](#section-method-and-url-usage)
# [cy.request( *method*, *url* )](#method-and-url-usage)
Make a request using the provided method to the specified url.
# [cy.request( *method*, *url*, *body* )](#section-method-and-url-and-body-usage)
# [cy.request( *method*, *url*, *body* )](#method-and-url-and-body-usage)
Additionally pass in the request `body` as a `String` or `Object Literal`. Cypress will set the `Accepts` request header and serialize the response body by its `Content-Type`.
@@ -45,7 +45,7 @@ Option | Default | Notes
`log` | `true` | Whether to log the request in the Command Log
`method` | `GET` | The HTTP method to use when making the request.
`qs` | `null` | The query parameters to be appended to the `url` option when making the request.
`timeout` | [`responseTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to wait for a response (in ms)
`timeout` | [`responseTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to wait for a response (in ms)
`url` | `null` | The URL to make the request.
You can also set options for the `cy.request`'s `baseUrl` and `responseTimeout` globally in [configuration](https://on.cypress.io/guides/configuration).
+2 -2
View File
@@ -9,9 +9,9 @@ Get the root element. By default the root is `document`. When calling `cy.root`
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.root` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.root` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.root()](#section-root-usage)
# [cy.root()](#root-usage)
Get the root element.
+5 -5
View File
@@ -15,23 +15,23 @@ Use `cy.route` to manage the behavior of network requests.
| **Returns** | `null` |
| **Timeout** | *cannot timeout* |
# [cy.route( *url* )](#section-url-usage)
# [cy.route( *url* )](#url-usage)
Set a route matching the specific `url` which is not stubbed but can be waited on later. This will match `GET` request methods.
# [cy.route( *url*, *response* )](#section-url-and-response-usage)
# [cy.route( *url*, *response* )](#url-and-response-usage)
Set a route matching the `url` stubbed with the supplied `response`. This will match `GET` request methods.
# [cy.route( *method*, *url* )](#section-method-and-url-usage)
# [cy.route( *method*, *url* )](#method-and-url-usage)
Set a route matching the specific `method` and `url` which is not stubbed but can be waited on later.
# [cy.route( *method*, *url*, *response* )](#section-method-url-and-response-usage)
# [cy.route( *method*, *url*, *response* )](#method-url-and-response-usage)
Set a route matching the `method` and `url` stubbed with the supplied `response`.
# [cy.route( *function* )](#section-function-usage)
# [cy.route( *function* )](#function-usage)
Set a route by returning an object literal from your callback function.
+6 -6
View File
@@ -6,18 +6,18 @@ description: ''
Take a screenshot of the Command Log and the test runner (the app being tested). The screenshot will be stored in `cypress/screenshots` by default.
You can change the directory where screenshots are saved in your [configuration](https://on.cypress.io/guides/configuration#section-folders).
You can change the directory where screenshots are saved in your [configuration](https://on.cypress.io/guides/configuration#folders).
| | |
|--- | --- |
| **Returns** | `null` |
| **Timeout** | `cy.screenshot` will wait up for the duration of [`responseTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) for the automation server to process this command. |
| **Timeout** | `cy.screenshot` will wait up for the duration of [`responseTimeout`](https://on.cypress.io/guides/configuration#timeouts) for the automation server to process this command. |
# [cy.screenshot()](#section-usage)
# [cy.screenshot()](#usage)
Take a screenshot of the screen and save as a `.png` in `cypress/screenshots`. By default the filename will be the title of the test.
# [cy.screenshot( *filename* )](#section-filename-usage)
# [cy.screenshot( *filename* )](#filename-usage)
Take a screenshot of the screen and save as a `.png` in `cypress/screenshots`. The filename will be the filename passed in as the argument.
@@ -31,7 +31,7 @@ Pass in an options object to change the default behavior of `cy.screenshot`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`responseTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to wait for the automation server to process this command.
`timeout` | [`responseTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to wait for the automation server to process this command.
# Usage
@@ -64,7 +64,7 @@ When running headlessly or in [Continuous Integration](https://on.cypress.io/gui
## Default screenshots folder
By default, screenshots will be saved in `cypress/screenshots`. You can change the directory where screenshots are saved in your [configuration](https://on.cypress.io/guides/configuration#section-folders).
By default, screenshots will be saved in `cypress/screenshots`. You can change the directory where screenshots are saved in your [configuration](https://on.cypress.io/guides/configuration#folders).
## Screenshots in CI
+2 -2
View File
@@ -11,7 +11,7 @@ Scroll an element into view.
| **Returns** | the element that was scrolled into view |
| **Timeout** | `cy.scrollIntoView` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.scrollIntoView()](#section-usage)
# [cy.scrollIntoView()](#usage)
Scroll to the element found in the previous command into view.
@@ -26,7 +26,7 @@ Option | Default | Notes
`duration` | `0` | Scrolls over the duration (in ms)
`easing` | `swing` | Will scroll with the easing animation
`offset` | `{top: 0, left: 0}` | Amount to scroll after the element has been scrolled into view
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry the scroll
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry the scroll
`log` | `true` | whether to display command in command log
# Usage
+5 -5
View File
@@ -11,17 +11,17 @@ Scroll to a specific position in the window or in the element found in the previ
| **Returns** | the window or DOM element that was scrolled |
| **Timeout** | `cy.scrollTo` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.scrollTo( *position* )](#section-position-usage)
# [cy.scrollTo( *position* )](#position-usage)
Scroll to a specific position in the window or in the element found in the previous command. Valid positions are `topLeft`, `top`, `topRight`, `left`, `center`, `right`, `bottomLeft`, `bottom`, and `bottomRight`.
![cypress-command-positions-diagram](https://cloud.githubusercontent.com/assets/1271364/25048528/fe0c6378-210a-11e7-96bc-3773f774085b.jpg)
# [cy.scrollTo( *x*, *y* )](#section-coordinate-usage)
# [cy.scrollTo( *x*, *y* )](#coordinate-usage)
You can pass an `x` and `y` coordinate in pixels which will calculate the distance from the top left corner of the element and scroll to the calculated coordinate. The coordinates can be a number or a string with 'px'.
# [cy.scrollTo( *width %*, *height %* )](#section-percentage-usage)
# [cy.scrollTo( *width %*, *height %* )](#percentage-usage)
You can pass a string with the percentage of the element's width and height to scroll to that position.
@@ -37,7 +37,7 @@ Option | Default | Notes
--- | --- | ---
`duration` | `0` | Scrolls over the duration (in ms)
`easing` | `swing` | Will scroll with the easing animation
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry the scroll
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry the scroll
`log` | `true` | whether to display command in command log
# Position Usage
@@ -94,7 +94,7 @@ cy.get("#slider").scrollTo('right', { duration: 2000} )
## Snapshots
**Cypress does not reflect the accurate scroll positions of any elements within snapshots.** If you want to see the actual scrolling behavior in action, we recommend using [`cy.pause()`](https://on.cypress.io/api/pause) to walk through each command or [watching the video of the test run](#https://on.cypress.io/guides/runs#section-videos).
**Cypress does not reflect the accurate scroll positions of any elements within snapshots.** If you want to see the actual scrolling behavior in action, we recommend using [`cy.pause()`](https://on.cypress.io/api/pause) to walk through each command or [watching the video of the test run](#https://on.cypress.io/guides/runs#videos).
# Command Log
+6 -6
View File
@@ -11,21 +11,21 @@ Select an option within a `<select>` DOM element.
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.select` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) or the duration of the `timeout` specified in the command's [options](#section-options). |
| **Timeout** | `cy.select` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) or the duration of the `timeout` specified in the command's [options](#options). |
# [cy.select( *text* )](#section-text-usage)
# [cy.select( *text* )](#text-usage)
Select an option within a `<select>` element based on the text content of the option.
# [cy.select( *value* )](#section-value-usage)
# [cy.select( *value* )](#value-usage)
Select an option within a `<select>` element based on the value of the option.
# [cy.select( *texts* )](#section-texts-usage)
# [cy.select( *texts* )](#texts-usage)
Select multiple options within a `<select>` element based on the text of the option.
# [cy.select( *values* )](#section-values-usage)
# [cy.select( *values* )](#values-usage)
Select multiple options within a `<select>` element based on the value of the option.
@@ -41,7 +41,7 @@ Option | Default | Notes
--- | --- | ---
`force` | `false` | Forces select, disables error checking prior to select
`interval` | `50` | Interval which to retry a select
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry the select
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry the select
`log` | `true` | whether to display command in command log
# Text Usage
+1 -1
View File
@@ -10,7 +10,7 @@ description: ''
Use `cy.server` to control the behavior of requests and responses.
# [cy.server()](#section-default-usage)
# [cy.server()](#default-usage)
Start a server to begin routing responses to your requests.
+3 -3
View File
@@ -9,9 +9,9 @@ Set a browser cookie.
| | |
|--- | --- |
| **Returns** | a cookie object |
| **Timeout** | `cy.setCookie` will wait up for the duration of [`responseTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) for the automation server to process this command. |
| **Timeout** | `cy.setCookie` will wait up for the duration of [`responseTimeout`](https://on.cypress.io/guides/configuration#timeouts) for the automation server to process this command. |
# [cy.setCookie( *name*, *value* )](#section-usage)
# [cy.setCookie( *name*, *value* )](#usage)
Sets a browser cookie.
@@ -28,7 +28,7 @@ Option | Default | Notes
`secure` | `false` | whether the cookie is a secure cookie
`httpOnly` | `false` | whether the cookie is an HTTP only cookie
`expiry` | 20 years into the future | when the cookie expires, specified in seconds since [Unix Epoch](https://en.wikipedia.org/wiki/Unix_time).
`timeout` | [`responseTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to wait for the `cy.setCookie` command to be processed
`timeout` | [`responseTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to wait for the `cy.setCookie` command to be processed
`log` | `true` | whether to display command in command log
# Usage
+7 -7
View File
@@ -13,21 +13,21 @@ description: ''
| | |
|--- | --- |
| **Returns** | the current subject but (in some cases) a new subject |
| **Timeout** | the assertion will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | the assertion will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.should( *chainers* )](#section-chainers-usage)
# [cy.should( *chainers* )](#chainers-usage)
Implicitly assert about the current subject.
# [cy.should( *chainers*, *value* )](#section-chainers-with-value-usage)
# [cy.should( *chainers*, *value* )](#chainers-with-value-usage)
Implicitly assert a value about the current subject. Returns the existing current subject (usually). Some chai methods and chai-jQuery methods return a new (different) subject for chain-ability.
# [cy.should( *chainers*, *method*, *value* )](#section-chainers-with-method-and-value-usage)
# [cy.should( *chainers*, *method*, *value* )](#chainers-with-method-and-value-usage)
Implicitly assert about the subject by calling a method and providing a value to that method.
# [cy.should( *function* )](#section-function-usage)
# [cy.should( *function* )](#function-usage)
Pass a function that can have any number of explicit assertions within it. Does not change the subject. Whatever was passed to the function is what is returned.
@@ -217,7 +217,7 @@ cy
.and("not.have.class", "inactive")
```
You can [read more about how Cypress resolves your assertions](https://on.cypress.io/guides/making-assertions#section-resolving-assertions) here.
You can [read more about how Cypress resolves your assertions](https://on.cypress.io/guides/making-assertions#resolving-assertions) here.
# Notes
@@ -232,7 +232,7 @@ A [list of these](https://on.cypress.io/guides/making-assertions#available-asser
## How do I know which assertions change the subject and which keep it the same?
The chainers that come from [Chai](https://on.cypress.io/guides/bundled-tools#section-chai) or [Chai-jQuery](https://on.cypress.io/guides/bundled-tools#section-chai-jquery) will always document what they return.
The chainers that come from [Chai](https://on.cypress.io/guides/bundled-tools#chai) or [Chai-jQuery](https://on.cypress.io/guides/bundled-tools#chai-jquery) will always document what they return.
Alternatively, it is very easy to use Cypress itself to figure this out.
+4 -4
View File
@@ -9,13 +9,13 @@ Get the siblings DOM elements of each element in the set of matched DOM elements
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.siblings` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.siblings` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.siblings()](#section-usage)
# [cy.siblings()](#usage)
Get the siblings of each DOM element in the set of matched DOM elements.
# [cy.siblings( *selector* )](#section-selector-usage)
# [cy.siblings( *selector* )](#selector-usage)
Get the siblings of each DOM element in the set of matched DOM elements filtered by a selector.
@@ -29,7 +29,7 @@ Pass in an options object to change the default behavior of `cy.siblings`.
Option | Default | Notes
--- | --- | ---
`log` | `true` | whether to display command in command log
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry getting the element
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry getting the element
# Usage
+1 -1
View File
@@ -11,7 +11,7 @@ The spread command allows an expression to be expanded in places where multiple
| **Returns** | the value of the spread |
| **Timeout** | *cannot timeout* |
# [cy.spread( *fn* )](#section-usage)
# [cy.spread( *fn* )](#usage)
Expand an array of arguments.
+1 -1
View File
@@ -18,7 +18,7 @@ Unlike most Cypress commands, `cy.spy` is *synchronous* and returns a value (the
|--- | --- |
| **Returns** | the spy |
# [cy.spy( *object*, *"method"* )](#section-usage)
# [cy.spy( *object*, *"method"* )](#usage)
Wraps the `method` on the `object` with a spy and returns the spy. See the [sinon.js spy docs](http://sinonjs.org/docs/#spies) for [methods](http://sinonjs.org/docs/#spies-api) on the spy.
+3 -3
View File
@@ -18,15 +18,15 @@ Unlike most Cypress commands, `cy.stub` is *synchronous* and returns a value (th
|--- | --- |
| **Returns** | the stub |
# [cy.stub()](#section-usage)
# [cy.stub()](#usage)
Creates and returns a stub. See the [sinon.js stub docs](http://sinonjs.org/docs/#stubs) for methods on the stub.
# [cy.stub( *object*, *"method"* )](#section-replace-a-method-with-a-stub)
# [cy.stub( *object*, *"method"* )](#replace-a-method-with-a-stub)
Replaces the `method` on the `object` with a stub and returns the stub. See the [sinon.js stub docs](http://sinonjs.org/docs/#stubs) for methods on the stub.
# [cy.stub( *object*, *"method"*, replacerFn )](#section-replace-a-method-with-a-function)
# [cy.stub( *object*, *"method"*, replacerFn )](#replace-a-method-with-a-function)
Replaces the `method` on the `object` with the `replacerFn` wrapped in a spy.See the [sinon.js spy docs](http://sinonjs.org/docs/#spies) for methods on the spy.
+2 -2
View File
@@ -11,9 +11,9 @@ Submits the DOM element from the previous command if it is a form. Submit can on
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.submit` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts). |
| **Timeout** | `cy.submit` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts). |
# [cy.submit()](#section-usage)
# [cy.submit()](#usage)
Submit a form.
+3 -3
View File
@@ -15,9 +15,9 @@ Just like Promises, you can return any compatible "thenable" (anything that has
| | |
|--- | --- |
| **Returns** | the return of the callback function |
| **Timeout** | `cy.then` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) or the duration of the `timeout` specified in the command's [options](#section-options). |
| **Timeout** | `cy.then` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) or the duration of the `timeout` specified in the command's [options](#options). |
# [cy.then( *function* )](#section-usage)
# [cy.then( *function* )](#usage)
Yield the current subject as the first argument.
@@ -47,7 +47,7 @@ Pass in an options object to change the default behavior of `cy.then`.
Option | Default | Notes
--- | --- | ---
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry the click
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry the click
# Usage
+2 -2
View File
@@ -12,9 +12,9 @@ It moves the clock the specified number of `milliseconds`. Any timers within the
| | |
|--- | --- |
| **Returns** | the `clock` object. See [clock API](https://on.cypress.io/api/clock#section-clock-api) |
| **Returns** | the `clock` object. See [clock API](https://on.cypress.io/api/clock#clock-api) |
# [cy.tick( *milliseconds* )](#section-usage)
# [cy.tick( *milliseconds* )](#usage)
Moves the clock the specified number of `milliseconds`. Any timers within the affected range of time will be called.
+2 -2
View File
@@ -9,9 +9,9 @@ Get the title of the document.
| | |
|--- | --- |
| **Returns** | the `document` title as a string |
| **Timeout** | `cy.title` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.title` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.title()](#section-usage)
# [cy.title()](#usage)
Get the title of the document.
+5 -5
View File
@@ -35,9 +35,9 @@ Sequence | Notes
| | |
|--- | --- |
| **Returns** | the DOM element that was typed into |
| **Timeout** | `cy.type` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) or the duration of the `timeout` specified in the command's [options](#section-options). |
| **Timeout** | `cy.type` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) or the duration of the `timeout` specified in the command's [options](#options). |
# [cy.type( *text* )](#section-usage)
# [cy.type( *text* )](#usage)
Types the text provided into the current DOM subject.
@@ -53,7 +53,7 @@ Option | Default | Notes
`force` | `false` | Forces type, disables error checking prior to type
`release` | `true` | Keep a modifier activated between commands
`interval` | `16` | Interval to retry type
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry the type
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry the type
`log` | `true` | whether to display command in command log
# Usage
@@ -102,7 +102,7 @@ Be careful with the `force` option because it allows the type to happen where it
# Key combinations / Modifiers
When using special character sequences (see table at top of page), it's possible to activate modifier keys and type key combinations, such as `CTRL + R` or `SHIFT + ALT + Q`. The modifier(s) remain activated for the duration of the `cy.type()` command, and are released when all subsequent characters are typed, unless [`{release: false}`](https://on.cypress.io/api/type#section-options) is passed as an [option](https://on.cypress.io/v1.0/api/type#section-release-behavior). A `keydown` event is fired when a modifier is activated and a `keyup` event is fired when it is released.
When using special character sequences (see table at top of page), it's possible to activate modifier keys and type key combinations, such as `CTRL + R` or `SHIFT + ALT + Q`. The modifier(s) remain activated for the duration of the `cy.type()` command, and are released when all subsequent characters are typed, unless [`{release: false}`](https://on.cypress.io/api/type#options) is passed as an [option](https://on.cypress.io/v1.0/api/type#release-behavior). A `keydown` event is fired when a modifier is activated and a `keyup` event is fired when it is released.
## Type a key combination
@@ -316,7 +316,7 @@ Of course if the form's `submit` event is `preventedDefault` the form will not a
## Key Events Table
Cypress will print out a table of key events that detail the keys that were pressed when clicking on type within the [command log](https://on.cypress.io/api/type#section-command-log). Each character will contain the `which` character code and the events that happened as a result of that key press.
Cypress will print out a table of key events that detail the keys that were pressed when clicking on type within the [command log](https://on.cypress.io/api/type#command-log). Each character will contain the `which` character code and the events that happened as a result of that key press.
Events that were `defaultPrevented` may prevent other events from firing and those will show up as empty. For instance, canceling `keydown` will not fire `keypress` or `textInput` or `input`, but will fire `keyup` (which matches the spec).
+4 -4
View File
@@ -11,13 +11,13 @@ Unchecks the checkboxes within the current subject.
| | |
|--- | --- |
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | `cy.uncheck` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) or the duration of the `timeout` specified in the commands [options](#section-options). |
| **Timeout** | `cy.uncheck` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) or the duration of the `timeout` specified in the commands [options](#options). |
# [cy.uncheck()](#section-usage)
# [cy.uncheck()](#usage)
Unchecks checkboxes. Triggers events associated with check.
# [cy.uncheck( *values* )](#section-values-usage)
# [cy.uncheck( *values* )](#values-usage)
Unchecks the checkboxes matching the values. Triggers events associated with uncheck.
@@ -30,7 +30,7 @@ Pass in an options object to change the default behavior of `cy.uncheck`.
Option | Default | Notes
--- | --- | ---
`interval` | `16` | Interval which to retry a uncheck
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to retry the uncheck
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry the uncheck
`force` | `false` | Forces uncheck, disables error checking prior to uncheck
`log` | `true` | whether to display command in command log
`multiple` | `false` | Enables serially unchecking multiple elements
+1 -1
View File
@@ -11,7 +11,7 @@ Get the current URL. `cy.url()` uses [`cy.location.href`](https://on.cypress.io/
| **Returns** | the current URL as a string |
| **Timeout** | *cannot timeout* |
# [cy.url()](#section-usage)
# [cy.url()](#usage)
Get the current URL.
+2 -2
View File
@@ -11,11 +11,11 @@ Use `cy.viewport` to control the screen size and orientation of your application
| **Returns** | `null` |
| **Timeout** | *cannot timeout* |
# [cy.viewport( *width*, *height* )](#section-usage)
# [cy.viewport( *width*, *height* )](#usage)
Resize the viewport to the specified dimensions in pixels.
# [cy.viewport( *preset*, *orientation* )](#section-preset-usage)
# [cy.viewport( *preset*, *orientation* )](#preset-usage)
Resize the viewport to a preset dimension. Viewport supports the following presets (in pixels):
+5 -5
View File
@@ -6,16 +6,16 @@ description: ''
Visit a remote url. This will most likely be the first command you run. `cy.visit` resolves when the remote page fires its `load` event.
Visit is prefixed with the `baseUrl` configured in the [Network Options](https://on.cypress.io/guides/configuration#section-global).
Visit is prefixed with the `baseUrl` configured in the [Network Options](https://on.cypress.io/guides/configuration#global).
Using `baseUrl` is a great way to prevent repeating yourself in every `cy.visit`.
| | |
|--- | --- |
| **Returns** | the remote page's window object |
| **Timeout** | `cy.visit` will retry for the duration of the [pageLoadTimeout](https://on.cypress.io/guides/configuration#section-timeouts) or the duration of the `timeout` specified in the command's [options](#section-options). |
| **Timeout** | `cy.visit` will retry for the duration of the [pageLoadTimeout](https://on.cypress.io/guides/configuration#timeouts) or the duration of the `timeout` specified in the command's [options](#options). |
# [cy.visit( *url* )](#section-usage)
# [cy.visit( *url* )](#usage)
Visit the specified url passed as a string.
@@ -23,13 +23,13 @@ Visit the specified url passed as a string.
Pass in an options object to change the default behavior of `cy.visit`.
**[cy.visit( *url*, *options* )](#section-options-usage)**
**[cy.visit( *url*, *options* )](#options-usage)**
Option | Default | Notes
--- | --- | ---
`onBeforeLoad` | `function` | Called before your page has loaded all of its resources.
`onLoad` | `function` | Called once your page has fired its load event.
`timeout` | [pageLoadTimeout](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to wait until `cy.visit` resolves
`timeout` | [pageLoadTimeout](https://on.cypress.io/guides/configuration#timeouts) | Total time to wait until `cy.visit` resolves
`log` | `true` | whether to display command in command log
You can also set options for all `cy.visit` `pageLoadTimeout` and `baseUrl` globally in [configuration](https://on.cypress.io/guides/configuration).
+6 -6
View File
@@ -9,13 +9,13 @@ Use `cy.wait` to wait for a number of milliseconds or for a resource to resolve.
| | |
|--- | --- |
| **Returns** | the current subject if waiting for number of milliseconds, the xhr object if waiting for a route |
| **Timeout** | `cy.wait` will wait for the request the duration of the [requestTimeout](https://on.cypress.io/guides/configuration#section-timeouts) and wait for the response for the duration of the [responseTimeout](https://on.cypress.io/guides/configuration#section-timeouts) or it will wait for both the duration request and response for the `timeout` specified in the command's [options](#section-options).|
| **Timeout** | `cy.wait` will wait for the request the duration of the [requestTimeout](https://on.cypress.io/guides/configuration#timeouts) and wait for the response for the duration of the [responseTimeout](https://on.cypress.io/guides/configuration#timeouts) or it will wait for both the duration request and response for the `timeout` specified in the command's [options](#options).|
# [cy.wait( *number* )](#section-number-usage)
# [cy.wait( *number* )](#number-usage)
Wait a specific amount of `ms` before resolving and continuing onto the next command.
# [cy.wait( *alias* )](#section-alias-usage)
# [cy.wait( *alias* )](#alias-usage)
Wait until the matching [aliased](https://on.cypress.io/guides/using-aliases) XHR has a response.
@@ -35,7 +35,7 @@ Pass in an options object to change the default behavior of `cy.wait`.
Option | Default | Notes
--- | --- | ---
`timeout` | [requestTimeout](https://on.cypress.io/guides/configuration#section-timeouts), [responseTimeout](https://on.cypress.io/guides/configuration#section-timeouts) | Override the default requestTimeout and responseTimeout (in ms)
`timeout` | [requestTimeout](https://on.cypress.io/guides/configuration#timeouts), [responseTimeout](https://on.cypress.io/guides/configuration#timeouts) | Override the default requestTimeout and responseTimeout (in ms)
`log` | `true` | whether to display command in command log
You can also change the default `requestTimeout` and `responseTimeout` that all `cy.wait` use in [configuration](https://on.cypress.io/guides/configuration).
@@ -140,13 +140,13 @@ cy
`cy.wait` goes through two separate "waiting" periods for a matching XHR.
The first period waits for a matching request to leave the browser. This duration is configured by [`requestTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) - which has a default of `5000` ms.
The first period waits for a matching request to leave the browser. This duration is configured by [`requestTimeout`](https://on.cypress.io/guides/configuration#timeouts) - which has a default of `5000` ms.
This means that when you begin waiting for an XHR, Cypress will wait up to 5 seconds for a matching XHR to be created. If no matching XHR is found, you will get an error message that looks like this:
![screen shot 2015-12-21 at 5 00 09 pm](https://cloud.githubusercontent.com/assets/1268976/11942578/8e7cba50-a805-11e5-805c-614f8640fbcc.png)
Once Cypress detects that a matching XHR has begun its request it then switches over to the 2nd waiting period. This duration is configured by [`responseTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) - which has a default of `20000` ms.
Once Cypress detects that a matching XHR has begun its request it then switches over to the 2nd waiting period. This duration is configured by [`responseTimeout`](https://on.cypress.io/guides/configuration#timeouts) - which has a default of `20000` ms.
This means Cypress will now wait up to 20 seconds for the external server to respond to this XHR. If no response is detected, you will get an error message that looks like this:
+3 -3
View File
@@ -9,9 +9,9 @@ Get the global `window` object of the remote application [visited](https://on.cy
| | |
|--- | --- |
| **Returns** | the `window` object |
| **Timeout** | `cy.window` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) |
| **Timeout** | `cy.window` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) |
# [cy.window()](#section-usage)
# [cy.window()](#usage)
Get the global window object of the remote application you've visited.
@@ -19,7 +19,7 @@ Get the global window object of the remote application you've visited.
Pass in an options object to change the default behavior of `cy.window`.
**[cy.window( *options* )](#section-options-usage)**
**[cy.window( *options* )](#options-usage)**
Option | Default | Notes
--- | --- | ---
+1 -1
View File
@@ -11,7 +11,7 @@ Reset the root scope to the current subject and pass that as an argument to the
| **Returns** | the new DOM element(s) found by the command. |
| **Timeout** | *cannot timeout* |
# [cy.within( *function* )](#section-usage)
# [cy.within( *function* )](#usage)
Set the root scope to the current subject
+1 -1
View File
@@ -11,7 +11,7 @@ Return the object passed into `cy.wrap`.
| **Returns** | the object passed into `cy.wrap` |
| **Timeout** | *cannot timeout* |
# [cy.wrap( *object* )](#section-usage)
# [cy.wrap( *object* )](#usage)
Return the object passed into `cy.wrap`.
+4 -4
View File
@@ -10,13 +10,13 @@ Writes to a file with the specified contents. JavaScript arrays and objects are
| | |
|--- | --- |
| **Returns** | the contents written to the file |
| **Timeout** | `cy.writeFile` will wait for the duration of [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) for the server to write the file. |
| **Timeout** | `cy.writeFile` will wait for the duration of [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) for the server to write the file. |
# [cy.writeFile( *filePath*, *contents* )](#section-usage)
# [cy.writeFile( *filePath*, *contents* )](#usage)
Writes to the `filePath` with the `contents`. The `filePath` is relative to the project's root. `contents` must be a string, an array, or an object.
# [cy.writeFile( *filePath*, *contents*, *encoding* )](#section-specify-encoding)
# [cy.writeFile( *filePath*, *contents*, *encoding* )](#specify-encoding)
Writes to the `filePath` with the `contents` using the `encoding`. The `filePath` is relative to the project's root. `contents` must be a string, an array, or an object.
@@ -30,7 +30,7 @@ Pass in an options object to change the default behavior of `cy.writeFile`.
Option | Default | Notes
--- | --- | ---
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#section-timeouts) | Total time to wait for the `cy.writeFile` command to be processed
`timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to wait for the `cy.writeFile` command to be processed
# Usage