This is a npm module to search for emails sent to mailosaur mail server - by Subject and Links (in email html).
npm install email-notification
Set following environment variables on your machine/CI variables/.env:
MAILOSAUR_API_KEY = api key for your mailosaur account
MAILOSAUR_SERVER_ID = server id for your mailosaur account
Sample usage example from a UI solution page object and its calling in test:
const email = require('email-notification');
const emailSubject = email.emailBySubject();
This method would return the subject for matching email
async emailConfirmation(completeEmailAddress, searchByText) {
await emailSubject.getEmailSubject(completeEmailAddress, searchByText);
}
calling from test (search by subject-text)
await page.emailConfirmation('[email protected]', 'Reset your password');
const email = require('email-notification');
const emailLink = email.emailByLink();
This method would return the link from matching email
async emailConfirmation(completeEmailAddress, searchByLinkHref) {
await emailLink.getEmailData(completeEmailAddress, searchByLinkHref);
}
calling from test ( search by link href in email)
await page.emailConfirmation('[email protected]', 'mailto:[email protected]');