So I am writing e2e automation tests using Cypress
. In an effort to keep my tests atomic I try to generate required data for THAT specific test.
So for example I try to start out with a clean database (with migrations ran) and generate a user via the Cypress API request.
The problem is using devise-jwt I need to send along the auth: bearer
token along with it. Usually this is generated on sign-in. So there-in lies the problem: To make a POST
request to create a user, I need to have the token to authenticate....but without a user to sign in as and grab the token I can't know what the token is going to be.
I hate to seed the database with just one user, since I am trying to keep dependencies minimal and tests atomic as possible. Is there some way to "grab/generate" the auth token through devise and use that in my test somehow?
This is a Rails/React app fwiw.