No description or website provided.
PHP
Permalink
Failed to load latest commit information.
src Added countEmailsByCriteria() Jan 6, 2016
LICENSE.md test Sep 18, 2015
README.md Added countEmailsByCriteria() Jan 6, 2016
composer.json test Sep 18, 2015
phpunit.xml.dist Adjusted test files Sep 18, 2015
test_bootstrap.php Adjusted test files Sep 18, 2015

README.md

Installation

$ composer require ahmedsamy/codeception-smtp-mail

Configuration

in acceptance.yml

modules:
    enabled:
        - Smtp
    config:
        Smtp:
            username: name@email.com
            password: password

Build codeception

$ bin/codecept build

Available methods

  • seeEmail($criteria)
  • canSeeEmail($criteria)
  • seeEmail($criteria)
  • cantSeeEmail($criteria)
  • dontSeeEmail($criteria)
  • openEmail($criteria)
  • grabEmail()
  • grabLinkFromEmail($url)
  • clickInEmail($url)
  • canSeeLinkInEmail($url)
  • seeLinkInEmail($url)
  • cantSeeLinkInEmail($url)
  • dontSeeLinkInEmail($url)
  • canSeeEmailAttachmentsCount($count)
  • canSeeEmailAttachment($name)
  • countEmailsByCriteria($criteria)

  • $criteria is according to imap syntax, see http://php.net/manual/en/function.imap-search.php

Examples

Checking email with subject and date

$I->seeEmailBy('SUBJECT "HOWTO be Awesome" SINCE "8 August 2008"');

$I->canSeeEmail('SUBJECT "Welcome Email"');

$I->openEmail('SUBJECT "Open me"');

$I->canSeeEmail('SUBJECT "good words"');

$I->seeLinkInEmail('http://google.com/awesome');

$I->clickInEmail("http://google.com/awesome");

$I->grabLinkFromEmail("http://google.com/awesome");

$I->canSeeEmailAttachmentsCount(2);

$I->canSeeEmailAttachment('contract.pdf'); //accepts full file name or part of it

Configuration reference

Smtp:
    username: username@domain.com #required
    password: password123 #required
    imap_path: {imap.gmail.com:993/imap/ssl}INBOX  #imap path defaults to gmail config
    wait_interval: 1 #waiting interval between trials in seconds
    retry_counts: 3 # how many trials till
    attachments_dir: tests/_data #where email attachments are stored
    auto_clear_attachments: true #whether to clear attachments folder every run or not

TODOs

  • Write tests
  • Add travis.yml