testaro 2.2.1 → 2.2.2

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 CHANGED
@@ -1121,7 +1121,7 @@ const doBatch = async (options, reportTemplate, hostIndex = 0) => {
1121
1121
  const host = hosts[hostIndex];
1122
1122
  // If the specified host exists:
1123
1123
  if (host) {
1124
- // Copy the report for it.
1124
+ // Create a report for it.
1125
1125
  const hostReport = JSON.parse(JSON.stringify(reportTemplate));
1126
1126
  // Copy the properties of the specified host to all url acts.
1127
1127
  hostReport.acts.forEach(act => {
@@ -1132,6 +1132,18 @@ const doBatch = async (options, reportTemplate, hostIndex = 0) => {
1132
1132
  });
1133
1133
  // Perform the commands on the host.
1134
1134
  await doScript(options, hostReport);
1135
+ // Add the host’s ID to the host report.
1136
+ hostReport.hostName = host.id;
1137
+ // Add data from the template to the host report.
1138
+ hostReport.orderName = reportTemplate.id;
1139
+ hostReport.id = `${hostReport.orderName}-${host.id}`;
1140
+ hostReport.orderUserName = reportTemplate.userName;
1141
+ hostReport.orderTime = reportTemplate.orderTime;
1142
+ hostReport.scriptName = reportTemplate.scriptName;
1143
+ hostReport.batchName = reportTemplate.batchName;
1144
+ hostReport.scriptIsValid = reportTemplate.scriptIsValid;
1145
+ hostReport.batchIsValid = reportTemplate.batchIsValid;
1146
+ hostReport.host = host;
1135
1147
  // Process the remaining hosts.
1136
1148
  await doBatch(options, reportTemplate, hostIndex + 1);
1137
1149
  }
@@ -1210,6 +1222,7 @@ exports.handleRequest = async options => {
1210
1222
  }
1211
1223
  // Create a report template, containing a copy of the commands as its acts.
1212
1224
  const reportTemplate = {
1225
+ host: '',
1213
1226
  acts: JSON.parse(JSON.stringify(options.script.commands))
1214
1227
  };
1215
1228
  // Inject url acts where necessary to undo DOM changes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -4,6 +4,10 @@
4
4
  const fs = require('fs').promises;
5
5
  const {handleRequest} = require(`${__dirname}/../../index`);
6
6
  const validateTests = async () => {
7
+ const totals = {
8
+ attempts: 0,
9
+ successes: 0
10
+ };
7
11
  const scriptFileNames = await fs.readdir(`${__dirname}/../tests/scripts`);
8
12
  for (const scriptFileName of scriptFileNames) {
9
13
  const rawScriptJSON = await fs
@@ -33,21 +37,28 @@ const validateTests = async () => {
33
37
  : true
34
38
  )
35
39
  ) {
40
+ totals.attempts++;
41
+ totals.successes++;
36
42
  console.log('Success: Reports have been correctly populated');
37
43
  if (reports[0].acts.every(
38
44
  act => act.type === 'test' ? act.result.failureCount === 0 : true
39
45
  )) {
46
+ totals.attempts++;
47
+ totals.successes++;
40
48
  console.log('Success: No failures');
41
49
  }
42
50
  else {
51
+ totals.attempts++;
43
52
  console.log('Failure: At least one test has at least one failure');
44
53
  console.log(JSON.stringify(reports, null, 2));
45
54
  }
46
55
  }
47
56
  else {
57
+ totals.attempts++;
48
58
  console.log('Failure: Reports empty or invalid');
49
59
  console.log(JSON.stringify(reports, null, 2));
50
60
  }
51
61
  }
62
+ console.log(`Grand totals: attempts ${totals.attempts}, successes ${totals.successes}`);
52
63
  };
53
64
  validateTests();