protected function assertDetails($summary, ElementInterface $container) {
    /** @var \Behat\Mink\Element\NodeElement $element */
    foreach ($container->findAll('css', 'details > summary') as $element) {
      if ($element->getText() == $summary) {
        return $element->getParent();
      }
    }

    throw new ExpectationException(
      "Could not find a details element with summary '$summary'.",
      $this->getSession()->getDriver()
    );
  }