/**
* @Then the metatag :type :name is :value
*/
public function assertMetatag(string $type, string $name, string $value): void {
$element = $this->getSession()->getPage()->find('xpath', '/head/meta[@' . $type . '="' . $name . '"]/@content');
if (!$element) {
throw new \Exception(sprintf('The metatag %s "%s" does not exist', $type, $name));
}
$text = $element->getText();
if ($value !== $text) {
throw new \Exception(sprintf("The metatag %s '%s' text '%s' does not match the expected value '%s'", $type, $name, $text, $value));
}
}
/**
* @Then the metatag :type :name does not exist
*/
public function assertMetatagNotExist(string $type, string $name): void {
$element = $this->getSession()->getPage()->find('xpath', '/head/meta[@' . $type . '="' . $name . '"]/@content');
if ($element) {
throw new \Exception(sprintf('The metatag %s "%s" exists on the page', $type, $name));
}
}