@jrpool/kilotest 25.0.0 → 25.0.1
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/index.js +1 -5
- package/package.json +1 -1
- package/reportIssues/api.js +44 -28
- package/util.js +3 -1
package/index.js
CHANGED
|
@@ -75,9 +75,6 @@ const WAVE_THRESHOLD = Number(process.env.WAVE_BALANCE_THRESHOLD);
|
|
|
75
75
|
const AI_SERVICE0_THRESHOLD = Number(process.env.AI_SERVICE0_BALANCE_THRESHOLD);
|
|
76
76
|
const AI_MODEL0_INPUT_PRICE = Number(process.env.AI_MODEL0_INPUT_PRICE);
|
|
77
77
|
const AI_MODEL0_OUTPUT_PRICE = Number(process.env.AI_MODEL0_OUTPUT_PRICE);
|
|
78
|
-
const researchAgents = {
|
|
79
|
-
'research-agent': 'Internal Research Agent'
|
|
80
|
-
}
|
|
81
78
|
|
|
82
79
|
// FUNCTIONS
|
|
83
80
|
|
|
@@ -589,8 +586,7 @@ const requestHandler = async (request, response) => {
|
|
|
589
586
|
if (service === 'reportIssues') {
|
|
590
587
|
// Get the report identifiers from the path.
|
|
591
588
|
const [timeStamp, jobID] = specs;
|
|
592
|
-
const
|
|
593
|
-
const args = [agentName, timeStamp, jobID];
|
|
589
|
+
const args = [agentID, timeStamp, jobID];
|
|
594
590
|
const reportSpecsBad = await isHidden(timeStamp, jobID);
|
|
595
591
|
// If the report is nonexistent or hidden:
|
|
596
592
|
if (reportSpecsBad) {
|
package/package.json
CHANGED
package/reportIssues/api.js
CHANGED
|
@@ -10,8 +10,8 @@ const {
|
|
|
10
10
|
getDateTime,
|
|
11
11
|
getNowStamp,
|
|
12
12
|
getRandomString,
|
|
13
|
-
getToolNamesString,
|
|
14
13
|
isHidden,
|
|
14
|
+
researchAgents,
|
|
15
15
|
tools
|
|
16
16
|
} = require('../util');
|
|
17
17
|
|
|
@@ -30,24 +30,28 @@ const getToolFacts = toolIDs => {
|
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
32
|
// Gets facts about an issue.
|
|
33
|
-
const getIssueFacts = issue => {
|
|
34
|
-
const {issueID, reporterCount,
|
|
33
|
+
const getIssueFacts = (thisHost, agentID, timeStamp, jobID, issue) => {
|
|
34
|
+
const {issueID, reporterCount, reporters, summary, violatorCount, wcag, why} = issue;
|
|
35
|
+
const wcagType = wcag.length === 3 ? 'principle' : 'success criterion';
|
|
35
36
|
return {
|
|
36
37
|
identifier: issueID,
|
|
37
38
|
summary,
|
|
38
|
-
|
|
39
|
+
[`related WCAG ${wcagType}`]: wcag,
|
|
39
40
|
'impact on a user': why,
|
|
40
|
-
'tools reporting
|
|
41
|
-
'number
|
|
42
|
-
'
|
|
43
|
-
'facts about the tools alphabetized by name': getToolFacts(reporters.map(tool => tool.toolID))
|
|
41
|
+
'tools reporting the issue': {
|
|
42
|
+
'number': reporterCount,
|
|
43
|
+
'names': reporters.map(tool => tool.toolName)
|
|
44
44
|
},
|
|
45
|
-
'number of HTML elements reported as exhibiting the issue': violatorCount
|
|
45
|
+
'number of HTML elements reported as exhibiting the issue': violatorCount,
|
|
46
|
+
'URLs for details about the issue on the page': {
|
|
47
|
+
'for you': `${thisHost}/api/${agentID}/reportIssue/${timeStamp}/${jobID}/${issueID}`,
|
|
48
|
+
'for humans': `${thisHost}/reportIssue/${timeStamp}/${jobID}/${issueID}`
|
|
49
|
+
}
|
|
46
50
|
};
|
|
47
51
|
};
|
|
48
52
|
// Returns a response to a target-issues request.
|
|
49
53
|
exports.response = async args => {
|
|
50
|
-
const [
|
|
54
|
+
const [agentID, timeStamp, jobID] = args;
|
|
51
55
|
const reportIsHidden = await isHidden(timeStamp, jobID);
|
|
52
56
|
// If the report is not available:
|
|
53
57
|
if (reportIsHidden) {
|
|
@@ -61,44 +65,52 @@ exports.response = async args => {
|
|
|
61
65
|
const {pageData, issuesData} = data;
|
|
62
66
|
const {what, url, daysAgo} = pageData;
|
|
63
67
|
const {issueCount, issues, preventions, reporterCount, reporters, violatorCount} = issuesData;
|
|
64
|
-
const preventedTools =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
68
|
+
const preventedTools = Object.entries(preventions).map(prevention => ({
|
|
69
|
+
name: tools[prevention[0]][0],
|
|
70
|
+
'reason for failure': prevention[1]
|
|
71
|
+
}));
|
|
68
72
|
const thisHost = process.env.THIS_KILOTEST_HOST;
|
|
69
73
|
// Get a response.
|
|
70
74
|
const response = {
|
|
71
|
-
summary: `This document fulfills a request made by an agent to Kilotest. The agent requested data from a report
|
|
75
|
+
summary: `This document fulfills a request made by an agent to the Kilotest service. The agent requested data from a Kilotest report about the accessibility, usability, and standard-conformity of a web page. Kilotest, with the help of Testaro, Testilo, and an ensemble of ten testing tools, performs tests on web pages, using a combination of rule- and machine-learning-based methods, and produces reports. Kilotest exposes several API endpoints for agents and several web UI URLs for humans to obtain information from Kilotest reports. To learn more about Kilotest and the advangages of testing with an ensemble of tools, visit the deployed instance of Kilotest (${process.env.DEPLOYED_KILOTEST_HOST}), which contains an introduction on its home page and a tutorial.`,
|
|
72
76
|
'tool name': 'Kilotest',
|
|
73
77
|
request: {
|
|
74
|
-
'
|
|
78
|
+
'requesting agent': {
|
|
79
|
+
identifier: agentID,
|
|
80
|
+
name: researchAgents[agentID]
|
|
81
|
+
},
|
|
75
82
|
'type of request': {
|
|
76
83
|
identifier: 'reportIssues',
|
|
77
|
-
description: 'What issues
|
|
84
|
+
description: 'What issues does the specified report describe?'
|
|
85
|
+
},
|
|
86
|
+
'closest ancestor request': {
|
|
87
|
+
description: 'Which web pages are reports available about, and what are the statistics about the issues reported for each page?',
|
|
88
|
+
'URL for you': `${thisHost}/api/${agentID}/targets.html`,
|
|
89
|
+
'URL for humans': `${thisHost}/targets.html`
|
|
78
90
|
}
|
|
79
91
|
},
|
|
80
92
|
'response metadata': {
|
|
93
|
+
identifier: `${getNowStamp()}-${getRandomString(3)}`,
|
|
81
94
|
'date and time': new Date().toISOString(),
|
|
82
|
-
'
|
|
95
|
+
'URL of the human-oriented equivalent of this response': `${thisHost}/reportIssues.html/${timeStamp}/${jobID}`
|
|
83
96
|
},
|
|
84
97
|
report: {
|
|
85
98
|
identifier: `${timeStamp}-${jobID}`,
|
|
86
99
|
'creation date': getDateTime(timeStamp),
|
|
87
|
-
'days since the creation date': daysAgo
|
|
88
|
-
'URL for human inspection': `${thisHost}/reportIssues.html/${timeStamp}/${jobID}`
|
|
100
|
+
'days since the creation date': daysAgo
|
|
89
101
|
},
|
|
90
102
|
'tested web page': {
|
|
91
103
|
description: what,
|
|
92
104
|
URL: url
|
|
93
105
|
},
|
|
94
|
-
'
|
|
106
|
+
'tools that tried to test the page': getToolFacts(Object.keys(tools)),
|
|
95
107
|
'tools that were unable to test the page': preventedTools,
|
|
96
108
|
'tools that reported issues': {
|
|
97
|
-
|
|
98
|
-
|
|
109
|
+
number: reporterCount,
|
|
110
|
+
names: reporters.map(tool => tool.toolName)
|
|
99
111
|
},
|
|
100
112
|
'number of issues reported': {
|
|
101
|
-
|
|
113
|
+
total: issueCount,
|
|
102
114
|
'by priority': {
|
|
103
115
|
'highest priority': issues[4].length,
|
|
104
116
|
'high priority': issues[3].length,
|
|
@@ -108,10 +120,14 @@ exports.response = async args => {
|
|
|
108
120
|
},
|
|
109
121
|
'number of HTML elements reported as exhibiting issues': violatorCount,
|
|
110
122
|
'issues reported': {
|
|
111
|
-
'highest priority': issues[4]
|
|
112
|
-
|
|
113
|
-
'
|
|
114
|
-
|
|
123
|
+
'highest priority': issues[4]
|
|
124
|
+
.map(issue => getIssueFacts(thisHost, agentID, timeStamp, jobID, issue)),
|
|
125
|
+
'high priority': issues[3]
|
|
126
|
+
.map(issue => getIssueFacts(thisHost, agentID, timeStamp, jobID, issue)),
|
|
127
|
+
'low priority': issues[2]
|
|
128
|
+
.map(issue => getIssueFacts(thisHost, agentID, timeStamp, jobID, issue)),
|
|
129
|
+
'lowest priority': issues[1]
|
|
130
|
+
.map(issue => getIssueFacts(thisHost, agentID, timeStamp, jobID, issue))
|
|
115
131
|
}
|
|
116
132
|
};
|
|
117
133
|
return response;
|
package/util.js
CHANGED
|
@@ -34,9 +34,11 @@ const tools = exports.tools = {
|
|
|
34
34
|
nuVnu: ['Html Checker', 'World Wide Web Consortium'],
|
|
35
35
|
qualWeb: ['QualWeb', 'University of Lisbon'],
|
|
36
36
|
testaro: ['Testaro', 'CVS Health'],
|
|
37
|
-
wax: ['WallyAX', 'Wally'],
|
|
38
37
|
wave: ['WAVE', 'Utah State University'],
|
|
39
38
|
};
|
|
39
|
+
exports.researchAgents = {
|
|
40
|
+
'research-agent': 'Internal Research Agent'
|
|
41
|
+
}
|
|
40
42
|
|
|
41
43
|
// FUNCTIONS
|
|
42
44
|
|