Meta tags
DrevOps\BehatSteps\Steps\Web\MetatagTrait - Source, Example, Helpers
Assert
<meta>tags and head/SEO markup in page markup.
- Assert presence and content of meta tags.
- Verify meta tag content is free of HTML markup.
- Assert canonical URL, robots directives and indexability.
- Assert hreflang alternates are valid and reciprocal.
- Assert Open Graph and Twitter Card completeness.
Steps
@Then the meta tag with the following attributes should exist:
Assert that a meta tag with specific attributes and values exists
Then the meta tag with the following attributes should exist:
| name | description |
| content | My page description |
@Then the meta tag with the following attributes should not exist:
Assert that a meta tag with specific attributes and values does not exist
Then the meta tag with the following attributes should not exist:
| name | nonexistent |
| content | Some content |
@Then the meta tag :name should not contain any HTML tags
Assert a meta tag does not contain HTML tags
Then the meta tag "og:description" should not contain any HTML tags
Then the meta tag "description" should not contain any HTML tags
@Then the canonical URL should be :url
Assert the canonical URL equals a value
Then the canonical URL should be "https://example.com/about"
Then the canonical URL should be "/about"
@Then the canonical URL should exist
Assert the canonical URL is present
Then the canonical URL should exist
@Then the canonical URL should not exist
Assert the canonical URL is absent
Then the canonical URL should not exist
@Then the page should be indexable
Assert the page is indexable
Then the page should be indexable
@Then the page should not be indexable
Assert the page is not indexable
Then the page should not be indexable
@Then the robots meta tag should contain :directive
Assert the robots meta tag contains a directive
Then the robots meta tag should contain "noindex"
Then the robots meta tag should contain "nofollow"
@Then the robots meta tag should not contain :directive
Assert the robots meta tag does not contain a directive
Then the robots meta tag should not contain "noindex"
Then the robots meta tag should not contain "nofollow"
@Then the hreflang alternates should be valid
Assert hreflang alternates are valid
Then the hreflang alternates should be valid
@Then the hreflang alternates should have reciprocal return links
Assert hreflang alternates have reciprocal return links
Then the hreflang alternates should have reciprocal return links
@Then the Open Graph tags should be valid
Assert the required Open Graph meta tags are present and non-empty
Then the Open Graph tags should be valid
@Then the following Open Graph tags should exist:
Assert the listed Open Graph meta tags are present and non-empty
Then the following Open Graph tags should exist:
| og:title |
| og:image |
| og:url |
@Then the Twitter Card tags should be valid
Assert the required Twitter Card meta tags are present and non-empty
Then the Twitter Card tags should be valid
@Then the following Twitter Card tags should exist:
Assert the listed Twitter Card meta tags are present and non-empty
Then the following Twitter Card tags should exist:
| twitter:card |
| twitter:title |