testaro 8.1.16 → 8.2.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 +1 -1
- package/call.js +2 -3
- package/high.js +1 -1
- package/package.json +1 -1
- package/run.js +1 -1
- package/tests/docType.js +7 -5
- package/validation/executors/high.js +1 -1
- package/validation/tests/targets/docType/good.html +2 -2
- package/watch.js +13 -13
package/README.md
CHANGED
|
@@ -662,7 +662,7 @@ If multiple workstations run Testaro and do work for the same server, the server
|
|
|
662
662
|
|
|
663
663
|
In addition to their uses described above, environment variables can be used by commands of type `text`, as documented in the `commands.js` file.
|
|
664
664
|
|
|
665
|
-
Before
|
|
665
|
+
Before making Testaro run a job, you can optionally also set `process.env.DEBUG` (to `'true'` or anything else) and/or `process.env.WAITS` (to a non-negative integer). The effects of these variables are described in the `run.js` file.
|
|
666
666
|
|
|
667
667
|
You may store environment variables in an untracked `.env` file if you wish, and Testaro will recognize them. Here is a template for a `.env` file:
|
|
668
668
|
|
package/call.js
CHANGED
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
0. function to execute.
|
|
7
7
|
1+. arguments to pass to the function.
|
|
8
8
|
Usage examples:
|
|
9
|
-
node call high
|
|
10
|
-
node call watch
|
|
11
|
-
node call watch net forever 60
|
|
9
|
+
node call high ts25
|
|
10
|
+
node call watch true true 30
|
|
12
11
|
*/
|
|
13
12
|
|
|
14
13
|
// ########## IMPORTS
|
package/high.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
require('dotenv').config();
|
|
11
11
|
// Module to read and write files.
|
|
12
12
|
const fs = require('fs/promises');
|
|
13
|
-
// Module to run
|
|
13
|
+
// Module to run jobs and report results.
|
|
14
14
|
const {doJob} = require('./run');
|
|
15
15
|
|
|
16
16
|
// ########## CONSTANTS
|
package/package.json
CHANGED
package/run.js
CHANGED
|
@@ -1524,7 +1524,7 @@ const injectLaunches = acts => {
|
|
|
1524
1524
|
exports.doJob = async report => {
|
|
1525
1525
|
// If the report is valid:
|
|
1526
1526
|
if(isValidReport(report)) {
|
|
1527
|
-
// Add the
|
|
1527
|
+
// Add the job commands to the report as its initial acts.
|
|
1528
1528
|
report.acts = JSON.parse(JSON.stringify(report.job.commands));
|
|
1529
1529
|
/*
|
|
1530
1530
|
Inject launch and url acts where necessary to undo DOM changes, if specified.
|
package/tests/docType.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/*
|
|
2
2
|
docType
|
|
3
3
|
Derived from the bbc-a11y allDocumentsMustHaveAW3cRecommendedDoctype test.
|
|
4
|
-
This test reports a failure to equip the page document with a W3C-recommended doctype.
|
|
4
|
+
This test reports a failure to equip the page document with a W3C-recommended HTML doctype.
|
|
5
5
|
*/
|
|
6
6
|
exports.reporter = async page => {
|
|
7
7
|
// Identify the visible links without href attributes.
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
docHasType
|
|
11
|
-
|
|
8
|
+
const docHasType = await page.evaluate(() => {
|
|
9
|
+
const docType = document.doctype;
|
|
10
|
+
const docHasType = !! docType && docType.name && docType.name.toLowerCase() === 'html';
|
|
11
|
+
return docHasType;
|
|
12
|
+
});
|
|
13
|
+
return {result: {docHasType}};
|
|
12
14
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!
|
|
1
|
+
<!docType Html>
|
|
2
2
|
<html lang="en-US">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<body>
|
|
10
10
|
<main>
|
|
11
11
|
<h1>Page with doctype</h1>
|
|
12
|
-
<p>This page has a doctype.</p>
|
|
12
|
+
<p>This page has a doctype. Because the entire tag is case-insensitive, this instance has mixed case, which should be treated as conformant.</p>
|
|
13
13
|
</main>
|
|
14
14
|
</body>
|
|
15
15
|
</html>
|
package/watch.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
watch.js
|
|
3
|
-
Module for watching for a
|
|
3
|
+
Module for watching for a job and running it when found.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// ########## IMPORTS
|
|
@@ -32,14 +32,14 @@ const checkDirJob = async () => {
|
|
|
32
32
|
const jobFileNames = jobDirFileNames.filter(fileName => fileName.endsWith('.json'));
|
|
33
33
|
if (jobFileNames.length) {
|
|
34
34
|
console.log('Directory job found');
|
|
35
|
-
const
|
|
35
|
+
const jobJSON = await fs.readFile(`${jobDir}/${jobFileNames[0]}`, 'utf8');
|
|
36
36
|
try {
|
|
37
|
-
const
|
|
38
|
-
return
|
|
37
|
+
const job = JSON.parse(jobJSON, null, 2);
|
|
38
|
+
return job;
|
|
39
39
|
}
|
|
40
40
|
catch(error) {
|
|
41
41
|
return {
|
|
42
|
-
error: 'ERROR:
|
|
42
|
+
error: 'ERROR: Job was not JSON',
|
|
43
43
|
message: error.message
|
|
44
44
|
};
|
|
45
45
|
}
|
|
@@ -55,7 +55,7 @@ const checkDirJob = async () => {
|
|
|
55
55
|
};
|
|
56
56
|
// Checks for a network job.
|
|
57
57
|
const checkNetJob = async () => {
|
|
58
|
-
const
|
|
58
|
+
const job = await new Promise(resolve => {
|
|
59
59
|
const wholeURL = `${protocol}://${jobURL}?agent=${agent}`;
|
|
60
60
|
const request = client.request(wholeURL, response => {
|
|
61
61
|
const chunks = [];
|
|
@@ -64,10 +64,10 @@ const checkNetJob = async () => {
|
|
|
64
64
|
});
|
|
65
65
|
response.on('end', () => {
|
|
66
66
|
try {
|
|
67
|
-
const
|
|
68
|
-
const
|
|
67
|
+
const jobJSON = chunks.join('');
|
|
68
|
+
const job = JSON.parse(jobJSON);
|
|
69
69
|
// Return it.
|
|
70
|
-
resolve(
|
|
70
|
+
resolve(job);
|
|
71
71
|
}
|
|
72
72
|
catch(error) {
|
|
73
73
|
resolve({
|
|
@@ -84,8 +84,8 @@ const checkNetJob = async () => {
|
|
|
84
84
|
});
|
|
85
85
|
request.end();
|
|
86
86
|
});
|
|
87
|
-
console.log(`Network job ${
|
|
88
|
-
return
|
|
87
|
+
console.log(`Network job ${job.id || 'not'} received`);
|
|
88
|
+
return job;
|
|
89
89
|
};
|
|
90
90
|
// Writes a directory report.
|
|
91
91
|
const writeDirReport = async report => {
|
|
@@ -196,9 +196,9 @@ const runJob = async (job, isDirWatch) => {
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
else {
|
|
199
|
-
console.log('ERROR:
|
|
199
|
+
console.log('ERROR: Job has no id');
|
|
200
200
|
return {
|
|
201
|
-
error: 'ERROR:
|
|
201
|
+
error: 'ERROR: Job has no id'
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
204
|
};
|