testaro 2.0.1 → 2.0.4

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.
Files changed (2) hide show
  1. package/index.js +15 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1069,9 +1069,12 @@ const doActs = async (report, actIndex, page) => {
1069
1069
  }
1070
1070
  };
1071
1071
  // Performs the commands in a script and returns a report.
1072
- const doScript = async report => {
1072
+ const doScript = async (options, report) => {
1073
1073
  // Reinitialize the log statistics.
1074
1074
  logCount = logSize = prohibitedCount = visitTimeoutCount = visitRejectionCount= 0;
1075
+ // Add the start time to the report.
1076
+ const startTime = new Date();
1077
+ report.startTime = startTime.toISOString().slice(0, 19);
1075
1078
  // Add initialized properties to the report.
1076
1079
  report.presses = 0;
1077
1080
  report.amountRead = 0;
@@ -1105,6 +1108,12 @@ const doScript = async report => {
1105
1108
  }
1106
1109
  }
1107
1110
  }
1111
+ // Add the end time and duration to the report.
1112
+ const endTime = new Date();
1113
+ report.endTime = endTime.toISOString().slice(0, 19);
1114
+ report.elapsedSeconds = Math.floor((endTime - startTime) / 1000);
1115
+ // Add the report to the reports array.
1116
+ options.reports.push(report);
1108
1117
  };
1109
1118
  // Recursively performs commands on the hosts of a batch.
1110
1119
  const doBatch = async (options, reportTemplate, hostIndex = 0) => {
@@ -1122,7 +1131,7 @@ const doBatch = async (options, reportTemplate, hostIndex = 0) => {
1122
1131
  }
1123
1132
  });
1124
1133
  // Perform the commands on the host.
1125
- await doScript(hostReport);
1134
+ await doScript(options, hostReport);
1126
1135
  // Process the remaining hosts.
1127
1136
  await doBatch(options, reportTemplate, hostIndex + 1);
1128
1137
  }
@@ -1132,12 +1141,14 @@ const doScriptOrBatch = async (options, reportTemplate) => {
1132
1141
  // If there is a batch:
1133
1142
  if (options.batch) {
1134
1143
  // Perform the script on all the hosts in the batch.
1144
+ console.log('Starting batch');
1135
1145
  await doBatch(options, reportTemplate);
1136
1146
  }
1137
1147
  // Otherwise, i.e. if there is no batch:
1138
1148
  else {
1139
1149
  // Perform the script.
1140
- await doScript(reportTemplate);
1150
+ console.log('Starting no-batch script');
1151
+ await doScript(options, reportTemplate);
1141
1152
  }
1142
1153
  // Add an end time to the log.
1143
1154
  options.log.push({
@@ -1187,7 +1198,7 @@ exports.handleRequest = async options => {
1187
1198
  },
1188
1199
  {
1189
1200
  event: 'timeStamp',
1190
- value: Math.floor((Date.now() - Date.UTC(2022, 3)) / 10000).toString(36)
1201
+ value: Math.floor((Date.now() - Date.UTC(2022, 1)) / 10000).toString(36)
1191
1202
  }
1192
1203
  );
1193
1204
  // Add the batch size to the log if there is a batch.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "2.0.1",
3
+ "version": "2.0.4",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {