I'm developing a Chrome extension for a nonprofit that essentially converts their inbox into a more useful help desk with drag-and-droppable cards that will automatically forward emails to the right place. I've got the app working essentially as intended, but I'm working through designing some e2e tests to help me/other people maintain this going forward. I'm still thinking it through, but I am going to try taking the approach outlined here with selenium + cucumber + chai. Up until now, I've just been manually manipulating the UI to verify things work as expected, which has worked fine, but I've been using my own personal Gmail (under the nonprofit domain), which has resulted in me unintentionally responding to some emails through the app. Ideally, the e2e tests I set up will do this work automatically, but I'd like to run the tests against fake/dummy data so I don't accidentally send emails while running the tests, but I'm not sure what the best approach is.
I was thinking of creating a few dummy Gmail accounts purely for testing purposes and then running some code at the beginning of testing that would populate the Gmail accounts with some emails/replies/forwards and then clear the accounts at the end of testing to reset the stage. I imagine I can do all this through the Gmail API, but I wasn't sure if I might get flagged as a bot account or if I should be concerned about API/rate limit, so I was wondering if anyone else had experience with this type of situation?
I was able to come up with a solution that works well for me, so just posting to share my findings.
I think in an ideal world where I am developing under a Google Workspace account, I could have set up a service account with delegated access that could have programmatic access over some test accounts, but I didn't feel like purchasing a Workspace account for this small project (and I didn't feel like associating it with some of the Workspace accounts that I currently have access to), so that did not work for me.
In reality what worked was creating a handful of test gmail accounts, enabling the relevant dev access on those accounts, and finally generating keys so I could programmatically manipulate the inboxes. Then with selenium, I was able to log into individual accounts by leveraging existing Profile folders on my machine. Most likely the way I have it set up will only fully work on Windows (just because of path weirdness), but that's sufficient for me for now.