public function TestSubContext::assertRegionElementText in Panopoly 7
Same name and namespace in other branches
- 8.2 modules/panopoly/panopoly_test/behat/steps/panopoly_test.behat.inc \TestSubContext::assertRegionElementText()
@Then I should see :text in the :tag element in the :region region
File
- modules/
panopoly/ panopoly_test/ behat/ steps/ panopoly_test.behat.inc, line 811 - Provide Behat step-definitions for generic Panopoly tests.
Class
Code
public function assertRegionElementText($text, $tag, $region) {
$regionObj = $this
->getRegion($region);
$elements = $regionObj
->findAll('css', $tag);
if (empty($elements)) {
throw new \Exception(sprintf('The element "%s" was not found in the "%s" region on the page %s', $tag, $region, $this
->getSession()
->getCurrentUrl()));
}
$found = FALSE;
foreach ($elements as $element) {
if ($element
->getText() == $text) {
$found = TRUE;
break;
}
}
if (!$found) {
throw new \Exception(sprintf('The text "%s" was not found in the "%s" element in the "%s" region on the page %s', $text, $tag, $region, $this
->getSession()
->getCurrentUrl()));
}
}