Hi I've just started looking at using cypress to test my front end and whilst I get most of it I'm trying to get my head around the best approaches to handle access to the secure pages of the site where a user needs to be logged in.
I've pulled in laracasts package for Cypress and understand the concept of using the login function which creates a new user and logs them in.
In my site users have roles (via related model) and to avoid the site breaking I need to ensure the created user has been assigned the roles needed (for example menu's specific to the role etc).
So what's a suitable approach?
Should I seed the database with my user first and then go to login and then visit the page? The downside to this is I'd need to do this for each test which appears adding in extra steps.
Or is there a better method to create the user (with roles) once and have that user logged in without going to the log in form?
Any advice appreciated