prescottprue / cypress-firebase

Cypress plugin and custom commands for testing Firebase projects
MIT License
272 stars 50 forks source link

feat(commands): command for creating a user #88

Open prescottprue opened 4 years ago

prescottprue commented 4 years ago

As mentioned in #14 by @fabiocarneiro there is a need for creating user's during tests:

I would like to have it like this:

cy.firebaseSignUp(email, password) cy.firebaseSignIn(email, password) other authentication options would also be interesting

Notes

Open Questions

fabiocarneiro commented 4 years ago

Although I also think in the direction passwords should not be in the code, I tend to think preventing this is not so much responsibility of the library (warnings are fine). I suggest to focus in two directions:

prescottprue commented 4 years ago

Something of note: Just using a UID that doesn't already exist creates the user if you are using cy.login since it is generating a custom auth token through firebase-admin which does this automatically.

Does that handle your case @fabiocarneiro? I would like to avoid directly advocating for creating new users in tests since it would require cleanup - this would add tons and tons of new accounts even after of a short time of having tests run as part of a CI flow where builds/tests are run regularly

btjones commented 3 years ago

@prescottprue for my use case, I'm using the email returned from an authenticated session to do something in my app. I could likely rewrite my app logic to grab the email in another way but having this built into cypress-firebase would be a nice addition.

By the way, thanks for all of your work on cypress-firebase!

damienromito commented 2 years ago

cy.deleteUser() would be the most usefull because when I test the account creation, I need to manually delete the user in the firebase authentification emulator