mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-13 02:40:22 -05:00
docs: WIP add some sections to various commands
This commit is contained in:
@@ -59,7 +59,7 @@ Pass a function that can have any number of explicit assertions within it. Whate
|
||||
|
||||
## Yields {% helper_icon yields %}
|
||||
|
||||
In most cases, `.and()` yields the previous cy command's yield.
|
||||
In most cases, `.and()` yields the subject from the previous command.
|
||||
|
||||
```javascript
|
||||
cy
|
||||
@@ -76,6 +76,10 @@ cy
|
||||
.and('have.css', 'font-family') // yields 'sans-serif'
|
||||
```
|
||||
|
||||
## Defaults {% helper_icon defaultAssertion %}
|
||||
|
||||
`.and()` has no default assertions other than what you specify.
|
||||
|
||||
## Timeouts {% helper_icon timeout %}
|
||||
|
||||
`.and()` will continue to retry until none of the assertions throw for the duration of the previous cy commands `timeout`.
|
||||
|
||||
@@ -42,7 +42,11 @@ The name of the alias to be referenced later within a {% url `cy.get()` get %} o
|
||||
|
||||
## Yields {% helper_icon yields %}
|
||||
|
||||
`.as()` yields the DOM element or route chained from the previous command.
|
||||
`.as()` yields the subject from the previous command.
|
||||
|
||||
## Defaults {% helper_icon defaultAssertion %}
|
||||
|
||||
`.as()` has no default assertions.
|
||||
|
||||
## Timeouts {% helper_icon timeout %}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ cy.window().blur() // Errors, 'window' does not yield DOM element
|
||||
|
||||
Pass in an options object to change the default behavior of `.blur`.
|
||||
|
||||
Option | Default | Notes
|
||||
Option | Default | Description
|
||||
--- | --- | ---
|
||||
`log` | `true` | {% usage_options log %}
|
||||
`force` | `false` | Forces the action, disables checking if element is focused
|
||||
@@ -46,7 +46,11 @@ Option | Default | Notes
|
||||
|
||||
## Yields {% helper_icon yields %}
|
||||
|
||||
`.blur()` yields the DOM element that was blurred.
|
||||
`.blur()` yields the subject from the previous command for additional chaining.
|
||||
|
||||
## Defaults {% helper_icon defaultAssertion %}
|
||||
|
||||
`.blur()` has no default assertions.
|
||||
|
||||
## Timeouts {% helper_icon timeout %}
|
||||
|
||||
|
||||
@@ -18,7 +18,9 @@ Check checkbox(es) or radio(s).
|
||||
|
||||
## Usage
|
||||
|
||||
`.check()` requires being chained off another cy command that *yields* a DOM element of type `checkbox` or `radio`.
|
||||
`.check()` requires being chained off another cy command that *yields* an `<input>` DOM element.
|
||||
|
||||
These `<input>` elements must have type `checkbox` or `radio`.
|
||||
|
||||
**{% fa fa-check-circle green %} Valid Usage**
|
||||
|
||||
@@ -60,11 +62,11 @@ Option | Default | Description
|
||||
|
||||
## Defaults {% helper_icon defaultAssertion %}
|
||||
|
||||
`.check()` yields the DOM element(s) that were checked.
|
||||
`.check()` will automatically wait until the element reaches an {% url 'actionable state' interacting-with-elements#Actionability %} before checking the element.
|
||||
|
||||
## Timeout {% helper_icon timeout %}
|
||||
## Timeouts {% helper_icon timeout %}
|
||||
|
||||
`.check` will retry for the duration of the {% url `defaultCommandTimeout` configuration#Timeouts %} or the duration of the `timeout` specified in the command's options.
|
||||
`.check()` will wait for the duration of its `timeout` option for its default assertion and any additional assertions to pass.
|
||||
|
||||
# Examples
|
||||
|
||||
|
||||
@@ -50,6 +50,10 @@ Option | Default | Description
|
||||
|
||||
`.children()` yields the new DOM element(s) found by the command.
|
||||
|
||||
## Defaults {% helper_icon defaultAssertion %}
|
||||
|
||||
`.children()` will automatically wait until the element(s) can be found in the DOM.
|
||||
|
||||
## Timeouts {% helper_icon timeout %}
|
||||
|
||||
`.children()` will continue to look for the children elements for the duration of the {% url `defaultCommandTimeout` configuration#Timeouts %}.
|
||||
|
||||
@@ -68,6 +68,8 @@ You can also access the `clock` object via `this.clock` in a {% url `.then()` th
|
||||
|
||||
## Timeouts {% helper_icon timeout %}
|
||||
|
||||
`cy.clock()` cannot timeout.
|
||||
|
||||
# Examples
|
||||
|
||||
## Clock
|
||||
@@ -204,8 +206,8 @@ When clicking on the `clock` command within the command log, the console outputs
|
||||
|
||||
# See also
|
||||
|
||||
- {% url 'Guide: Stubs, Spies and Clocks' stubs-spies-and-clocks %}
|
||||
- {% url `cy.spy()` spy %}
|
||||
- {% url `cy.stub()` stub %}
|
||||
- {% url 'Recipe: Controlling Behavior with Spies, Stubs, and Clocks' stubs-spies-and-clocks-recipe %}
|
||||
- {% url `cy.tick()` tick %}
|
||||
- {% url 'Guide: Stubs, Spies and Clocks' stubs-spies-and-clocks %}
|
||||
- {% url 'Recipe: Controlling Behavior with Spies, Stubs, and Clocks' stubs-spies-and-clocks-recipe %}
|
||||
|
||||
@@ -43,6 +43,8 @@ Option | Default | Description
|
||||
|
||||
## Timeouts {% helper_icon timeout %}
|
||||
|
||||
`.debug()` cannot timeout.
|
||||
|
||||
# Examples
|
||||
|
||||
## Debug
|
||||
|
||||
@@ -46,6 +46,8 @@ Pass a function that is invoked with the following arguments:
|
||||
|
||||
## Timeouts {% helper_icon timeout %}
|
||||
|
||||
`.each()` cannot timeout.
|
||||
|
||||
# Examples
|
||||
|
||||
## DOM Elements
|
||||
|
||||
@@ -34,6 +34,8 @@ cy.end() // Does not make sense to chain off 'cy'
|
||||
|
||||
## Timeouts {% helper_icon timeout %}
|
||||
|
||||
`.end()` cannot timeout.
|
||||
|
||||
# Examples
|
||||
|
||||
`.end()` is useful when you want to end a chain of commands and force the next command to not receive what was yielded in the previous command.
|
||||
|
||||
@@ -53,6 +53,14 @@ Option | Default | Description
|
||||
`force` | `false` | {% usage_options force uncheck %}
|
||||
`timeout` | {% url `defaultCommandTimeout` configuration#Timeouts %} | {% usage_options timeout .uncheck %}
|
||||
|
||||
## Defaults {% helper_icon defaultAssertion %}
|
||||
|
||||
`.uncheck()` will automatically wait until the element reaches an {% url 'actionable state' interacting-with-elements#Actionability %} before unchecking the element.
|
||||
|
||||
## Timeouts {% helper_icon timeout %}
|
||||
|
||||
`.uncheck()` will wait for the duration of its `timeout` option for its default assertion and any additional assertions to pass.
|
||||
|
||||
# Examples
|
||||
|
||||
## Uncheck
|
||||
|
||||
@@ -35,7 +35,7 @@ Option | Default | Description
|
||||
|
||||
## Yields {% helper_icon yields %}
|
||||
|
||||
`cy.window()` yields the `window` object.
|
||||
`cy.window()` yields the `window` object of the application you're currently visiting.
|
||||
|
||||
## Timeouts {% helper_icon timeout %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user