I'm developing a flutter application which interacts with a supabase backend for both API and Auth. The only authentication is via email, specifically by means of magic link.
The problem: I want to write some end-to-end test, and to do that I'm using patrol. Of course I cannot log into the app via the magic link: that would mean opening the web browser, having the email inbox set on the virtual device etc.
The possible solution: at patrol build time, set environment variables read by String.fromEnvironment
in order to use user+password credentials login when testing.
pros:
- it works
cons:
- This means extra code - although very little - that will only exists for testing purposes: checking if it's running with tests env vars and using the email+password way to log in
- The compiled patrol outputs will have test credentials which are really easy to extract. Although it's using a test environment this should be avoided, because I compile the apk and iOS packages locally and they are sent to a public repo in order to save github actions' resources
I don't know any other way to accomplish this, if not mocking all the supabase's calls. What could I do?