You are here

public function FeatureContext::clickAdminLink in Open Social 8

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

@When I click admin link :text

File

tests/behat/features/bootstrap/FeatureContext.php, line 182

Class

FeatureContext
Defines application features from the specific context.

Code

public function clickAdminLink($text) {
  $page = $this
    ->getSession()
    ->getPage();
  $adminspan = $page
    ->find('xpath', '//a//span[text()="' . $text . '"]');
  if ($adminspan === null) {
    throw new \InvalidArgumentException(sprintf('Cannot find the admin link with text: "%s"', $text));
  }
  $adminlink = $adminspan
    ->getParent();
  $adminlink
    ->click();
}