mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
add new step definition to identify multiple emails by title
This commit is contained in:
parent
68524346c6
commit
29d99e884f
@ -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