4

I have been doing some research about how to do verification automation on sent emails - but haven't really found anything that has worked thus far.

Here is what I need to test:

We have a customer portal where our customer service reps set a "Template" to be used for email and SMS communications. I am tasked with verifying that the email/SMS that is sent from us is received at our customers inbox with customer data and styling being the same.

Our team has internal API's that I can use to execute the JSON requests to send the communications. Personally I have attempted to test this with Selenium by logging into a Gmail account and verifying the text that comes into the email, but it doesn't really check for the stylistic viewing of the email in the inbox. I haven't found any suitable SMS platform to see text messages. Any help on this issue would be appreciated.

Update:

Manual testing is not an option because we have 20 or so communication types and about 10 templates in each one. It takes a lot of time to test manually, so it really is a good candidate for automation with our small-er test team

4
  • 2
    Not the voter - but is there a reason you need to use automation for this testing? Without using one of the visual tools, your best option is going to be the human eyeball and checking any time your template changes.
    – Kate Paulk
    Aug 15, 2019 at 18:25
  • This testing takes up a lot of time to do - we 20 or so communication types and about 10 templates in each one. Really is a good candidate for automation with our small-er test team.
    – DEnumber50
    Aug 15, 2019 at 19:06
  • 1
    With that much to manage, I can see the attraction. It's going to be challenging without a visual tool that can do fuzzy recognition on the appearance of the emails.
    – Kate Paulk
    Aug 15, 2019 at 19:56
  • The visual test might be difficult to automate. For just checking content with gmail, you might use their API, not Selenium. It would most likely save you time (both execution time and time spent maintaining the tests).
    – pavelsaman
    Jan 13, 2020 at 10:27

3 Answers 3

3

Another similar service is mailosaur.

Along with an API you can use to retrieve SMS (still beta as of September 2020) and emails, you can also use a number of packages/modules for a variety of testing frameworks.

An example in TestCafe:

import config from '../config';
import { customAlphabet } from 'nanoid';
import axios from 'axios';
import Newsletter from '../Objects/newsletter';

async function request (reqObject) {  
    try {
        return await axios(reqObject);            
    } catch (error) {
        console.error(error);
    }
}

function serverId () {
    return process.env.MAILOSAUR_SERVER_ID;
}

function mailosaurFullEmail (id) {
    return (id ? id : nanoid()) + '.' + serverId() 
        + '@' + config.mailosaurDomain;
}

fixture `Newsletter`    
    .page(baseUrl);

test             
    ('Sign Up For Newsletter', async t => {

        const id = (customAlphabet('1234567890', 10))();

        await t
            .typeText(Newsletter.newsEmailInput, mailosaurFullEmail(id))
            .click(Newsletter.consent)
            .click(Newsletter.sendButton);

        let res = await request({
            method: 'POST',
            url: config.mailosaurUrlEmail + serverId(),
            headers: {
                'Authorization': 'Basic ' 
                    + Buffer.from(process.env.MAILOSAUR_API_KEY)
                        .toString('base64'),
                'Content-Type': 'application/json'
            },
            data: {
                sentTo: mailosaurFullEmail(id)
            }
        });       
        
        await t
            .expect(res.status).eql(200);
});

and the relevant config values:

{
    "mailosaurUrlEmail": "https://mailosaur.com/api/messages/await?server=",
    "mailosaurDomain": "mailosaur.io"
}

This endpoint will return 200 OK if the message was found and 204 if not.

1

For (automated) testing of email content I have used mailtrap.io in the past.

I think you can use ClickSend for receiving SMS (and email) messages.

Both have an API to send/receive and parse messages send to their service. So you should be able to programmatically test that SMS/Email is send/received and check the content.

1
  • Looks like ClickSend is just a sending service - not really for receiving messages. Will look into mailtrap.io though.
    – DEnumber50
    Aug 19, 2019 at 20:32
0

I was able to accomplish this by using swiftpigeon.io It worked great for automating flows with the API's they have. As well as manual testing via the UI dashboard they offer. They even offer free accounts for email testing only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.