0

I'm trying to test email links with Protractor . I understand that checking Email links doesn't come under the scope of e2e testing. I have seen couple of node packages like nodemailer(or) mail-listener. But i would like to check if there are any other approaches?

The scenarios which i would like to cover:

  1. User invitation will be sent to the email, after clicking the link, it would re-directo to a page where i fill in details and proceed with registration.
  2. Reset Password link will be sent to email, after clicking it, it will proceed to change password form, where i fill in details and login in new password.

Any thoughts will be of great help. Thanks!

Angular: 4 Protractor :5.1

Coolbreeze
  • 906
  • 2
  • 15
  • 34
  • Do you want to test that the system *sends* the email correctly with the right link? Or can you assume that the mail with the correct link is sent and only test the rest of the scenario? In the latter case, you can simply start the scenario by navigating to the URL of the link... – Arnon Axelrod Apr 05 '18 at 07:22
  • Possible duplicate of [Fetching values from email in protractor test case](https://stackoverflow.com/questions/29311154/fetching-values-from-email-in-protractor-test-case) – Gunderson Apr 05 '18 at 12:28
  • I have referred that link before posting that question and i don't want to approach that way. That's why i stated in my question that i had referred nodemail or mail-listener – Coolbreeze Apr 06 '18 at 05:42

2 Answers2

1

You can use disposable webmail systems like Inbucket (Open Source Project) . It is an email testing application. This will accept messages for any email address and make them available to view via a web interface.

It has built-in SMTP and POP3 servers which store incoming mail as flat files on disk – no external SMTP or database daemons required.

By using the REST API you can fetch email(content, subject, links etc )

jithinkmatthew
  • 890
  • 8
  • 17
0

You can install mail-listener2 package and create a mailListener instance connecting to a test mailbox and listening for new mails (example on the previous link).

By listening the new mails, and you can trigger the mail sending using protractor actions then start listinging for new mails. Whenever you got the new mail, besides the link, you can check the email headers, subject, content, etc...

You could use a regexp to find the link what you are looking for, then you can start the registration / "change password" process.

Balazs Nemeth
  • 2,333
  • 19
  • 29