accessibility-checker 3.1.49 → 3.1.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -67
- package/bin/achecker.js +14 -17
- package/bin/achecker.js.map +1 -1
- package/index.d.ts +6 -4
- package/index.js +9 -8
- package/index.js.map +1 -1
- package/lib/ACBrowserManager.d.ts +2 -2
- package/lib/ACBrowserManager.js +2 -3
- package/lib/ACBrowserManager.js.map +1 -1
- package/lib/ACEngineManager.d.ts +1 -12
- package/lib/ACEngineManager.js +72 -40
- package/lib/ACEngineManager.js.map +1 -1
- package/lib/ACHelper.js +126 -137
- package/lib/ACHelper.js.map +1 -1
- package/lib/api/IChecker.d.ts +3 -114
- package/lib/api/IChecker.js +1 -1
- package/lib/api/IChecker.js.map +1 -1
- package/lib/common/api-ext/Fetch.d.ts +16 -0
- package/lib/common/api-ext/Fetch.js +83 -0
- package/lib/common/api-ext/Fetch.js.map +1 -0
- package/lib/common/api-ext/IAbstractAPI.d.ts +34 -0
- package/lib/common/api-ext/IAbstractAPI.js +18 -0
- package/lib/common/api-ext/IAbstractAPI.js.map +1 -0
- package/lib/common/config/ACConfigManager.d.ts +7 -0
- package/lib/{ACConfigManager.js → common/config/ACConfigManager.js} +28 -19
- package/lib/common/config/ACConfigManager.js.map +1 -0
- package/lib/{ACConstants.d.ts → common/config/ACConstants.d.ts} +2 -2
- package/lib/{ACConstants.js → common/config/ACConstants.js} +7 -5
- package/lib/common/config/ACConstants.js.map +1 -0
- package/lib/common/config/IArchive.d.ts +37 -0
- package/lib/{reporters/multiScanReportUtil.d.ts → common/config/IArchive.js} +4 -5
- package/lib/common/config/IArchive.js.map +1 -0
- package/lib/common/config/IConfig.d.ts +146 -0
- package/lib/common/config/IConfig.js +36 -0
- package/lib/common/config/IConfig.js.map +1 -0
- package/lib/common/report/ACReporterCSV.d.ts +27 -0
- package/lib/common/report/ACReporterCSV.js +105 -0
- package/lib/common/report/ACReporterCSV.js.map +1 -0
- package/lib/common/report/ACReporterHTML.d.ts +26 -0
- package/lib/common/report/ACReporterHTML.js +94 -0
- package/lib/common/report/ACReporterHTML.js.map +1 -0
- package/lib/common/report/ACReporterJSON.d.ts +46 -0
- package/lib/common/report/ACReporterJSON.js +140 -0
- package/lib/common/report/ACReporterJSON.js.map +1 -0
- package/lib/{log/ACMetricsLogger.d.ts → common/report/ACReporterMetrics.d.ts} +11 -6
- package/lib/{log/ACMetricsLogger.js → common/report/ACReporterMetrics.js} +85 -70
- package/lib/common/report/ACReporterMetrics.js.map +1 -0
- package/lib/common/report/ACReporterXLSX.d.ts +37 -0
- package/lib/common/report/ACReporterXLSX.js +1004 -0
- package/lib/common/report/ACReporterXLSX.js.map +1 -0
- package/lib/common/report/BaselineManager.d.ts +169 -0
- package/lib/common/report/BaselineManager.js +355 -0
- package/lib/common/report/BaselineManager.js.map +1 -0
- package/lib/common/report/ReporterManager.d.ts +79 -0
- package/lib/common/report/ReporterManager.js +552 -0
- package/lib/common/report/ReporterManager.js.map +1 -0
- package/lib/common/report/genReport.js.map +1 -0
- package/package.json +1 -1
- package/lib/ACConfigManager.d.ts +0 -7
- package/lib/ACConfigManager.js.map +0 -1
- package/lib/ACConstants.js.map +0 -1
- package/lib/ACReportManager.d.ts +0 -590
- package/lib/ACReportManager.js +0 -1201
- package/lib/ACReportManager.js.map +0 -1
- package/lib/api/IEngine.d.ts +0 -129
- package/lib/api/IEngine.js +0 -110
- package/lib/api/IEngine.js.map +0 -1
- package/lib/log/ACMetricsLogger.js.map +0 -1
- package/lib/reporters/ACReporterCSV.d.ts +0 -103
- package/lib/reporters/ACReporterCSV.js +0 -193
- package/lib/reporters/ACReporterCSV.js.map +0 -1
- package/lib/reporters/ACReporterHTML.d.ts +0 -114
- package/lib/reporters/ACReporterHTML.js +0 -360
- package/lib/reporters/ACReporterHTML.js.map +0 -1
- package/lib/reporters/ACReporterJSON.d.ts +0 -114
- package/lib/reporters/ACReporterJSON.js +0 -277
- package/lib/reporters/ACReporterJSON.js.map +0 -1
- package/lib/reporters/ACReporterXLSX.d.ts +0 -109
- package/lib/reporters/ACReporterXLSX.js +0 -405
- package/lib/reporters/ACReporterXLSX.js.map +0 -1
- package/lib/reporters/ReportUtil.d.ts +0 -33
- package/lib/reporters/ReportUtil.js +0 -65
- package/lib/reporters/ReportUtil.js.map +0 -1
- package/lib/reporters/genReport.js.map +0 -1
- package/lib/reporters/multiScanData.d.ts +0 -27
- package/lib/reporters/multiScanData.js +0 -190
- package/lib/reporters/multiScanData.js.map +0 -1
- package/lib/reporters/multiScanReport.d.ts +0 -25
- package/lib/reporters/multiScanReport.js +0 -1729
- package/lib/reporters/multiScanReport.js.map +0 -1
- package/lib/reporters/multiScanReportUtil.js +0 -49
- package/lib/reporters/multiScanReportUtil.js.map +0 -1
- /package/lib/{reporters → common/report}/genReport.d.ts +0 -0
- /package/lib/{reporters → common/report}/genReport.js +0 -0
package/lib/ACEngineManager.js
CHANGED
|
@@ -37,26 +37,42 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.ACEngineManager = void 0;
|
|
40
|
-
var ACConfigManager_1 = require("./ACConfigManager");
|
|
41
40
|
var path = require("path");
|
|
42
41
|
var fs = require("fs");
|
|
43
42
|
var axios_1 = require("axios");
|
|
43
|
+
var ACConfigManager_1 = require("./common/config/ACConfigManager");
|
|
44
44
|
var ace;
|
|
45
45
|
var checker;
|
|
46
|
-
var ACEngineManager = /** @class */ (function () {
|
|
46
|
+
var ACEngineManager = exports.ACEngineManager = /** @class */ (function () {
|
|
47
47
|
function ACEngineManager() {
|
|
48
48
|
}
|
|
49
49
|
ACEngineManager.loadEngine = function (content) {
|
|
50
50
|
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
-
var config, page, browser, scriptStr, manage;
|
|
52
|
-
return __generator(this, function (
|
|
53
|
-
switch (
|
|
51
|
+
var config, ENGINE_LOAD_MODE, response, _b, page, browser, scriptStr, manage;
|
|
52
|
+
return __generator(this, function (_c) {
|
|
53
|
+
switch (_c.label) {
|
|
54
54
|
case 0: return [4 /*yield*/, ACConfigManager_1.ACConfigManager.getConfigUnsupported()];
|
|
55
55
|
case 1:
|
|
56
|
-
config =
|
|
57
|
-
|
|
56
|
+
config = _c.sent();
|
|
57
|
+
ENGINE_LOAD_MODE = config.engineMode;
|
|
58
|
+
if (ENGINE_LOAD_MODE === "DEFAULT") {
|
|
59
|
+
// ENGINE_LOAD_MODE = "REMOTE";
|
|
60
|
+
ENGINE_LOAD_MODE = "INJECT";
|
|
61
|
+
}
|
|
62
|
+
if (!(ENGINE_LOAD_MODE === "INJECT" && !ACEngineManager.engineContent)) return [3 /*break*/, 4];
|
|
63
|
+
return [4 /*yield*/, axios_1.default.get("".concat(config.rulePack, "/ace.js"))];
|
|
64
|
+
case 2:
|
|
65
|
+
response = _c.sent();
|
|
66
|
+
_b = ACEngineManager;
|
|
67
|
+
return [4 /*yield*/, response.data];
|
|
68
|
+
case 3:
|
|
69
|
+
_b.engineContent = _c.sent();
|
|
70
|
+
_c.label = 4;
|
|
71
|
+
case 4:
|
|
72
|
+
if (!(ACEngineManager.isPuppeteer(content) || ACEngineManager.isPlaywright(content))) return [3 /*break*/, 9];
|
|
58
73
|
config.DEBUG && console.log("[INFO] aChecker.loadEngine detected Puppeteer/Playwright");
|
|
59
74
|
page = content;
|
|
75
|
+
if (!(ENGINE_LOAD_MODE === "REMOTE")) return [3 /*break*/, 6];
|
|
60
76
|
return [4 /*yield*/, page.evaluate(function (scriptUrl) {
|
|
61
77
|
try {
|
|
62
78
|
var ace_backup_in_ibma;
|
|
@@ -78,6 +94,9 @@ var ACEngineManager = /** @class */ (function () {
|
|
|
78
94
|
}
|
|
79
95
|
resolve();
|
|
80
96
|
});
|
|
97
|
+
script.addEventListener('error', function (evt) {
|
|
98
|
+
reject(new Error("Unable to load engine into ".concat(document.location.href, ". This can happen if the page server sets a Content-Security-Policy that prevents ").concat(scriptUrl, " from loading.")));
|
|
99
|
+
});
|
|
81
100
|
var heads = document.getElementsByTagName('head');
|
|
82
101
|
if (heads.length > 0) {
|
|
83
102
|
heads[0].appendChild(script);
|
|
@@ -95,15 +114,53 @@ var ACEngineManager = /** @class */ (function () {
|
|
|
95
114
|
return Promise.reject(e);
|
|
96
115
|
}
|
|
97
116
|
}, "".concat(config.rulePack, "/ace.js"))];
|
|
98
|
-
case
|
|
99
|
-
|
|
100
|
-
return [
|
|
101
|
-
case
|
|
117
|
+
case 5:
|
|
118
|
+
_c.sent();
|
|
119
|
+
return [3 /*break*/, 8];
|
|
120
|
+
case 6:
|
|
121
|
+
if (!(ENGINE_LOAD_MODE === "INJECT")) return [3 /*break*/, 8];
|
|
122
|
+
return [4 /*yield*/, page.evaluate(function (engineContent) {
|
|
123
|
+
try {
|
|
124
|
+
var ace_backup_in_ibma;
|
|
125
|
+
if ('undefined' !== typeof (ace)) {
|
|
126
|
+
if (!ace || !ace.Checker)
|
|
127
|
+
ace_backup_in_ibma = ace;
|
|
128
|
+
ace = null;
|
|
129
|
+
}
|
|
130
|
+
if ('undefined' === typeof (ace) || ace === null) {
|
|
131
|
+
return new Promise(function (resolve, reject) {
|
|
132
|
+
eval(engineContent);
|
|
133
|
+
globalThis.ace_ibma = ace;
|
|
134
|
+
if ('undefined' !== typeof (ace)) {
|
|
135
|
+
ace = ace_backup_in_ibma;
|
|
136
|
+
}
|
|
137
|
+
resolve();
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (e) {
|
|
142
|
+
return Promise.reject(e);
|
|
143
|
+
}
|
|
144
|
+
}, ACEngineManager.engineContent)];
|
|
145
|
+
case 7:
|
|
146
|
+
_c.sent();
|
|
147
|
+
_c.label = 8;
|
|
148
|
+
case 8: return [2 /*return*/, ACEngineManager.loadEngineLocal()];
|
|
149
|
+
case 9:
|
|
102
150
|
if (ACEngineManager.isSelenium(content)) {
|
|
103
151
|
config.DEBUG && console.log("[INFO] aChecker.loadEngine detected Selenium");
|
|
104
152
|
try {
|
|
105
153
|
browser = content;
|
|
106
|
-
scriptStr =
|
|
154
|
+
scriptStr = void 0;
|
|
155
|
+
if (ENGINE_LOAD_MODE === "REMOTE") {
|
|
156
|
+
scriptStr =
|
|
157
|
+
"let cb = arguments[arguments.length - 1];\n try {\n var ace_backup_in_ibma;\n if ('undefined' !== typeof(ace)) {\n if (!ace || !ace.Checker) \n ace_backup_in_ibma = ace;\n ace = null; \n } \n if ('undefined' === typeof (ace) || ace === null) {\n let script = document.createElement('script');\n script.setAttribute('type', 'text/javascript');\n script.setAttribute('aChecker', 'ACE');\n script.setAttribute('src', '".concat(config.rulePack, "/ace.js');\n script.addEventListener('load', function() {\n globalThis.ace_ibma = ace;\n if ('undefined' !== typeof(ace)) {\n ace = ace_backup_in_ibma;\n } \n cb();\n });\n let heads = document.getElementsByTagName('head');\n if (heads.length > 0) { heads[0].appendChild(script); }\n else { document.body.appendChild(script); }\n } else {\n cb();\n }\n } catch (e) {\n cb(e);\n }\n ");
|
|
158
|
+
}
|
|
159
|
+
else if (ENGINE_LOAD_MODE === "INJECT") {
|
|
160
|
+
// Selenium
|
|
161
|
+
scriptStr =
|
|
162
|
+
"let cb = arguments[arguments.length - 1];\n try {\n var ace_backup_in_ibma;\n if ('undefined' !== typeof(ace)) {\n if (!ace || !ace.Checker) \n ace_backup_in_ibma = ace;\n ace = null; \n } \n if ('undefined' === typeof (ace) || ace === null) {\n eval(".concat(JSON.stringify(ACEngineManager.engineContent), ")\n globalThis.ace_ibma = ace;\n if ('undefined' !== typeof(ace)) {\n ace = ace_backup_in_ibma;\n } \n cb();\n \n } else {\n cb();\n }\n } catch (e) {\n cb(e);\n }\n ");
|
|
163
|
+
}
|
|
107
164
|
manage = browser.manage();
|
|
108
165
|
if (manage.timeouts) {
|
|
109
166
|
manage.timeouts().setScriptTimeout(60000);
|
|
@@ -132,8 +189,8 @@ var ACEngineManager = /** @class */ (function () {
|
|
|
132
189
|
return [2 /*return*/, ACEngineManager.loadEngineLocal()];
|
|
133
190
|
}
|
|
134
191
|
}
|
|
135
|
-
|
|
136
|
-
case
|
|
192
|
+
_c.label = 10;
|
|
193
|
+
case 10: return [2 /*return*/];
|
|
137
194
|
}
|
|
138
195
|
});
|
|
139
196
|
});
|
|
@@ -206,37 +263,13 @@ var ACEngineManager = /** @class */ (function () {
|
|
|
206
263
|
}
|
|
207
264
|
return false;
|
|
208
265
|
};
|
|
209
|
-
/**
|
|
210
|
-
* This function is responsible for building the full help file URL using rule server.
|
|
211
|
-
*
|
|
212
|
-
* @param {String} helpFileName - Provide the help file name
|
|
213
|
-
*
|
|
214
|
-
* @return {String} helpFileName - The full help file URL
|
|
215
|
-
*
|
|
216
|
-
* PRIVATE METHOD
|
|
217
|
-
*
|
|
218
|
-
* @memberOf this
|
|
219
|
-
*/
|
|
220
|
-
ACEngineManager.getHelpURL = function (issue) {
|
|
221
|
-
var config = ACConfigManager_1.ACConfigManager.getConfigNow();
|
|
222
|
-
var helpUrl = checker.engine.getHelp(issue.ruleId, issue.reasonId, config.ruleArchive);
|
|
223
|
-
var minIssue = {
|
|
224
|
-
message: issue.message,
|
|
225
|
-
snippet: issue.snippet,
|
|
226
|
-
value: issue.value,
|
|
227
|
-
reasonId: issue.reasonId,
|
|
228
|
-
ruleId: issue.ruleId,
|
|
229
|
-
msgArgs: issue.msgArgs
|
|
230
|
-
};
|
|
231
|
-
return "".concat(helpUrl, "#").concat(encodeURIComponent(JSON.stringify(minIssue)));
|
|
232
|
-
};
|
|
233
|
-
;
|
|
234
266
|
ACEngineManager.getChecker = function () {
|
|
235
267
|
return checker;
|
|
236
268
|
};
|
|
237
269
|
var _a;
|
|
238
270
|
_a = ACEngineManager;
|
|
239
271
|
ACEngineManager.customRulesets = [];
|
|
272
|
+
ACEngineManager.engineContent = null;
|
|
240
273
|
ACEngineManager.localLoadPromise = null;
|
|
241
274
|
ACEngineManager.addRuleset = function (ruleset) {
|
|
242
275
|
ACEngineManager.customRulesets.push(ruleset);
|
|
@@ -301,5 +334,4 @@ var ACEngineManager = /** @class */ (function () {
|
|
|
301
334
|
};
|
|
302
335
|
return ACEngineManager;
|
|
303
336
|
}());
|
|
304
|
-
exports.ACEngineManager = ACEngineManager;
|
|
305
337
|
//# sourceMappingURL=ACEngineManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ACEngineManager.js","sourceRoot":"","sources":["../../src-ts/lib/ACEngineManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"ACEngineManager.js","sourceRoot":"","sources":["../../src-ts/lib/ACEngineManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAA6B;AAC7B,uBAAyB;AACzB,+BAA0B;AAC1B,mEAAkE;AAElE,IAAI,GAAG,CAAC;AAER,IAAI,OAAO,CAAC;AAEZ;IAAA;IA2QA,CAAC;IAxQgB,0BAAU,GAAvB,UAAwB,OAAO;;;;;4BACd,qBAAM,iCAAe,CAAC,oBAAoB,EAAE,EAAA;;wBAArD,MAAM,GAAG,SAA4C;wBACrD,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC;wBACzC,IAAI,gBAAgB,KAAK,SAAS,EAAE;4BAChC,+BAA+B;4BAC/B,gBAAgB,GAAG,QAAQ,CAAC;yBAC/B;6BACG,CAAA,gBAAgB,KAAK,QAAQ,IAAI,CAAC,eAAe,CAAC,aAAa,CAAA,EAA/D,wBAA+D;wBAC9C,qBAAM,eAAK,CAAC,GAAG,CAAC,UAAG,MAAM,CAAC,QAAQ,YAAS,CAAC,EAAA;;wBAAvD,QAAQ,GAAG,SAA4C;wBAC7D,KAAA,eAAe,CAAA;wBAAiB,qBAAM,QAAQ,CAAC,IAAI,EAAA;;wBAAnD,GAAgB,aAAa,GAAG,SAAmB,CAAC;;;6BAEpD,CAA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,wBAAQ,GAAG;;;;;;6BACV,CAAC,OAAO,EAAR,wBAAQ;wBACR,qBAAM,eAAe,CAAC,eAAe,EAAE,EAAA;;wBAAvC,SAAuC,CAAC;;;wBAExC,MAAM,GAAG,EAAE,CAAC;wBAChB,KAAW,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE;4BACzC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;yBAC/C;wBACD,sBAAO,MAAM,EAAC;;;;KACjB,AATc,CASd;IAEM,4BAAY,GAAG;QAClB,IAAI,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC;QAC1B,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,IAAM,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE;YACzC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;SAC/C;QACD,OAAO,MAAM,CAAC;IAClB,CAAC,AAPkB,CAOlB;IACL,sBAAC;CAAA,AA3QD,IA2QC"}
|
package/lib/ACHelper.js
CHANGED
|
@@ -38,9 +38,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getComplianceHelper = void 0;
|
|
40
40
|
var ACBrowserManager_1 = require("./ACBrowserManager");
|
|
41
|
-
var ACConfigManager_1 = require("./ACConfigManager");
|
|
42
41
|
var ACEngineManager_1 = require("./ACEngineManager");
|
|
43
|
-
var
|
|
42
|
+
var ACConfigManager_1 = require("./common/config/ACConfigManager");
|
|
43
|
+
var ReporterManager_1 = require("./common/report/ReporterManager");
|
|
44
|
+
var fs_1 = require("fs");
|
|
45
|
+
var path_1 = require("path");
|
|
46
|
+
var BaselineManager_1 = require("./common/report/BaselineManager");
|
|
44
47
|
var loggerCreate = function (type) {
|
|
45
48
|
return logger;
|
|
46
49
|
};
|
|
@@ -77,20 +80,85 @@ var logger = {
|
|
|
77
80
|
};
|
|
78
81
|
var Config;
|
|
79
82
|
var checkPolicy = false;
|
|
83
|
+
var MyFS = /** @class */ (function () {
|
|
84
|
+
function MyFS() {
|
|
85
|
+
}
|
|
86
|
+
MyFS.prototype.writeFileSync = function (filePath, data) {
|
|
87
|
+
var outFile = this.prepFileSync(filePath);
|
|
88
|
+
(0, fs_1.writeFileSync)(outFile, data);
|
|
89
|
+
};
|
|
90
|
+
MyFS.prototype.prepFileSync = function (filePath) {
|
|
91
|
+
var outDir = (0, path_1.resolve)(Config.outputFolder);
|
|
92
|
+
var outFile = (0, path_1.join)(outDir, filePath);
|
|
93
|
+
if (!(0, fs_1.existsSync)((0, path_1.dirname)(outFile))) {
|
|
94
|
+
(0, fs_1.mkdirSync)((0, path_1.dirname)(outFile), { recursive: true });
|
|
95
|
+
}
|
|
96
|
+
return outFile;
|
|
97
|
+
};
|
|
98
|
+
MyFS.prototype.log = function () {
|
|
99
|
+
var output = [];
|
|
100
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
101
|
+
output[_i] = arguments[_i];
|
|
102
|
+
}
|
|
103
|
+
Config && Config.DEBUG && console.debug.apply(console, output);
|
|
104
|
+
};
|
|
105
|
+
MyFS.prototype.info = function () {
|
|
106
|
+
var output = [];
|
|
107
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
108
|
+
output[_i] = arguments[_i];
|
|
109
|
+
}
|
|
110
|
+
Config && Config.DEBUG && console.info.apply(console, output);
|
|
111
|
+
};
|
|
112
|
+
MyFS.prototype.error = function () {
|
|
113
|
+
var output = [];
|
|
114
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
115
|
+
output[_i] = arguments[_i];
|
|
116
|
+
}
|
|
117
|
+
Config && Config.DEBUG && console.error.apply(console, output);
|
|
118
|
+
};
|
|
119
|
+
MyFS.prototype.loadBaseline = function (label) {
|
|
120
|
+
var baselineFile = (0, path_1.join)((0, path_1.join)(process.cwd(), Config.baselineFolder), label + ".json");
|
|
121
|
+
if (!(0, fs_1.existsSync)(baselineFile))
|
|
122
|
+
return null;
|
|
123
|
+
return require(baselineFile);
|
|
124
|
+
};
|
|
125
|
+
MyFS.prototype.getChecker = function () {
|
|
126
|
+
return ACEngineManager_1.ACEngineManager.getChecker();
|
|
127
|
+
};
|
|
128
|
+
return MyFS;
|
|
129
|
+
}());
|
|
80
130
|
function initialize() {
|
|
81
131
|
return __awaiter(this, void 0, void 0, function () {
|
|
82
|
-
|
|
83
|
-
|
|
132
|
+
var absAPI, refactorMap, rules, _i, rules_1, rule, key, _a, _b, _c;
|
|
133
|
+
return __generator(this, function (_d) {
|
|
134
|
+
switch (_d.label) {
|
|
84
135
|
case 0:
|
|
85
136
|
if (Config)
|
|
86
137
|
return [2 /*return*/];
|
|
87
138
|
return [4 /*yield*/, ACConfigManager_1.ACConfigManager.getConfigUnsupported()];
|
|
88
139
|
case 1:
|
|
89
|
-
Config =
|
|
90
|
-
return [4 /*yield*/,
|
|
140
|
+
Config = _d.sent();
|
|
141
|
+
return [4 /*yield*/, ACEngineManager_1.ACEngineManager.loadEngineLocal()];
|
|
91
142
|
case 2:
|
|
92
|
-
|
|
93
|
-
|
|
143
|
+
_d.sent();
|
|
144
|
+
absAPI = new MyFS();
|
|
145
|
+
refactorMap = {};
|
|
146
|
+
rules = ACEngineManager_1.ACEngineManager.getRulesSync();
|
|
147
|
+
for (_i = 0, rules_1 = rules; _i < rules_1.length; _i++) {
|
|
148
|
+
rule = rules_1[_i];
|
|
149
|
+
if (rule.refactor) {
|
|
150
|
+
for (key in rule.refactor) {
|
|
151
|
+
refactorMap[key] = rule;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
_b = (_a = ReporterManager_1.ReporterManager).initialize;
|
|
156
|
+
_c = [Config, absAPI];
|
|
157
|
+
return [4 /*yield*/, ACEngineManager_1.ACEngineManager.getRulesets()];
|
|
158
|
+
case 3:
|
|
159
|
+
_b.apply(_a, _c.concat([_d.sent()]));
|
|
160
|
+
BaselineManager_1.BaselineManager.initialize(Config, absAPI, refactorMap);
|
|
161
|
+
return [2 /*return*/];
|
|
94
162
|
}
|
|
95
163
|
});
|
|
96
164
|
});
|
|
@@ -99,16 +167,25 @@ try {
|
|
|
99
167
|
// If cucumber is the platform...
|
|
100
168
|
var AfterAll = require('cucumber').AfterAll;
|
|
101
169
|
AfterAll(function (done) {
|
|
102
|
-
|
|
103
|
-
initialize()
|
|
170
|
+
// const rulePack = `${Config.rulePack}`;
|
|
171
|
+
initialize()
|
|
172
|
+
.then(function () { return ReporterManager_1.ReporterManager.generateSummaries(); })
|
|
173
|
+
.then(function () { return ACBrowserManager_1.ACBrowserManager.close(); })
|
|
174
|
+
.then(done);
|
|
104
175
|
});
|
|
105
176
|
}
|
|
106
177
|
catch (e) {
|
|
107
178
|
if (typeof (after) !== "undefined") {
|
|
108
179
|
after(function (done) {
|
|
109
180
|
if (Config) {
|
|
110
|
-
|
|
111
|
-
|
|
181
|
+
if (this.timeout) {
|
|
182
|
+
this.timeout(300000);
|
|
183
|
+
}
|
|
184
|
+
// const rulePack = `${Config.rulePack}/ace`;
|
|
185
|
+
initialize()
|
|
186
|
+
.then(function () { return ReporterManager_1.ReporterManager.generateSummaries(); })
|
|
187
|
+
.then(function () { return ACBrowserManager_1.ACBrowserManager.close(); })
|
|
188
|
+
.then(done);
|
|
112
189
|
}
|
|
113
190
|
else {
|
|
114
191
|
done();
|
|
@@ -118,11 +195,10 @@ catch (e) {
|
|
|
118
195
|
else {
|
|
119
196
|
process.on('beforeExit', function () {
|
|
120
197
|
return __awaiter(this, void 0, void 0, function () {
|
|
121
|
-
var rulePack_2;
|
|
122
198
|
return __generator(this, function (_a) {
|
|
123
199
|
if (Config) {
|
|
124
|
-
|
|
125
|
-
|
|
200
|
+
initialize()
|
|
201
|
+
.then(function () { return ReporterManager_1.ReporterManager.generateSummaries(); });
|
|
126
202
|
ACBrowserManager_1.ACBrowserManager.close();
|
|
127
203
|
}
|
|
128
204
|
return [2 /*return*/];
|
|
@@ -204,7 +280,7 @@ function getComplianceHelper(content, label) {
|
|
|
204
280
|
});
|
|
205
281
|
});
|
|
206
282
|
}
|
|
207
|
-
var URL, parsed,
|
|
283
|
+
var URL, parsed, policies, curPol;
|
|
208
284
|
return __generator(this, function (_a) {
|
|
209
285
|
switch (_a.label) {
|
|
210
286
|
case 0: return [4 /*yield*/, initialize()];
|
|
@@ -223,48 +299,6 @@ function getComplianceHelper(content, label) {
|
|
|
223
299
|
return [4 /*yield*/, ACEngineManager_1.ACEngineManager.loadEngine(parsed)];
|
|
224
300
|
case 3:
|
|
225
301
|
_a.sent();
|
|
226
|
-
// In the case that the label is null or undefined, throw an error using the karma API
|
|
227
|
-
// console.error with the message of the error.
|
|
228
|
-
if (label === null || typeof label === "undefined" || label === undefined) {
|
|
229
|
-
testcaseWhichIsMissingRequiredLabel = null;
|
|
230
|
-
generalErrorMessageLabelNotUnique = "\n[Error] labelNotProvided: Label must be provided when calling aChecker.getCompliance.";
|
|
231
|
-
// Get the caller of the aChecker.getCompliance function which will be the testcase that is calling this function
|
|
232
|
-
// This way we can make it the error more descriptive and would help the user identify where the issues is.
|
|
233
|
-
// We have to build and throw an Error() object and then using the try/catch to catch this error and then extract the
|
|
234
|
-
// stack and parse it to get the 2nd element in the stack which will be the caller of this function which will be the
|
|
235
|
-
// testcase which called this function.
|
|
236
|
-
try {
|
|
237
|
-
// Throw Error() object
|
|
238
|
-
throw new Error();
|
|
239
|
-
}
|
|
240
|
-
catch (exception) {
|
|
241
|
-
// Extract the stack trace from the error object and parse it to get the single one caller up which will be the 2nd index
|
|
242
|
-
testcaseWhichIsMissingRequiredLabel = exception.stack.split("\n")[1];
|
|
243
|
-
// Call the Karma error API, to send message to the Karma server that there was an error on the client side
|
|
244
|
-
console.error("Label was not provided at: " + testcaseWhichIsMissingRequiredLabel + generalErrorMessageLabelNotUnique);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
labelUnique = ACReportManager_1.ACReportManager.isLabelUnique(label);
|
|
248
|
-
// In the case that the label is not unique
|
|
249
|
-
if (!labelUnique) {
|
|
250
|
-
testcaseDoesNotUseUniqueLabel = null;
|
|
251
|
-
generalErrorMessageLabelNotUnique = "\n[Error] labelNotUnique: Label provided to aChecker.getCompliance should be unique across all testcases in a single accessibility-checker session.";
|
|
252
|
-
// Get the caller of the aChecker.getCompliance function which will be the testcase that is calling this function
|
|
253
|
-
// This way we can make it the error more descriptive and would help the user identify where the issues is.
|
|
254
|
-
// We have to build and throw an Error() object and then using the try/catch to catch this error and then extract the
|
|
255
|
-
// stack and parse it to get the 2nd element in the stack which will be the caller of this function which will be the
|
|
256
|
-
// testcase which called this function.
|
|
257
|
-
try {
|
|
258
|
-
// Throw Error() object
|
|
259
|
-
throw new Error();
|
|
260
|
-
}
|
|
261
|
-
catch (exception) {
|
|
262
|
-
// Extract the stack trace from the error object and parse it to get the single one caller up which will be the 2nd index
|
|
263
|
-
testcaseDoesNotUseUniqueLabel = exception.stack.split("\n")[1];
|
|
264
|
-
// Call the Karma error API, to send message to the Karma server that there was an error on the client side
|
|
265
|
-
console.error("Label \"" + label + "\" provided at: " + testcaseDoesNotUseUniqueLabel + " is not unique." + generalErrorMessageLabelNotUnique);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
302
|
policies = Config.policies;
|
|
269
303
|
curPol = null;
|
|
270
304
|
if (policies) {
|
|
@@ -295,11 +329,11 @@ function getComplianceHelper(content, label) {
|
|
|
295
329
|
exports.getComplianceHelper = getComplianceHelper;
|
|
296
330
|
function getComplianceHelperSelenium(label, parsed, curPol) {
|
|
297
331
|
return __awaiter(this, void 0, void 0, function () {
|
|
298
|
-
var startScan, browser, scriptStr, manage, report, getPolicies, valPolicies, _a, _b, finalReport, url,
|
|
332
|
+
var startScan, browser, scriptStr, manage, report, getPolicies, valPolicies, _a, _b, finalReport, url, title, origReport, image, err_1;
|
|
299
333
|
return __generator(this, function (_c) {
|
|
300
334
|
switch (_c.label) {
|
|
301
335
|
case 0:
|
|
302
|
-
_c.trys.push([0,
|
|
336
|
+
_c.trys.push([0, 9, , 10]);
|
|
303
337
|
startScan = Date.now();
|
|
304
338
|
browser = parsed;
|
|
305
339
|
scriptStr = "let cb = arguments[arguments.length - 1];\ntry {\nlet policies = ".concat(JSON.stringify(Config.policies), ";\n\nlet checker = new window.ace_ibma.Checker();\nlet customRulesets = ").concat(JSON.stringify(ACEngineManager_1.ACEngineManager.customRulesets), ";\ncustomRulesets.forEach((rs) => checker.addRuleset(rs));\nsetTimeout(function() {\n checker.check(document, policies).then(function(report) {\n for (const result of report.results) {\n delete result.node;\n }\n cb(report);\n })\n},0)\n} catch (e) {\ncb(e);\n}");
|
|
@@ -315,7 +349,6 @@ function getComplianceHelperSelenium(label, parsed, curPol) {
|
|
|
315
349
|
return [4 /*yield*/, browser.executeAsyncScript(scriptStr)];
|
|
316
350
|
case 1:
|
|
317
351
|
report = _c.sent();
|
|
318
|
-
report = ACReportManager_1.ACReportManager.setLevels(report);
|
|
319
352
|
getPolicies = "return new window.ace_ibma.Checker().rulesetIds;";
|
|
320
353
|
if (!(curPol != null && !checkPolicy)) return [3 /*break*/, 3];
|
|
321
354
|
checkPolicy = true;
|
|
@@ -327,46 +360,32 @@ function getComplianceHelperSelenium(label, parsed, curPol) {
|
|
|
327
360
|
_c.label = 3;
|
|
328
361
|
case 3:
|
|
329
362
|
finalReport = void 0;
|
|
330
|
-
if (!report.results) return [3 /*break*/,
|
|
363
|
+
if (!report.results) return [3 /*break*/, 8];
|
|
331
364
|
return [4 /*yield*/, browser.getCurrentUrl()];
|
|
332
365
|
case 4:
|
|
333
366
|
url = _c.sent();
|
|
367
|
+
return [4 /*yield*/, browser.getTitle()];
|
|
368
|
+
case 5:
|
|
369
|
+
title = _c.sent();
|
|
334
370
|
origReport = JSON.parse(JSON.stringify(report));
|
|
335
|
-
|
|
336
|
-
// Filter the violations based on the reportLevels
|
|
337
|
-
report = ACReportManager_1.ACReportManager.filterViolations(report);
|
|
338
|
-
counts = ACReportManager_1.ACReportManager.getCounts(report);
|
|
339
|
-
// Add the violation count to global summary object
|
|
340
|
-
ACReportManager_1.ACReportManager.addToSummaryCount(counts);
|
|
341
|
-
// Build the report object for this scan, to follow a specific format. Refer to the
|
|
342
|
-
// function prolog for more information on the object creation.
|
|
343
|
-
finalReport = ACReportManager_1.ACReportManager.buildReport(report, counts, url, label, startScan);
|
|
344
|
-
// Add the scan results to global karma result object which can be accessed when users testcase
|
|
345
|
-
// finishes, user can also access it to alter it for any reason.
|
|
346
|
-
ACReportManager_1.ACReportManager.addResultsToGlobal(finalReport);
|
|
347
|
-
// Need to call a karma API to send the results of a single scan to the accessibility-checker reporter so that they can be
|
|
348
|
-
// saved to a file by the server side reporter.
|
|
349
|
-
ACReportManager_1.ACReportManager.sendResultsToReporter(origReport, finalReport, "Selenium");
|
|
350
|
-
if (!(Config.captureScreenshots && browser.takeScreenshot)) return [3 /*break*/, 6];
|
|
371
|
+
if (!(Config.captureScreenshots && browser.takeScreenshot)) return [3 /*break*/, 7];
|
|
351
372
|
return [4 /*yield*/, browser.takeScreenshot()];
|
|
352
|
-
case
|
|
373
|
+
case 6:
|
|
353
374
|
image = _c.sent();
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
_c.label = 6;
|
|
361
|
-
case 6: return [2 /*return*/, {
|
|
375
|
+
origReport.screenshot = image;
|
|
376
|
+
_c.label = 7;
|
|
377
|
+
case 7:
|
|
378
|
+
finalReport = ReporterManager_1.ReporterManager.addEngineReport("Selenium", startScan, url, title, label, origReport);
|
|
379
|
+
_c.label = 8;
|
|
380
|
+
case 8: return [2 /*return*/, {
|
|
362
381
|
"report": finalReport,
|
|
363
382
|
"webdriver": parsed
|
|
364
383
|
}];
|
|
365
|
-
case
|
|
384
|
+
case 9:
|
|
366
385
|
err_1 = _c.sent();
|
|
367
386
|
console.error(err_1);
|
|
368
387
|
return [2 /*return*/, Promise.reject(err_1)];
|
|
369
|
-
case
|
|
388
|
+
case 10:
|
|
370
389
|
;
|
|
371
390
|
return [2 /*return*/];
|
|
372
391
|
}
|
|
@@ -375,11 +394,11 @@ function getComplianceHelperSelenium(label, parsed, curPol) {
|
|
|
375
394
|
}
|
|
376
395
|
function getComplianceHelperPuppeteer(label, parsed, curPol) {
|
|
377
396
|
return __awaiter(this, void 0, void 0, function () {
|
|
378
|
-
var startScan, page, report, valPolicies, _a, _b, finalReport, url,
|
|
397
|
+
var startScan, page, report, valPolicies, _a, _b, finalReport, url, title, origReport, image, err_2;
|
|
379
398
|
return __generator(this, function (_c) {
|
|
380
399
|
switch (_c.label) {
|
|
381
400
|
case 0:
|
|
382
|
-
_c.trys.push([0,
|
|
401
|
+
_c.trys.push([0, 9, , 10]);
|
|
383
402
|
startScan = Date.now();
|
|
384
403
|
page = parsed;
|
|
385
404
|
return [4 /*yield*/, page.evaluate(function (_a) {
|
|
@@ -400,7 +419,6 @@ function getComplianceHelperPuppeteer(label, parsed, curPol) {
|
|
|
400
419
|
}, { policies: Config.policies, customRulesets: ACEngineManager_1.ACEngineManager.customRulesets })];
|
|
401
420
|
case 1:
|
|
402
421
|
report = _c.sent();
|
|
403
|
-
report = ACReportManager_1.ACReportManager.setLevels(report);
|
|
404
422
|
if (!(curPol != null && !checkPolicy)) return [3 /*break*/, 3];
|
|
405
423
|
_b = (_a = ACEngineManager_1.ACEngineManager.customRulesets.map(function (rs) { return rs.id; })).concat;
|
|
406
424
|
return [4 /*yield*/, page.evaluate("new window.ace_ibma.Checker().rulesetIds")];
|
|
@@ -411,51 +429,37 @@ function getComplianceHelperPuppeteer(label, parsed, curPol) {
|
|
|
411
429
|
_c.label = 3;
|
|
412
430
|
case 3:
|
|
413
431
|
finalReport = void 0;
|
|
414
|
-
if (!report.results) return [3 /*break*/,
|
|
432
|
+
if (!report.results) return [3 /*break*/, 8];
|
|
415
433
|
return [4 /*yield*/, page.evaluate("document.location.href")];
|
|
416
434
|
case 4:
|
|
417
435
|
url = _c.sent();
|
|
436
|
+
return [4 /*yield*/, page.evaluate("document.location.title")];
|
|
437
|
+
case 5:
|
|
438
|
+
title = _c.sent();
|
|
418
439
|
origReport = JSON.parse(JSON.stringify(report));
|
|
419
|
-
|
|
420
|
-
// Filter the violations based on the reporLevels
|
|
421
|
-
report = ACReportManager_1.ACReportManager.filterViolations(report);
|
|
422
|
-
counts = ACReportManager_1.ACReportManager.getCounts(report);
|
|
423
|
-
// Add the violation count to global summary object
|
|
424
|
-
ACReportManager_1.ACReportManager.addToSummaryCount(counts);
|
|
425
|
-
// Build the report object for this scan, to follow a specific format. Refer to the
|
|
426
|
-
// function prolog for more information on the object creation.
|
|
427
|
-
finalReport = ACReportManager_1.ACReportManager.buildReport(report, counts, url, label, startScan);
|
|
428
|
-
// Add the scan results to global karma result object which can be accessed when users testcase
|
|
429
|
-
// finishes, user can also access it to alter it for any reason.
|
|
430
|
-
ACReportManager_1.ACReportManager.addResultsToGlobal(finalReport);
|
|
431
|
-
// Need to call a karma API to send the results of a single scan to the accessibility-checker reporter so that they can be
|
|
432
|
-
// saved to a file by the server side reporter.
|
|
433
|
-
ACReportManager_1.ACReportManager.sendResultsToReporter(origReport, finalReport, "Puppeteer");
|
|
434
|
-
if (!Config.captureScreenshots) return [3 /*break*/, 6];
|
|
440
|
+
if (!Config.captureScreenshots) return [3 /*break*/, 7];
|
|
435
441
|
return [4 /*yield*/, page.screenshot({
|
|
436
442
|
fullPage: true,
|
|
437
443
|
encoding: "base64"
|
|
438
444
|
})];
|
|
439
|
-
case 5:
|
|
440
|
-
image = _c.sent();
|
|
441
|
-
screenshotResult = {
|
|
442
|
-
image: image,
|
|
443
|
-
label: label,
|
|
444
|
-
scanID: Config.scanID
|
|
445
|
-
};
|
|
446
|
-
ACReportManager_1.ACReportManager.sendScreenShotToReporter(screenshotResult);
|
|
447
|
-
_c.label = 6;
|
|
448
445
|
case 6:
|
|
446
|
+
image = _c.sent();
|
|
447
|
+
origReport.screenshot = image;
|
|
448
|
+
_c.label = 7;
|
|
449
|
+
case 7:
|
|
450
|
+
finalReport = ReporterManager_1.ReporterManager.addEngineReport("Puppeteer", startScan, url, title, label, origReport);
|
|
451
|
+
_c.label = 8;
|
|
452
|
+
case 8:
|
|
449
453
|
page.aceBusy = false;
|
|
450
454
|
return [2 /*return*/, {
|
|
451
455
|
"report": finalReport,
|
|
452
456
|
"puppeteer": parsed
|
|
453
457
|
}];
|
|
454
|
-
case
|
|
458
|
+
case 9:
|
|
455
459
|
err_2 = _c.sent();
|
|
456
460
|
console.error(err_2);
|
|
457
461
|
return [2 /*return*/, Promise.reject(err_2)];
|
|
458
|
-
case
|
|
462
|
+
case 10:
|
|
459
463
|
;
|
|
460
464
|
return [2 /*return*/];
|
|
461
465
|
}
|
|
@@ -464,7 +468,7 @@ function getComplianceHelperPuppeteer(label, parsed, curPol) {
|
|
|
464
468
|
}
|
|
465
469
|
function getComplianceHelperLocal(label, parsed, curPol) {
|
|
466
470
|
return __awaiter(this, void 0, void 0, function () {
|
|
467
|
-
var startScan, checker_1, report, valPolicies, finalReport, url, origReport,
|
|
471
|
+
var startScan, checker_1, report, valPolicies, finalReport, url, origReport, err_3;
|
|
468
472
|
return __generator(this, function (_a) {
|
|
469
473
|
switch (_a.label) {
|
|
470
474
|
case 0:
|
|
@@ -482,7 +486,6 @@ function getComplianceHelperLocal(label, parsed, curPol) {
|
|
|
482
486
|
})];
|
|
483
487
|
case 1:
|
|
484
488
|
report = _a.sent();
|
|
485
|
-
report = ACReportManager_1.ACReportManager.setLevels(report);
|
|
486
489
|
if (curPol != null && !checkPolicy) {
|
|
487
490
|
valPolicies = checker_1.rulesetIds;
|
|
488
491
|
checkPolicy = true;
|
|
@@ -493,21 +496,7 @@ function getComplianceHelperLocal(label, parsed, curPol) {
|
|
|
493
496
|
if (report.results) {
|
|
494
497
|
url = parsed.location && parsed.location.href;
|
|
495
498
|
origReport = JSON.parse(JSON.stringify(report));
|
|
496
|
-
|
|
497
|
-
// Filter the violations based on the reporLevels
|
|
498
|
-
report = ACReportManager_1.ACReportManager.filterViolations(report);
|
|
499
|
-
counts = ACReportManager_1.ACReportManager.getCounts(report);
|
|
500
|
-
// Add the violation count to global summary object
|
|
501
|
-
ACReportManager_1.ACReportManager.addToSummaryCount(counts);
|
|
502
|
-
// Build the report object for this scan, to follow a specific format. Refer to the
|
|
503
|
-
// function prolog for more information on the object creation.
|
|
504
|
-
finalReport = ACReportManager_1.ACReportManager.buildReport(report, counts, URL, label, startScan);
|
|
505
|
-
// Add the scan results to global karma result object which can be accessed when users testcase
|
|
506
|
-
// finishes, user can also access it to alter it for any reason.
|
|
507
|
-
ACReportManager_1.ACReportManager.addResultsToGlobal(finalReport);
|
|
508
|
-
// Need to call a karma API to send the results of a single scan to the accessibility-checker reporter so that they can be
|
|
509
|
-
// saved to a file by the server side reporter.
|
|
510
|
-
ACReportManager_1.ACReportManager.sendResultsToReporter(origReport, finalReport, "Native");
|
|
499
|
+
finalReport = ReporterManager_1.ReporterManager.addEngineReport("Native", startScan, url, parsed.title, label, origReport);
|
|
511
500
|
}
|
|
512
501
|
return [2 /*return*/, {
|
|
513
502
|
"report": finalReport
|