API Testing and Browser Testing automatically, using Cypress, ExpressJS and Mongoose
This app creates an ExpressJS server, which runs a cronjob that executes all Cypress tests at set intervals (default is every minute).
At the end of the testing process, a report will be generated and saved into a MongoDB database. Result of the latest report will be returned using a REST API.
The server also support generating tests via POST requests as well.
- Clone this repo
- Run
npm install
to install dependencies - Create
.env
file at the root app folder
CRON_SCHEDULE=*/1 * * * *
MONGO_URI=mongodb://<username>:<password>@<host>:<port>/<database>
- Add your test cases to cypress/e2e/. Guide on how to write these tests can be found here.
- Run the app with
npm start
- To get result on the latest test, make a GET request to the root route (e.g.
http://localhost:8080
) - To create a test, make a POST request to the /create route (e.g.
http://localhost:8080/create
). The body of the request should include the raw JS script for a test. Example body here.