Skip to content

About

Example that resets the database before every spec, queries the database from the test

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Repository files navigation

Cypress DB example ci status

Install and use

npm install

To run all Cypress specs

npm run local

To start the API server and open Cypress for local interactive mode

npm run dev

Notes

The application in app.js and api.js uses Objection.js to provide REST API on top of Sqlite3 database.

The Cypress spec files in cypress/integration test the app by executing cy.request calls. To reset the database data and query the tables directly, we can use cy.task commands inside cypress/plugins/index.js file.

The tests also show how to set up the data before the spec runs, both in the interactive cypress open and non-interactive cypress run modes. See the plugins file and the matt-damon-spec.js files.

We also use Chai assertions inside the plugins file to validate the data.

We collect the backend code coverage following the instructions in cypress-io/code-coverage. After each run you can find the reports in the "coverage" folder.

Coverage

For more information about the backend code coverage, read the blog post Backend Code Coverage from Cypress API tests

About

Example that resets the database before every spec, queries the database from the test

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Contributors

Languages