Gmail

Email is one of those things that people often don't test very much. Who actually tests their contact form?

But wouldn't you want to make sure that people's attempts to contact you are making it through?

With that in mind you can use the Magium Gmail component to make sure that any communication that has being sent to a Gmail account is working properly.

Getting started is easy to do. First, you will need to require the magium/gmail library as part of your project

composer require magium/gmail

Then you will need to configure your credentials by creating the file configuration/Magium/Gmail/Identites/Gmail/Account.php.


$this->emailAddress = '[email protected]';
$this->password     = 'your password';

Then in your test you can choose from navigating via either a subject-equals or a subject-contains approach.


use Magium\AbstractTestCase;
use Magium\Gmail\Actions\Gmail\Login;
use Magium\Gmail\Navigators\Gmail\SubjectEquals;

class NavigateToEmailTest extends AbstractTestCase
{

    public function testNavigateToEmailWhereSubjectEquals()
    {
        $this->getAction(Login::ACTION)->login();
        $this->getNavigator(SubjectEquals::NAVIGATOR)->navigateTo('Google Alert - magento');
    }
}

From there you can do any Selenium assertions that you would like to do.