DEPRECATED in favor of Lighthouse
Nightwatch.js utility assertion for SEO testing in accordance to TELUS digital SEO rules
# using npm
npm install --only=production --save @telusdigital/nightwatch-seo
# using yarn
yarn add @telusdigital/nightwatch-seo --dev
Update your nightwatch config:
{
custom_assertions_path: ["./node_modules/@telusdigital/nightwatch-seo/assertions"]
}
Use in your tests:
module.exports = {
'Test': function (browser) {
browser.assert.seo('#app', {
scoped: true
})
}
}
Analyzes the defined context
against SEO rules
Name | Type | Default | Required | Description |
---|---|---|---|---|
context |
String |
'html' |
✖️ |
A CSS selector that selects the portion(s) of the document that must be analyzed |
options |
Object |
null |
✖️ |
configure how SEO assertion operates |
Name | Type | Default | Required | Description |
---|---|---|---|---|
meta |
Boolean |
false |
✖️ |
check page meta |
titleRegExp |
RegExp |
/.* - TELUS.com/ |
✖️ |
configurable regex for <title> assertions |
This is a work in progress, checklist below indicates what has been implemented to date:
-
<h1/>
- element should be unique and found only once per page
-
<img>
- element should have
alt
attributes - element
src
attribute should be separated by underscores
- element should have
-
Page URL
- URL phrase should be separated with dashes (
-
) between each word
- URL phrase should be separated with dashes (
-
<link rel="canonical">
- element should exist and be unique
- element
href
attribute should not be empty - element
href
attribute should exclude provincial parameters, tracking codes and any other extra parameters & query strings
-
<title>
- element should exists and be unique
- element should conform to pattern (
- TELUS.com
) - element content length should be not exceed
65
characters
-
<meta name="description">
- element should exists and be unique
- element content length should not exceed
155
characters
-
<meta property="og:title">
- element should exists and be unique
- element should contain company domain name (
TELUS.com
) - element should use a spaced dash (
-
) to separate sections - element content length should be not exceed
65
characters
-
<meta property="og:description">
- element should exists and be unique
- element content length should not exceed
155
characters
-
<meta property="og:url">
- element should exists and be unique
- element
content
attribute should not be empty - element
content
attribute should exclude provincial parameters, tracking codes and any other extra parameters & query strings
-
<meta property="og:image">
- element should exist and be unique
- element should contain an image URL that best represents the page
-
"@type": "Product"
- element should exist
-
"name"
- element should exist
-
"description"
- element should exist
-
"image"
- element should exist
-
"brand"
- element should exist
-
"@type": "Offer"
- element should exist
-
"price"
- element should exist
-
"priceCurrency"
- element should exist
-
"availability"
- element should exist
-
"url"
- element should exist
-
"@type": "VideoObject"
- element should exist
-
"name"
- element should exist
-
"description"
- element should exist
-
"thumbnailUrl"
- element should exist
-
"uploadDate"
- element should exist and in ISO 8601 format
©️ TELUS digital · License: ISC · Github: @telusdigital · Twitter: @telusdigital