Greenstand / treetracker-admin-api

Legacy API microservice for the admin panel
GNU Affero General Public License v3.0
31 stars 81 forks source link

First Cypress integration test: user login. #328

Open dadiorchen opened 4 years ago

dadiorchen commented 4 years ago

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:

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.

phips30 commented 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?

dadiorchen commented 4 years ago

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

nmcharlton commented 3 years ago

See related issues #330 and #411