https://github.com/currents-dev/example-setup-before
https://github.com/currents-dev/example-setup-before
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/currents-dev/example-setup-before
- Owner: currents-dev
- Created: 2023-05-24T03:04:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-14T19:18:31.000Z (over 2 years ago)
- Last Synced: 2025-03-25T04:52:20.995Z (11 months ago)
- Language: JavaScript
- Size: 547 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Example: executing async tasks before each spec
Executing an async task for each Cypress spec file
[before](https://github.com/currents-dev/example-setup-before/blob/8342af5dcb02ebb72a2c4312c015d869aed7ea71/cypress/support/e2e.js#L23) method of `cypress/support/e2e.js` is automatically included in each spec file. The method invokes an async [`cy.task`](https://docs.cypress.io/api/commands/task) that runs in NodeJS, and can be used to spin up a testing environment, or execute any other setup task e.g. seeding a DB.
Take a look at `cypress.config.js` that defines the setup task within `setupNodeEvents` function.