public function FeatureContext::assertRegionElementIsInState in Acquia Lift Connector 7
Same name and namespace in other branches
- 7.2 behat-tests/features/bootstrap/FeatureContext.php \FeatureContext::assertRegionElementIsInState()
@Then I should see :selector element in the :region region is :state for editing
Throws
\Exception If the region or element cannot be found or is not in a specified state.
File
- behat-tests/
features/ bootstrap/ FeatureContext.php, line 424
Class
- FeatureContext
- Defines application features from the specific context.
Code
public function assertRegionElementIsInState($selector, $region, $state) {
$state_class = array(
'highlighted' => 'acquia-lift-page-variation-item',
'available' => 'visitor-actions-ui-enabled',
);
if (!isset($state_class[$state])) {
$state_options_array = array_keys($state_class);
$state_options_string = implode(', ', $state_options_array);
throw new \Exception(sprintf('The element state "%s" is not defined. Available options are "%s".', $state, $state_options_string));
}
$element = $this
->findElementInRegion($selector, $region);
if (empty($element)) {
throw new \Exception(sprintf('The element "%s" was not found in the region "%s" on the page %s.', $selector, $region, $this
->getSession()
->getCurrentUrl()));
}
$class = $state_class[$state];
if (!$element
->hasClass($class)) {
throw new \Exception(sprintf('The element "%s" in region "%s" on the page %s is not in "%s" state.', $selector, $region, $this
->getSession()
->getCurrentUrl(), $state));
}
}