Type
magento2-module
Verify your e-mails after being delivered with Mailhog wrapper.
magento2-module
MIT
None
None
None
None
None
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
MAILHOG_BASE_URL=http://mailhog:8025/
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"/>
</actionGroup>
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"/>
</actionGroup>
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="[email protected]"/>
</actionGroup>
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="[email protected]"/>
<argument name="subject" value="Welcome to"/>
</actionGroup>
Verify e-mail subject
<actionGroup ref="AssertSubjectActionGroup" stepKey="assertSubject">
<argument name="expectedSubject" value="Welcome to Main Website Store"/>
</actionGroup>
Verify e-mail sender
<actionGroup ref="AssertSenderActionGroup" stepKey="assertSender">
<argument name="expectedSender" value="[email protected]"/>
</actionGroup>
Verify e-mail recipient
<actionGroup ref="AssertRecipientActionGroup" stepKey="assertRecipient">
<argument name="expectedRecipient" value="[email protected]"/>
</actionGroup>
Delete All Messages
<actionGroup ref="DeleteAllMessagesActionGroup" stepKey="deleteAllMessages"/>
Delete currently opened Message
<actionGroup ref="DeleteCurrentMessageActionGroup" stepKey="deleteSingleMessage"/>
Inbox Grid (InboxGridSection
)
InboxContainer
)MessageRow
)NthMessageRow(#)
)NthMessageRowByRecipient(Subject, #)
)NthMessageRowByRecipientAndSubject(Recipient, Subject, #)
)NthMessageRowBySubject(Subject, #)
)DeleteAllButton
)DeleteAllConfirmationButton
)Single Message (MessageSection
)
Sender
)Recipient
)Subject
)Content
)DeleteMessageButton
)Copyright © 2019, Łukasz Bajsarowicz M2.coach
Releases under MIT license, see LICENSE for details.