Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First Cypress integration test: user login. #328

Open
dadiorchen opened this issue Jul 24, 2020 · 3 comments
Open

First Cypress integration test: user login. #328

dadiorchen opened this issue Jul 24, 2020 · 3 comments

Comments

@dadiorchen
Copy link
Collaborator

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
cd server
npm run start:integration

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.

  • Cypress test: login

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
Copy link
Contributor

phips30 commented Aug 17, 2020

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
Copy link
Collaborator Author

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
Copy link
Collaborator

See related issues #330 and #411

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants