gmail-tester
gmail-tester copied to clipboard
Asking for code in console during test execution
Hello everyone,
I'm currently looking for ways to check emails within cypress and came across this library. Since I encountered a problem in my test project, I thought it might be due to the cypress version (10.3.1). So I cloned the gmail-tester repository and tried the cypress example inside. Steps:
- git clone...
- cd examples/cypress
- npm install
- npm install --save-dev gmail-tester
- Copied my credentials.json to examples/cypress
- node node_modules/gmail-tester/init.js ./credentials.json ./gmail_token.json <myMailAddress>@gmail.com
- Customization in index.js
path.resolve(__dirname, "../../credentials.json"),
path.resolve(__dirname, "../../gmail_token.json.json")
- gmail.spec.js Removed all options except subject (and there is an unread mail with that subject in the inbox)
- npm cypress open
If I now run gmail.spec.js the console shows (see last line):
:
Authorize this app by visiting this url: https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.readonly&response_type=code&client_id= 94167587089-mclmf5ic7i2uk8sbtv0v1umvq1rcju9b.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob
Enter the code from that page here:
:
Here the console stops and the cypress test runs into a timeout. I have this behavior in my test project with Cypress V. 10.3.1 and gmail-test ^1.3.5 but also in the example project from https://github.com/levz0r/gmail-tester with Cypress ^5.1.0 and gmail- testing ^1.3.5.
Does anyone know what I'm doing wrong?
One more point:
There is a ticket here from 07/22/2022 Title: localhost redirect (https://github.com/levz0r/gmail-tester/issues/97).
Is it maybe because of the credentials.json?
In each example, after the download, the JSON file contains:
"redirect_uris": [ "urn:ietf:wg:oauth:2.0:oob", "http://localhost" ]
If I download the JSON file, urn:ietf:wg:oauth:2.0:oob is not included and I enter it manually.
Without this entry I had the same behavior as https://github.com/levz0r/gmail-tester/issues/97
So maybe it's because of that or something else? I'm grateful for any advice!
Best regards