Skip to content

Add Mailosaur to tests #16

@peterjaap

Description

@peterjaap

For some tests like reset password nieuws, newsletter subscription, order confirmation etc mails need te be received and read. For this purpose Mailosaur can be used. A mailosaur API-key and account will be needed, the API-key needs to be added to the cypress.json "env" object or to a cypress.env.json file. And the serverId needs to be added to the tests where mailosaur is used.

// cypress.json
"env": {
    "MAILOSAUR_API_KEY": "some-hash"
}
// sometest.spec.js
const serverId = 'SERVER_ID';
const testMail = `something@${serverId}.mailosaur.net`;

cy.mailodaurGetMessage(serverId, {
    sentTo: testEmail
}).then(email => {
    // Do stuff
})
  • Install mailosaur
  • Make sure cypress can read sent mails
  • Make sure it is optional since it requires an extra dependency

Tests

  • A confirmation email will be sent after placing the order
  • If payment is made an invoice will be sent

Example:

it('can receive a confirmation mail that an order has been placed', () => {
    // TODO: implement mailosaur
})

it('can receive an invoice through the mail when a payment is completed', () => {
    // TODO: implement mailosaur
})

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions