質問

I'm looking to use CasperJS/PhantomJS to automate the testing of a project that extensively uses email as part of its process but I keep running into issues when I need check the content of emails in an automated way.

These tools are very capable of crawling through the HTTP version of many email services, but maintaining tests to keep up with UI changes made to external services is not something I want to do.

Do CasperJS or PhantomJS have the ability to use IMAP or POP3 to retrieve mail, or is there a more common solution that is generally implemented?

役に立ちましたか?

他のヒント

Hi using casperjs\Phantomjs you can navigate and automate however for mailing process you have to use nodejs nodemailer module.Try the following command after installing nodejs.

npm install nodemailer@0.7.1.

This installs the nodemailer package and post that you can install the mail clients like sendgrid sendmail or you can just use the nodemailer direct transport but that may cause some delay in mail delivery.

Kindly check the nodemailer scripts and run the script using: node scriptname.js

PhantomJS (and by extension, Casper) is a web browser - it's not able to use POP or IMAP as far as I know. My first thought as to approach would be to use a separate system for test automation (at least, for those tests that require verifying emails), e.g. using Python, Ruby, or Node.js, invoke Casper via the command line within those tests, and then use a separate tool to check and verify the email.

You could also use a dev smtp server with a web interface like mailcatcher (ruby) or maildev (node).

They also have a rest api, which returns the email in a more stable way than to use the web interface.

I don't tested it, but will soon.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top