testlabauto/gmail-tester — reverse-engineered prompt
Reverse engineered prompt
Build me a small Node.js tool that can connect to a Gmail account and help automated tests confirm that emails were actually received.
I want it to work with Google OAuth credentials, create or reuse a token file, and include a simple setup script that walks me through authorizing the Gmail account. The main thing I need is a function that waits for an email to arrive, checking the inbox every few seconds until it finds a matching message or times out. It should let me search by sender, recipient, subject, date range, and Gmail label. I also want another function that just returns matching messages right away, with the option to include the email body and attachments.
Please make it easy to use from test scripts, especially Cypress style tests. Add clear examples, basic tests, TypeScript definitions if practical, and a README that explains how to get the Google credentials and warns people not to commit credentials or token files. Look up current Gmail API docs online if you need to.
Want more depth? Deep Reverse