@telusdigital/nightwatch-seo v1.2.2
Nightwatch SEO

DEPRECATED in favor of Lighthouse
Nightwatch.js utility assertion for SEO testing in accordance to TELUS digital SEO rules
Install
# using npm
npm install --only=production --save @telusdigital/nightwatch-seo
# using yarn
yarn add @telusdigital/nightwatch-seo --devUsage
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
})
}
}API
browser.assert.seo(context, options)
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 |
options
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
meta | Boolean | false | ✖️ | check page meta |
titleRegExp | RegExp | /.* - TELUS.com/ | ✖️ | configurable regex for assertions |
SEO Rules
This is a work in progress, checklist below indicates what has been implemented to date:
Layout
<h1/>- element should be unique and found only once per page
<img>- element should have
altattributes - element
srcattribute should be separated by underscores
- element should have
Meta
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
hrefattribute should not be empty - element
hrefattribute 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
65characters
<meta name="description">- element should exists and be unique
- element content length should not exceed
155characters
Social Meta
<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
65characters
<meta property="og:description">- element should exists and be unique
- element content length should not exceed
155characters
<meta property="og:url">- element should exists and be unique
- element
contentattribute should not be empty - element
contentattribute 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
Structured Data
For product detail pages ie phones and accessories
"@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
For video content types
"@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
:copyright: TELUS digital · License: ISC · Github: @telusdigital · Twitter: @telusdigital