DEV Community

loading...
Cover image for How to poll a Gmail inbox using cypress.io

How to poll a Gmail inbox using cypress.io

Lev
・1 min read

Hey! Read about my experience writing custom tasks for the cypress framework.
Read the article on Medium: https://medium.com/@levz0r/how-to-poll-a-gmail-inbox-in-cypress-io-a4286cfdb888

Discussion (4)

Collapse
marcostreng profile image
Marco Streng • Edited

Great work! Thank you so much!

Do you already have an idea how to integrate it into a build pipeline?
My first thought was to store the keys and tokens as secret environment variables and build the configuration objects inside the script. But as i see, i always need to provide a path to the json files and can't call gmail.get_messages() directly with the config objects.

EDIT: I've created a small script, which writes the .json files from the environment variables during the test step in the build pipeline.

Collapse
levz0r profile image
Lev Author

Hi Marco,

We have a pre-build step which copies the files from an external source into our build environment.

You have to init gmail-tester on your machine, upload the credentials files to the build machine, then define the pre-build step.

Another solution is to have templates of the credentials files and to inject the tokens from env. variables. This solution requires some coding/scripting.

Collapse
marcostreng profile image
Marco Streng

Thanks for your quick response Lev!

I think my solution corresponds to your second suggestion and works well so far. Thank you!

Collapse
levz0r profile image
Lev Author

Update: The story was featured on docs.cypress.io/examples/media/blo...

Thanks all!