mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 15:05:32 +00: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
@ -146,6 +146,24 @@ class EmailContext extends BehatContext
|
|||||||
return new Step\When(sprintf('I go to "%s"', $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,
|
* Assumes an email has been identified by a previous step,
|
||||||
* e.g. through 'Given there should be an email to "test@test.com"'.
|
* e.g. through 'Given there should be an email to "test@test.com"'.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user