You are here

protected function BigMenuUiTest::clickLinkInRow in Big Menu 2.x

Clicks a link in a row.

Parameters

string $row_text: Text to find a row.

string $link: The link to click.

Throws

\Behat\Mink\Exception\ElementNotFoundException When the row can't be found.

1 call to BigMenuUiTest::clickLinkInRow()
BigMenuUiTest::testBigMenuUiDeleteMenuLink in tests/src/Functional/BigMenuUiTest.php
Tests for deleting a menu link when viewing children.

File

tests/src/Functional/BigMenuUiTest.php, line 212

Class

BigMenuUiTest
Tests the Big Menu interface.

Namespace

Drupal\Tests\bigmenu\Functional

Code

protected function clickLinkInRow($row_text, $link) {

  /** @var \Behat\Mink\Element\NodeElement $row */
  $row = $this
    ->getSession()
    ->getPage()
    ->find('css', sprintf('table tr:contains("%s")', $row_text));
  if (!$row) {
    throw new ElementNotFoundException($this
      ->getSession()
      ->getDriver(), 'table row', 'value', $row_text);
  }
  $row
    ->clickLink($link);
}