testilo 23.1.0 → 24.0.0
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 +9 -7
- package/batch.js +1 -1
- package/call.js +4 -2
- package/merge.js +7 -4
- package/package.json +1 -1
- package/script.js +0 -2
package/README.md
CHANGED
|
@@ -157,8 +157,6 @@ Here is a script:
|
|
|
157
157
|
strict: true,
|
|
158
158
|
isolate: true,
|
|
159
159
|
timeLimit: 60,
|
|
160
|
-
standard: 'also',
|
|
161
|
-
observe: false,
|
|
162
160
|
acts: [
|
|
163
161
|
{
|
|
164
162
|
type: 'placeholder',
|
|
@@ -189,8 +187,6 @@ A script has several properties that specify facts about the jobs to be created.
|
|
|
189
187
|
- `strict`: `true` if Testaro is to abort jobs when a target redirects a request to a URL differing substantially from the one specified. If `false` Testaro is to allow redirection. All differences are considered substantial unless the URLs differ only in the presence and absence of a trailing slash.
|
|
190
188
|
- `isolate`: If `true`, Testilo, before creating a job, will isolate test acts, as needed, from effects of previous test acts, by inserting a copy of the latest placeholder after each target-modifying test act other than the final act. If `false`, placeholders will not be duplicated.
|
|
191
189
|
- `timeLimit`: This specifies the maximum duration, in seconds, of a job. Testaro will abort jobs that are not completed within that time.
|
|
192
|
-
- `standard`: If `also`, jobs will tell Testaro to include in its reports both the original results of the tests of tools and the Testaro-standardized results. If `only`, reports are to include only the standardized test results. If `no`, reports are to include only the original results, without standardization.
|
|
193
|
-
- `observe`: If `true`, jobs will tell Testaro to allow granular observation of job progress. If `false`, jobs will tell Testaro not to permit granular observation, but only to send the report to the server when the report is completed. It is generally user-friendly to allow granular observation, and for user applications to implement it, if they make users wait while jobs are assigned and performed, since that process typically takes about 3 minutes.
|
|
194
190
|
- `acts`: an array of acts.
|
|
195
191
|
|
|
196
192
|
The first act in this example script is a placeholder, whose `which` property is `'private'`. If the above batch were merged with this script, in each job the placeholder would be replaced with the `private` acts of a target. For example, the first act of the first job would launch a Chromium browser, navigate to the Acme login page, complete and submit the login form, wait for the account page to load, run the Axe tests, and then run the QualWeb tests. If the batch contained additional targets, additional jobs would be created, with the login actions for each target specified in the `private` array of the `acts` object of that target.
|
|
@@ -409,7 +405,7 @@ A module can invoke `merge` in this way:
|
|
|
409
405
|
|
|
410
406
|
```javaScript
|
|
411
407
|
const {merge} = require('testilo/merge');
|
|
412
|
-
const jobs = merge(script, batch, requester, timeStamp);
|
|
408
|
+
const jobs = merge(script, batch, standard, observe, requester, timeStamp);
|
|
413
409
|
```
|
|
414
410
|
|
|
415
411
|
The `merge` module uses these 4 arguments to create jobs from a script and a batch.
|
|
@@ -417,6 +413,8 @@ The `merge` module uses these 4 arguments to create jobs from a script and a bat
|
|
|
417
413
|
The arguments are:
|
|
418
414
|
- `script`: a script.
|
|
419
415
|
- `batch`: a batch.
|
|
416
|
+
- `standard`: how to handle standardization. If `also`, jobs will tell Testaro to include in its reports both the original results of the tests of tools and the Testaro-standardized results. If `only`, reports are to include only the standardized test results. If `no`, reports are to include only the original results, without standardization.
|
|
417
|
+
- `observe`: whether to allow granular observation. If `true`, jobs will tell Testaro to permit granular observation of job progress. If `false`, jobs will tell Testaro not to permit granular observation, but only to send the report to the server when the report is completed. It is generally user-friendly to allow granular observation, and for user applications to implement it, if they make users wait while jobs are assigned and performed, since that process typically takes about 3 minutes.
|
|
420
418
|
- `requester`: an email address.
|
|
421
419
|
- `timeStamp`: the earliest UTC date and time when the jobs may be assigned (format `240415T1230`), or an empty string if now.
|
|
422
420
|
|
|
@@ -428,12 +426,16 @@ A user can invoke `merge` in this way:
|
|
|
428
426
|
|
|
429
427
|
- Create a script and save it as a JSON file in the `scripts` subdirectory of the `SPECDIR` directory.
|
|
430
428
|
- Create a batch and save it as a JSON file in the `batches` subdirectory of the `SPECDIR` directory.
|
|
431
|
-
- In the Testilo project directory, execute the statement
|
|
429
|
+
- In the Testilo project directory, execute the statement:
|
|
430
|
+
|
|
431
|
+
```javascript
|
|
432
|
+
node call merge scriptID batchID standard observe requester timeStamp todoDir
|
|
433
|
+
```
|
|
432
434
|
|
|
433
435
|
In this statement, replace:
|
|
434
436
|
- `scriptID` with the ID (which is also the base of the file name) of the script.
|
|
435
437
|
- `batchID` with the ID (which is also the base of the file name) of the batch.
|
|
436
|
-
- `
|
|
438
|
+
- `standard`, `observe`, `requester`, and `timeStamp` as described above.
|
|
437
439
|
- `todoDir`: `true` if the jobs are to be saved in the `todo` subdirectory, or `false` if they are to be saved in the `pending` subdirectory, of the `JOBDIR` directory.
|
|
438
440
|
|
|
439
441
|
The `call` module will retrieve the named script and batch from their respective directories.
|
package/batch.js
CHANGED
|
@@ -55,7 +55,7 @@ exports.batch = (id, what, targetList) => {
|
|
|
55
55
|
// Otherwise, i.e. if the arguments are invalid:
|
|
56
56
|
else {
|
|
57
57
|
// Return this.
|
|
58
|
-
console.log('ERROR: information missing or invalid');
|
|
58
|
+
console.log('ERROR: Batch information missing or invalid');
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
61
61
|
};
|
package/call.js
CHANGED
|
@@ -76,6 +76,8 @@ const callScript = async (scriptID, classificationID = null, ... issueIDs) => {
|
|
|
76
76
|
const callMerge = async (
|
|
77
77
|
scriptID,
|
|
78
78
|
batchID,
|
|
79
|
+
standard,
|
|
80
|
+
observe,
|
|
79
81
|
requester,
|
|
80
82
|
timeStamp,
|
|
81
83
|
todoDir
|
|
@@ -86,7 +88,7 @@ const callMerge = async (
|
|
|
86
88
|
const batchJSON = await fs.readFile(`${specDir}/batches/${batchID}.json`, 'utf8');
|
|
87
89
|
const batch = JSON.parse(batchJSON);
|
|
88
90
|
// Merge them into an array of jobs.
|
|
89
|
-
const jobs = merge(script, batch, requester, timeStamp);
|
|
91
|
+
const jobs = merge(script, batch, standard, observe === 'true', requester, timeStamp);
|
|
90
92
|
// Save the jobs.
|
|
91
93
|
const subdir = `${jobDir}/${todoDir === 'true' ? 'todo' : 'pending'}`;
|
|
92
94
|
for (const job of jobs) {
|
|
@@ -221,7 +223,7 @@ else if (fn === 'script' && fnArgs.length) {
|
|
|
221
223
|
console.log('Execution completed');
|
|
222
224
|
});
|
|
223
225
|
}
|
|
224
|
-
else if (fn === 'merge' && fnArgs.length ===
|
|
226
|
+
else if (fn === 'merge' && fnArgs.length === 7) {
|
|
225
227
|
callMerge(... fnArgs)
|
|
226
228
|
.then(() => {
|
|
227
229
|
console.log('Execution completed');
|
package/merge.js
CHANGED
|
@@ -21,12 +21,13 @@ const contaminantNames = new Set([
|
|
|
21
21
|
'htmlcs',
|
|
22
22
|
'testaro'
|
|
23
23
|
]);
|
|
24
|
-
|
|
24
|
+
// Length of the random merger ID.
|
|
25
|
+
const mergeIDLength = 2;
|
|
25
26
|
|
|
26
27
|
// ########## FUNCTIONS
|
|
27
28
|
|
|
28
29
|
// Merges a script and a batch and returns jobs.
|
|
29
|
-
exports.merge = (script, batch, requester, timeStamp) => {
|
|
30
|
+
exports.merge = (script, batch, standard, observe, requester, timeStamp) => {
|
|
30
31
|
// If a time stamp was specified:
|
|
31
32
|
if (timeStamp) {
|
|
32
33
|
// If it is invalid:
|
|
@@ -55,8 +56,10 @@ exports.merge = (script, batch, requester, timeStamp) => {
|
|
|
55
56
|
requester
|
|
56
57
|
};
|
|
57
58
|
// Add properties to the job.
|
|
58
|
-
protoJob.
|
|
59
|
+
protoJob.standard = standard;
|
|
60
|
+
protoJob.observe = observe;
|
|
59
61
|
protoJob.timeStamp = timeStamp;
|
|
62
|
+
protoJob.creationTimeStamp = getNowStamp();
|
|
60
63
|
// If isolation was requested:
|
|
61
64
|
if (script.isolate) {
|
|
62
65
|
// For each act:
|
|
@@ -88,7 +91,7 @@ exports.merge = (script, batch, requester, timeStamp) => {
|
|
|
88
91
|
// Initialize an array of jobs.
|
|
89
92
|
const jobs = [];
|
|
90
93
|
// Get an ID for the merger.
|
|
91
|
-
const mergeID = getRandomString(
|
|
94
|
+
const mergeID = getRandomString(mergeIDLength);
|
|
92
95
|
// For each target in the batch:
|
|
93
96
|
const {targets} = batch;
|
|
94
97
|
targets.forEach((target, index) => {
|
package/package.json
CHANGED
package/script.js
CHANGED