├── .circleci └── config.yml ├── .github └── mailhog-demo.gif ├── .gitignore ├── LICENSE.md ├── README.md ├── Test └── Mftf │ ├── ActionGroup │ ├── AssertNoMessagesActionGroup.xml │ ├── AssertRecipientActionGroup.xml │ ├── AssertSenderActionGroup.xml │ ├── AssertSubjectActionGroup.xml │ ├── DeleteAllMessagesActionGroup.xml │ ├── DeleteCurrentMessageActionGroup.xml │ ├── OpenInboxActionGroup.xml │ ├── OpenNthMessageActionGroup.xml │ ├── OpenNthMessageByRecipientActionGroup.xml │ ├── OpenNthMessageByRecipientAndSubjectActionGroup.xml │ └── OpenNthMessageBySubjectActionGroup.xml │ ├── Page │ └── InboxPage.xml │ └── Section │ ├── InboxGridSection.xml │ └── MessageSection.xml ├── composer.json ├── etc └── module.xml └── registration.php /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | docker: 5 | - image: php:7.2 6 | steps: 7 | - checkout -------------------------------------------------------------------------------- /.github/mailhog-demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/M2Coach/MFTF-MailHog-Wrapper/7a08d084df05b7e18e076555181388ced004c005/.github/mailhog-demo.gif -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Łukasz Bajsarowicz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MFTF to MailHog wrapper 2 | 3 | [![CircleCI](https://circleci.com/gh/M2Coach/MFTF-MailHog-Wrapper/tree/master.svg?style=svg)](https://circleci.com/gh/M2Coach/MFTF-MailHog-Wrapper/tree/master) 4 | 5 | ## What is it about? 6 | 7 | * [Magento Functional Testing Framework](https://github.com/magento/magento2-functional-testing-framework/) is complete Acceptance Testing solution delivered OOTB with Magento 2. 8 | * [MailHog](https://github.com/mailhog/MailHog) is a tool installed along the web project, used to test e-mail sending during development of application. 9 | 10 | ## Why you should use it? 11 | 12 | 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. 13 | 14 | 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. 15 | 16 | ## Demo 17 | 18 | ![](.github/mailhog-demo.gif) 19 | 20 | ## Installation 21 | 22 | * Get the package 23 | ```bash 24 | $ composer require m2coach/mftf-mailhog-wrapper 25 | ``` 26 | 27 | * Configure MailHog URL in `/dev/tests/acceptance/.env` 28 | ``` 29 | MAILHOG_BASE_URL=http://mailhog:8025/ 30 | ``` 31 | 32 | ## Usage 33 | 34 | ### Action Groups provided 35 | 36 | * Verify if Inbox is empty: 37 | 38 | ```xml 39 | 40 | 41 | ``` 42 | 43 | * Open Message by it's Index (nth row) 44 | 45 | ```xml 46 | 47 | 48 | 49 | 50 | ``` 51 | 52 | * Open Message by it's Subject and Index 53 | 54 | ```xml 55 | 56 | 57 | 58 | 59 | 60 | ``` 61 | 62 | * Open Message by it's Recipient and Index 63 | 64 | ```xml 65 | 66 | 67 | 68 | 69 | 70 | ``` 71 | 72 | * Open Message by it's Recipient, Subject and Index 73 | 74 | ```xml 75 | 76 | 77 | 78 | 79 | 80 | 81 | ``` 82 | 83 | * Verify e-mail subject 84 | 85 | ```xml 86 | 87 | 88 | 89 | ``` 90 | 91 | * Verify e-mail sender 92 | 93 | ```xml 94 | 95 | 96 | 97 | ``` 98 | 99 | * Verify e-mail recipient 100 | 101 | ```xml 102 | 103 | 104 | 105 | ``` 106 | 107 | * Delete All Messages 108 | ```xml 109 | 110 | ``` 111 | 112 | * Delete currently opened Message 113 | ```xml 114 | 115 | ``` 116 | 117 | ### Selectors provided 118 | 119 | * Inbox Grid (`InboxGridSection`) 120 | 121 | * Inbox Container (`InboxContainer`) 122 | * Message row (`MessageRow`) 123 | * Message row by it's index (`NthMessageRow(#)`) 124 | * Message row by recipient and it's index (`NthMessageRowByRecipient(Subject, #)`) 125 | * Message row by recipient, subject and it's index (`NthMessageRowByRecipientAndSubject(Recipient, Subject, #)`) 126 | * Message row by subject and it's index (`NthMessageRowBySubject(Subject, #)`) 127 | * Delete All Messages button (`DeleteAllButton`) 128 | * Delete All Messages confirmation button (`DeleteAllConfirmationButton`) 129 | 130 | * Single Message (`MessageSection`) 131 | 132 | * Sender (`Sender`) 133 | * Recipient (`Recipient`) 134 | * Subject (`Subject`) 135 | * Contents (`Content`) 136 | * Delete Message button (`DeleteMessageButton`) 137 | 138 | ## License 139 | 140 | Copyright © 2019, Łukasz Bajsarowicz [M2.coach](https://m2.coach) 141 | 142 | Releases under MIT license, see [LICENSE](LICENSE.md) for details. -------------------------------------------------------------------------------- /Test/Mftf/ActionGroup/AssertNoMessagesActionGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Test/Mftf/ActionGroup/AssertRecipientActionGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | grabRecipient 13 | {{expectedRecipient}} 14 | 15 | 16 | -------------------------------------------------------------------------------- /Test/Mftf/ActionGroup/AssertSenderActionGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | grabSender 13 | {{expectedSender}} 14 | 15 | 16 | -------------------------------------------------------------------------------- /Test/Mftf/ActionGroup/AssertSubjectActionGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | grabSubject 13 | {{expectedSubject}} 14 | 15 | 16 | -------------------------------------------------------------------------------- /Test/Mftf/ActionGroup/DeleteAllMessagesActionGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Test/Mftf/ActionGroup/DeleteCurrentMessageActionGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Test/Mftf/ActionGroup/OpenInboxActionGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Test/Mftf/ActionGroup/OpenNthMessageActionGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Test/Mftf/ActionGroup/OpenNthMessageByRecipientActionGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Test/Mftf/ActionGroup/OpenNthMessageByRecipientAndSubjectActionGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Test/Mftf/ActionGroup/OpenNthMessageBySubjectActionGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Test/Mftf/Page/InboxPage.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |
6 | 7 | 8 | -------------------------------------------------------------------------------- /Test/Mftf/Section/InboxGridSection.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | -------------------------------------------------------------------------------- /Test/Mftf/Section/MessageSection.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "m2coach/mftf-mailhog-wrapper", 3 | "description": "Verify your e-mails after being delivered with Mailhog wrapper.", 4 | "require": { 5 | "php": "^7.1", 6 | "magento/magento2-functional-testing-framework": "^2.3.0", 7 | "magento/magento-composer-installer": "*" 8 | }, 9 | "type": "magento2-module", 10 | "version": "0.1.2", 11 | "license": [ 12 | "MIT" 13 | ], 14 | "autoload": { 15 | "files": [ 16 | "registration.php" 17 | ], 18 | "psr-4": { 19 | "M2Coach\\MFTFMailHogWrapper\\": "" 20 | } 21 | }, 22 | "extra": { 23 | "map": [ 24 | [ 25 | "*", 26 | "M2Coach/MFTFMailHogWrapper" 27 | ] 28 | ] 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /registration.php: -------------------------------------------------------------------------------- 1 |