Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

MFTF to MailHog wrapper


What is it about?

  • Magento Functional Testing Framework is complete Acceptance Testing solution delivered OOTB with Magento 2.
  • MailHog is a tool installed along the web project, used to test e-mail sending during development of application.

Why you should use it?

Does your project look professional, if you deliver to your client a web store which welcomes Customers after registration with e-mail of Subject: Welcome to {{StoreName}} and contents beginning with Hello {{FirstName}} {{LastName}},. I think it's not. That's why I want to help you with avoiding such embarassing moments.

The best way is to test what e-mails are sent to the customers, just like the live website does. But we should not reinvent the wheel! There are tons of solutions that help you to verify how e-mails are sent, without using real SMTP account. One of them is MailHog, which behaves (for application) just like regular SMTP server, except the fact, that messages are not sent over the Internet.



  • Get the package

    $ composer require m2coach/mftf-mailhog-wrapper
  • Configure MailHog URL in /dev/tests/acceptance/.env



Action Groups provided

  • Verify if Inbox is empty:

    <actionGroup ref="OpenInboxActionGroup" stepKey="openInbox"/>
    <actionGroup ref="AssertNoMessagesActionGroup" stepKey="assertNoMessages"/>
  • Open Message by it's Index (nth row)

    <actionGroup ref="OpenInboxActionGroup" stepKey="openInbox"/>
    <actionGroup ref="OpenNthMessageActionGroup" stepKey="openNthMessage">
        <argument name="row" value="2"/>
  • Open Message by it's Subject and Index

     <actionGroup ref="OpenInboxActionGroup" stepKey="openInbox"/>
     <actionGroup ref="OpenNthMessageBySubjectActionGroup" stepKey="openNthMessage">
         <argument name="row" value="1"/>
         <argument name="subject" value="Welcome to"/>
  • Open Message by it's Recipient and Index

     <actionGroup ref="OpenInboxActionGroup" stepKey="openInbox"/>
     <actionGroup ref="OpenNthMessageByRecipientActionGroup" stepKey="openNthMessage">
         <argument name="row" value="1"/>
         <argument name="recipient" value=""/>
  • Open Message by it's Recipient, Subject and Index

     <actionGroup ref="OpenInboxActionGroup" stepKey="openInbox"/>
     <actionGroup ref="OpenNthMessageByRecipientAndSubjectActionGroup" stepKey="openNthMessage">
         <argument name="row" value="1"/>
         <argument name="recipient" value=""/>
         <argument name="subject" value="Welcome to"/>
  • Verify e-mail subject

     <actionGroup ref="AssertSubjectActionGroup" stepKey="assertSubject">
         <argument name="expectedSubject" value="Welcome to Main Website Store"/>
  • Verify e-mail sender

     <actionGroup ref="AssertSenderActionGroup" stepKey="assertSender">
         <argument name="expectedSender" value="learn@mftf.test"/>
  • Verify e-mail recipient

     <actionGroup ref="AssertRecipientActionGroup" stepKey="assertRecipient">
         <argument name="expectedRecipient" value="subscribe@mftf.test"/>
  • Delete All Messages

    <actionGroup ref="DeleteAllMessagesActionGroup" stepKey="deleteAllMessages"/>
  • Delete currently opened Message

    <actionGroup ref="DeleteCurrentMessageActionGroup" stepKey="deleteSingleMessage"/>

Selectors provided

  • Inbox Grid (InboxGridSection)

    • Inbox Container (InboxContainer)
    • Message row (MessageRow)
    • Message row by it's index (NthMessageRow(#))
    • Message row by recipient and it's index (NthMessageRowByRecipient(Subject, #))
    • Message row by recipient, subject and it's index (NthMessageRowByRecipientAndSubject(Recipient, Subject, #))
    • Message row by subject and it's index (NthMessageRowBySubject(Subject, #))
    • Delete All Messages button (DeleteAllButton)
    • Delete All Messages confirmation button (DeleteAllConfirmationButton)
  • Single Message (MessageSection)

    • Sender (Sender)
    • Recipient (Recipient)
    • Subject (Subject)
    • Contents (Content)
    • Delete Message button (DeleteMessageButton)


Copyright © 2019, Łukasz Bajsarowicz

Releases under MIT license, see LICENSE for details.


With MFTF to MailHog wrapper you get the possibility of testing not only the Magento application layer, but also the e-mails that are sent from Magento.







No packages published