First Cypress Test
Let's write our first Cypress test.
We'll cover the following...
Pre-requisites
A good unit or integration test needs to start from a well-known situation.
For a smooth testing process, we can expose certain REST API endpoints that will put the database in a well-known state. This could be empty, with a few test users, or with many users to test pagination, etc.
Let’s start by adding IntegrationTestController to src/main/java/test:
- 
Create a @RestControllerto call the endpoints from the Cypress tests.
- 
All endpoints will be served at /api/integration-test.
- 
These endpoints should only be started when running as a test. This mustn’t be exposed when running on production as it wipes the complete database. 
- 
Inject the UserServicein order to create the default users.
- 
Add an endpoint /reset-dbso ...