You are here

private function FeatureContext::findLinkInRegion in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 behat-tests/features/bootstrap/FeatureContext.php \FeatureContext::findLinkInRegion()

Helper function to return a link in a particular region.

Note: the selector is translated to xpath in order to allow selection of the link even if it needs to be scrolled in order to visible.

Parameters

string $link: link id, title, text or image alt

$region: region identifier from configuration.

Return value

\Behat\Mink\Element\NodeElement|null The element node for the link or null if not found.

4 calls to FeatureContext::findLinkInRegion()
FeatureContext::assertLinkVisibleRegion in behat-tests/features/bootstrap/FeatureContext.php
@Then I should visibly see the link :link in the :region( region)
FeatureContext::assertMenuItemInactive in behat-tests/features/bootstrap/FeatureContext.php
@Given /^menu item "([^"]*)" should be "(active|inactive)"$/
FeatureContext::assertNotLinkVisibleRegion in behat-tests/features/bootstrap/FeatureContext.php
@Then I should not visibly see the link :link in the :region( region)
FeatureContext::assertRegionLinkHover in behat-tests/features/bootstrap/FeatureContext.php
@When I hover over :link in the :region( region)

File

behat-tests/features/bootstrap/FeatureContext.php, line 680

Class

FeatureContext
Defines application features from the specific context.

Code

private function findLinkInRegion($link, $region) {
  $regionObj = $this
    ->getRegion($region);
  $element = $regionObj
    ->findLink($link);
  if (empty($element)) {
    throw new \Exception(sprintf('Could not find element in "%s" using link "%s"', $region, $link));
  }
  return $element;
}