You are here

public function ElementContext::assertDetails in Lightning Core 8.4

Same name and namespace in other branches
  1. 8.5 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::assertDetails()
  2. 8 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::assertDetails()
  3. 8.2 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::assertDetails()
  4. 8.3 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::assertDetails()

Asserts the existence of a <details> element by its summary text.

@Then I should see a(n) :summary details element

Parameters

string $summary: The exact summary text.

\Behat\Mink\Element\ElementInterface $container: (optional) The element in which to search for the <details> element.

Return value

\Behat\Mink\Element\NodeElement The <details> element.

Throws

\Behat\Mink\Exception\ElementNotFoundException If the element is not found in the container.

File

tests/contexts/ElementContext.behat.inc, line 327

Class

ElementContext
Contains miscellaneous step definitions for working with HTML elements.

Namespace

Acquia\LightningExtension\Context

Code

public function assertDetails($summary, ElementInterface $container = NULL) {
  $session = $this
    ->getSession();
  $element = $this
    ->findDetails($summary, $container ?: $session
    ->getPage());
  if ($element) {
    return $element;
  }
  else {
    throw new ElementNotFoundException($session
      ->getDriver(), 'details', 'summary', $summary);
  }
}