testaro 8.1.13 → 8.1.15
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/package.json +1 -1
- package/run.js +2 -0
- package/validation/executors/watchNet.js +11 -5
- package/watch.js +4 -2
package/package.json
CHANGED
package/run.js
CHANGED
|
@@ -1468,7 +1468,9 @@ const doActs = async (report, actIndex, page) => {
|
|
|
1468
1468
|
await doActs(report, actIndex + 1, page);
|
|
1469
1469
|
}
|
|
1470
1470
|
else {
|
|
1471
|
+
console.log('No more acts to perform; closing the browser');
|
|
1471
1472
|
await browserClose();
|
|
1473
|
+
console.log('Browser closed');
|
|
1472
1474
|
}
|
|
1473
1475
|
};
|
|
1474
1476
|
// Injects launch and url acts into a report where necessary to undo DOM changes.
|
|
@@ -10,8 +10,8 @@ const fs = require('fs/promises');
|
|
|
10
10
|
// Override cycle environment variables with validation-specific ones.
|
|
11
11
|
process.env.PROTOCOL = 'http';
|
|
12
12
|
const jobDir = `${__dirname}/../jobs`;
|
|
13
|
-
process.env.JOB_URL = 'localhost:3007/job';
|
|
14
|
-
process.env.REPORT_URL = 'localhost:3007/
|
|
13
|
+
process.env.JOB_URL = 'localhost:3007/api/job';
|
|
14
|
+
process.env.REPORT_URL = 'localhost:3007/api';
|
|
15
15
|
process.env.AGENT = 'testarauth';
|
|
16
16
|
const {cycle} = require(`${__dirname}/../../watch`);
|
|
17
17
|
const client = require(process.env.PROTOCOL);
|
|
@@ -45,7 +45,7 @@ const requestHandler = (request, response) => {
|
|
|
45
45
|
if (method === 'GET') {
|
|
46
46
|
// If a job is validly requested:
|
|
47
47
|
console.log('Server got a job request from Testaro');
|
|
48
|
-
if (requestURL ===
|
|
48
|
+
if (requestURL === `/api/job?agent=${process.env.AGENT}`) {
|
|
49
49
|
// If at least 7 seconds has elapsed since timing started:
|
|
50
50
|
if (Date.now() > startTime + 7000) {
|
|
51
51
|
// Respond with a job.
|
|
@@ -73,14 +73,20 @@ const requestHandler = (request, response) => {
|
|
|
73
73
|
console.log('Server got report from Testaro');
|
|
74
74
|
const ack = {};
|
|
75
75
|
// If a report is validly submitted:
|
|
76
|
-
if (requestURL === '/api
|
|
76
|
+
if (requestURL === '/api') {
|
|
77
77
|
// If a job was earlier given to Testaro:
|
|
78
78
|
if (jobGiven) {
|
|
79
79
|
// Respond, reporting success or failure.
|
|
80
80
|
try {
|
|
81
81
|
const bodyJSON = bodyParts.join('');
|
|
82
82
|
const body = JSON.parse(bodyJSON);
|
|
83
|
-
if (
|
|
83
|
+
if (
|
|
84
|
+
body.job
|
|
85
|
+
&& body.acts
|
|
86
|
+
&& body.jobData
|
|
87
|
+
&& body.agent
|
|
88
|
+
&& body.agent === process.env.AGENT
|
|
89
|
+
) {
|
|
84
90
|
ack.result = 'Success: Valid report submitted';
|
|
85
91
|
}
|
|
86
92
|
else {
|
package/watch.js
CHANGED
|
@@ -118,14 +118,16 @@ const writeNetReport = async report => {
|
|
|
118
118
|
chunks.push(chunk);
|
|
119
119
|
});
|
|
120
120
|
response.on('end', () => {
|
|
121
|
+
const content = chunks.join('');
|
|
121
122
|
try {
|
|
122
|
-
resolve(JSON.parse(
|
|
123
|
+
resolve(JSON.parse(content));
|
|
123
124
|
}
|
|
124
125
|
catch(error) {
|
|
125
126
|
resolve({
|
|
126
127
|
error: 'ERROR: Response was not JSON',
|
|
127
128
|
message: error.message,
|
|
128
|
-
status: response.statusCode
|
|
129
|
+
status: response.statusCode,
|
|
130
|
+
content: content.slice(0, 200)
|
|
129
131
|
});
|
|
130
132
|
}
|
|
131
133
|
});
|