Skip to content

Commit

Permalink
move extras docs into API section
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Dec 29, 2017
1 parent 7127273 commit 52823ca
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ beforeEach(() => {
// you get fresh mini-app running in each test
```

### Extras

* Mounted component's actions object is attached to the global `Cypress` variable.
* The `mount` function adds an action `_getState` to the `actions` object, if there is not one already present. This allows you to get the current state of the component for inspection.

```js
Cypress.main.setName('Joe')
expect(Cypress.main._getState().name).to.equal('Joe')
```

## Use

In your Cypress spec files (the example below is from file [cypress/integration/hello-world-spec.js](cypress/integration/hello-world-spec.js)) mount the application, just like you would "normally".
Expand Down Expand Up @@ -95,16 +105,6 @@ See video of tests running on CI on the project's [Cypress Dashboard][cypress da
* `npm run cy:open` starts Cypress GUI, which is great for TDD mode
* `npm run cy:run` runs Cypress headlessly, testing all specs. Same command [runs on CI](.travis.yml) with additional `--record` argument to record the run and send to the [Cypress Dashboard][cypress dashboard url]
## Extras
* Mounted component's actions object is attached to the global `Cypress` variable.
* The `mount` function adds an action `_getState` to the `actions` object, if there is not one already present. This allows you to get the current state of the component for inspection.
```js
Cypress.main.setName('Joe')
expect(Cypress.main._getState().name).to.equal('Joe')
```
### Small print
Author: Gleb Bahmutov <[email protected]> © 2017
Expand Down

0 comments on commit 52823ca

Please sign in to comment.