Open dadiorchen opened 4 years ago
Hi @dadiorchen , the Cypress tests are supposed to run in the development and release candidates only right? Not on production? Eventually we also need to the delete the basic data after the tests were executed?
Hi, @phips30 I already on this for a while. It's a little difficult to make these all stuff work together, please check my work on this branch: https://github.com/Greenstand/treetracker-admin/tree/organization maybe we can work together on this, I have build a system to seed data and run tests, and run a seeded server for cypress. for your convenience, check these two files as entries: https://github.com/Greenstand/treetracker-admin/blob/organization/server/src/__tests__/integration/integration.ts https://github.com/Greenstand/treetracker-admin/blob/organization/client/cypress/integration/organization.spec.py.js https://github.com/Greenstand/treetracker-admin/tree/organization#for-server
on client-side: to run cypress: npm run cypress
See related issues #330 and #411
Currently, in admin panel, we have installed Cypress and have some experimental tests under client/cypress/integration, now we need to put them together to work correctly, requirements:
A new command under server folder
to run a special server for the integration tests only. The major difference from the normal server is that it would seed data for test automatically.
Seed basic data into the DB
Currently, just need minimal data for user login. Like: a user record in 'amdin_user', and some necessary data like: admin roles. With these data, we can emulate user login in the first integration test.
Build a test to login using the data seeded in DB by the step above. (We already have some basic setting for Cypress and example tests under client/cypress/integration folder)
So in this way, we can run the login test and all the data is self-sufficient, we just need a connection to connect to the database.