public function FeatureContext::assertMenuItemInactive in Acquia Lift Connector 7.2
Same name and namespace in other branches
- 7 behat-tests/features/bootstrap/FeatureContext.php \FeatureContext::assertMenuItemInactive()
@Given /^menu item "([^"]*)" should be "(active|inactive)"$/
File
- behat-tests/
features/ bootstrap/ FeatureContext.php, line 598
Class
- FeatureContext
- Defines application features from the specific context.
Code
public function assertMenuItemInactive($link, $status) {
$elements = $this
->findLinksInRegion($link, 'lift_tray');
if (empty($elements)) {
throw new \Exception(sprintf('The link element %s was not found on the page %s', $link, $this
->getSession()
->getCurrentUrl()));
}
$found = FALSE;
foreach ($elements as $element) {
/**
* This logis is not ideal. It would be better to actually only check each
* visible item and then report directly based on whether the item was
* inactive or active, however, there is a selenium bug that is treating
* both "Add variation set" links and "Add goal" links as invisible even
* when one is shown on the screen.
*/
$found = TRUE;
if ($element
->hasClass('acquia-lift-menu-disabled') || $element
->hasClass('acquia-lift-disabled')) {
if ($status === 'inactive') {
$found = TRUE;
continue;
}
}
else {
if ($status === 'active') {
$found = TRUE;
continue;
}
}
}
if (!$found) {
throw new \Exception(sprintf('The link element %s was not %s on the page %s', $link, $status, $this
->getSession()
->getCurrentUrl()));
}
}