Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asking for code in console during test execution #101

Closed
f1348y73 opened this issue Aug 5, 2022 · 2 comments
Closed

Asking for code in console during test execution #101

f1348y73 opened this issue Aug 5, 2022 · 2 comments

Comments

@f1348y73
Copy link

f1348y73 commented Aug 5, 2022

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 @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 (#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 #97

So maybe it's because of that or something else?
I'm grateful for any advice!

Best regards

@f1348y73
Copy link
Author

Hello,
ok, shame on me!
This is what happens when you copy too much.

  1. In the example code, the filename of the token is 'token.json'. However, I generated a 'gmail_token.json' and of course did not adapt the code.
  2. It has nothing to do with the entry (urn:ietf:wg:oauth:2.0:oob). If the entry is available, you get to '...accounts.google.com...' and can copy the token from there. Without this entry you get to '...localhost/...' with 'ERR_CONNECTION_REFUSED'. However, the token is included in the URL (...localhost/code=4/0AdQt8...bQ&scope= https ://www.googleapis.com/auth/gmail.readonly)

BR

@1112shivam
Copy link

how much time does it take to start reading emails from your inbox after setting this up?
I also got the same localhost error, I copied the code from URL and passed it to the requested place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants