-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
10 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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". | ||
|
@@ -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 | ||
|