forked from GoogleChrome/lighthouse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseo-status-403.js
74 lines (70 loc) · 2.2 KB
/
seo-status-403.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* @license Copyright 2017 The Lighthouse Authors. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
const BASE_URL = 'http://localhost:10200/seo/';
/** @type {LH.Config} */
const config = {
extends: 'lighthouse:default',
settings: {
onlyCategories: ['seo'],
},
};
/**
* @type {Smokehouse.ExpectedRunnerResult}
* Expected Lighthouse audit values for a site served with http status 403.
*/
const expectations = {
lhr: {
// Note: most scores are null (audit error) because the page 403ed.
requestedUrl: BASE_URL + 'seo-failure-cases.html?status_code=403',
finalDisplayedUrl: BASE_URL + 'seo-failure-cases.html?status_code=403',
userAgent: /Chrom(e|ium)/, // Ensure we still collect base artifacts when page fails to load.
runtimeError: {
code: 'ERRORED_DOCUMENT_REQUEST',
message: /Status code: 403/,
},
runWarnings: ['Lighthouse was unable to reliably load the page you requested. Make sure you are testing the correct URL and that the server is properly responding to all requests. (Status code: 403)'],
audits: {
'http-status-code': {
score: null,
},
'viewport': {
score: null,
},
'document-title': {
score: null,
},
'meta-description': {
score: null,
},
'font-size': {
score: null,
},
'crawlable-anchors': {
score: null,
},
'link-text': {
score: null,
},
'is-crawlable': {
score: null,
},
'hreflang': {
score: null,
},
'plugins': {
score: null,
},
'canonical': {
score: null,
},
},
},
};
export default {
id: 'seo-status-403',
expectations,
config,
};