Skip to content

Commit

Permalink
confirm the collected object
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Jan 10, 2022
1 parent 53ba92f commit b06781f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ public
redirects
people.json
person.json
out.json
7 changes: 7 additions & 0 deletions docs/recipes/collect-headings.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,18 @@ cy.get('section')
})
})
.then(() => {
// confirm the collected data
expect(sections).to.deep.equal({
Install: ['Step 1', 'Step 2', 'Step 3'],
Use: ['Case 1', 'Case 2'],
})
// save into a file
cy.writeFile('out.json', sections)
})
```

**Tip:** check out [cy-spok](https://github.com/bahmutov/cy-spok) that lets you write complex object assertions with ease.

<!-- fiddle-end -->

See also [cy.each recipe](./each-example.md).

0 comments on commit b06781f

Please sign in to comment.