gmail:check from within a cypress test timesout Error [ERR_IPC_CHANNEL_CLOSED] [ERR_IPC_CHANNEL_CLOSED]: Channel closed
See original GitHub issueUsing this within cypress trying to check an email, eventually want to extract and click the verify link. When it hits the check mail step it just falls over, error not overly helpful, wonder if you can advise what I might have got wrong. I followed this post: https://levz0r.medium.com/how-to-poll-a-gmail-inbox-in-cypress-io-a4286cfdb888
Oh, in that post the test says “email not found” but I think its suppose to say email found?? Anyways…
Here is my index.js file
const path = require("path");
const gmail = require("gmail-tester");
module.exports = (on, config) => {
on("task", {
"gmail:check": async args => {
const { from, to, subject } = args;
const email = await gmail.check_inbox(
path.resolve(__dirname, "credentials.json"), // credentials.json is inside plugins/ directory.
path.resolve(__dirname, "gmail_token.json"), // gmail_token.json is inside plugins/ directory.
subject,
from,
to,
30, // Poll interval (in seconds)
60 // Maximum poll interval (in seconds). If reached, return null, indicating the completion of the task().
);
console.log('gmail check is working');
return email;
}
});
};
here is my test.js file:
it('link is no longer valid, we can request and new one and the new link works', () => {
cy.visit('/urlforresetform');
// Check we get the email and its content is correct.
const test_id = new Date().getTime();
const incoming_mailbox = `myemail+${test_id}@gmail.com`;
const password = 'somepassword';
cy.get("#edit-name").type(incoming_mailbox);
cy.get("#edit-submit").click();
cy
.task("gmail:check", {
from: "mysitesemailaddress",
to: incoming_mailbox,
subject: "emailtitle"
})
.then(email => {
console.log('we have an email??');
assert.isNotNull(email, `Email was found!`);
});
})
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Random failure [ERR_IPC_CHANNEL_CLOSED]: Channel ...
The last test in my cypress suite randomly fails in CI. It seems to be un-related to the test itself, but some cleanup...
Read more >cypress-io/cypress - Gitter
We've stopped running your tests because a plugin crashed. Error [ERR_IPC_CHANNEL_CLOSED] [ERR_IPC_CHANNEL_CLOSED]: Channel closed
Read more >Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed when ...
After lots of hours of debugging the problem was that a custom node dependency required a configuration file that wasn't present in the ......
Read more >How To Stop Your Cypress Tests Timing Out - Jon D Jones
This will then allow the test to continue rather than to timeout and fail. To blacklist a host within Cypress, within your cypress.json...
Read more >Boost your Cypress end-to-end Tests - andreybleme
In the previous post I have shared how to configure continuous ... Cypress test taking too much time ... Cypress test timeout error....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The main issue is the check_inbox was getting called with 7 variables, what it actually needs is 3 variables, the 2 json files and then an options variable, that was the main problem solver for me, the code above works so give it a try. Hope this helps.
Was already on latest version. Got it working, the examples are a bit out of date. I wasnt passing the data correctgly to start with.