mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Merge pull request #36 from jeffreyguo/pulls/find-email-by-title
add new step definition to identify multiple emails by from to and title
This commit is contained in:
commit
1af1620fb4
@ -142,10 +142,28 @@ class EmailContext extends BehatContext
|
||||
assertNotNull($linkEl);
|
||||
$link = $linkEl->attr('href');
|
||||
assertNotNull($link);
|
||||
|
||||
|
||||
return new Step\When(sprintf('I go to "%s"', $link));
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^I click on the "([^"]*)" link in the email (to|from) "([^"]*)" titled "([^"]*)"$/
|
||||
*/
|
||||
public function iGoToInTheEmailToTitled($linkSelector, $direction, $email, $title)
|
||||
{
|
||||
$to = ($direction == 'to') ? $email : null;
|
||||
$from = ($direction == 'from') ? $email : null;
|
||||
$match = $this->mailer->findEmail($to, $from, $title);
|
||||
assertNotNull($match);
|
||||
|
||||
$crawler = new Crawler($match->Content);
|
||||
$linkEl = $crawler->selectLink($linkSelector);
|
||||
assertNotNull($linkEl);
|
||||
$link = $linkEl->attr('href');
|
||||
assertNotNull($link);
|
||||
return new Step\When(sprintf('I go to "%s"', $link));
|
||||
}
|
||||
|
||||
/**
|
||||
* Assumes an email has been identified by a previous step,
|
||||
* e.g. through 'Given there should be an email to "test@test.com"'.
|
||||
|
Loading…
Reference in New Issue
Block a user