testaro 32.0.11 → 32.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 CHANGED
@@ -1,25 +1,3 @@
1
- /*
2
- © 2021–2023 CVS Health and/or one of its affiliates. All rights reserved.
3
-
4
- Permission is hereby granted, free of charge, to any person obtaining a copy
5
- of this software and associated documentation files (the "Software"), to deal
6
- in the Software without restriction, including without limitation the rights
7
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the Software is
9
- furnished to do so, subject to the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be included in all
12
- copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- SOFTWARE.
21
- */
22
-
23
1
  # testaro
24
2
 
25
3
  Ensemble testing for web accessibility
@@ -775,12 +753,13 @@ The Testilo package contains functions that can create jobs from scripts and add
775
753
  ##### By a user
776
754
 
777
755
  ```bash
756
+ node call run
778
757
  node call run be76p
779
758
  ```
780
759
 
781
- In this example, `be76p` is the initial characters of the ID of a job saved as a JSON file in the `todo` subdirectory of the `process.env.JOBDIR` directory.
760
+ In the second example, `be76p` is the initial characters of the ID of a job saved as a JSON file in the `todo` subdirectory of the `process.env.JOBDIR` directory.
782
761
 
783
- The `call` module will find the first job file with a matching name, execute the `doJob` function of the `run` module on the job, save the report in the `raw` subdirectory of the `process.env.REPORTDIR` directory, and archive the job file in the `done` subdirectory of the `process.env.JOBDIR` directory.
762
+ The `call` module will find the first job file with a matching name if an argument is given, or the first job file if not. Then the module will execute the `doJob` function of the `run` module on the job, save the report in the `raw` subdirectory of the `process.env.REPORTDIR` directory, and archive the job file in the `done` subdirectory of the `process.env.JOBDIR` directory.
784
763
 
785
764
  #### Watch
786
765
 
@@ -952,3 +931,25 @@ Work on the custom tests in this package began in 2017, and work on the multi-pa
952
931
  ## Etymology
953
932
 
954
933
  “Testaro” means “collection of tests” in Esperanto.
934
+
935
+ /*
936
+ © 2021–2023 CVS Health and/or one of its affiliates. All rights reserved.
937
+
938
+ Permission is hereby granted, free of charge, to any person obtaining a copy
939
+ of this software and associated documentation files (the "Software"), to deal
940
+ in the Software without restriction, including without limitation the rights
941
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
942
+ copies of the Software, and to permit persons to whom the Software is
943
+ furnished to do so, subject to the following conditions:
944
+
945
+ The above copyright notice and this permission notice shall be included in all
946
+ copies or substantial portions of the Software.
947
+
948
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
949
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
950
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
951
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
952
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
953
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
954
+ SOFTWARE.
955
+ */
package/call.js CHANGED
@@ -58,7 +58,9 @@ const rawDir = `${reportDir}/raw`;
58
58
  const callRun = async jobIDStart => {
59
59
  // Find the job.
60
60
  const jobDirFileNames = await fs.readdir(todoDir);
61
- const jobFileName = jobDirFileNames.find(fileName => fileName.startsWith(jobIDStart));
61
+ const jobFileName = jobIDStart
62
+ ? jobDirFileNames.find(fileName => fileName.startsWith(jobIDStart))
63
+ : jobDirFileNames[0];
62
64
  // If it exists:
63
65
  if (jobFileName) {
64
66
  // Get it.
@@ -90,8 +92,8 @@ const callNetWatch = async(isForever, interval) => {
90
92
  // OPERATION
91
93
 
92
94
  // Execute the requested function.
93
- if (fn === 'run' && fnArgs.length === 1) {
94
- callRun(fnArgs)
95
+ if (fn === 'run' && fnArgs.length < 2) {
96
+ callRun(fnArgs[0])
95
97
  .then(() => {
96
98
  console.log('Execution completed\n');
97
99
  process.exit(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "32.0.11",
3
+ "version": "32.2.0",
4
4
  "description": "Run 960 web accessibility tests from 9 tools and get a standardized report",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -245,14 +245,18 @@ exports.reporter = async (page, withItems) => {
245
245
  h5: [3, 'Level-5 headings', 'H5'],
246
246
  h6: [3, 'Level-6 headings', 'H6'],
247
247
  };
248
+ // For each eligible element type:
248
249
  Object.keys(elementData).forEach(elementName => {
250
+ // If it has more than 1 style:
249
251
  const elementTotal = data.totals[elementName];
250
252
  if (elementTotal && elementTotal.subtotals) {
251
253
  const currentData = elementData[elementName];
252
254
  const severity = currentData[0];
253
255
  const elementSubtotals = elementTotal.subtotals;
256
+ // Treat the count of its styles in excess of 1 as the instance count for that element type.
254
257
  const extraCount = elementSubtotals.length - 1;
255
258
  totals[severity] += extraCount;
259
+ // Add a summary standard instance for that element type.
256
260
  standardInstances.push({
257
261
  ruleID: 'styleDiff',
258
262
  what: `${currentData[1]} have ${elementSubtotals.length} different styles`,
package/tests/ibm.js CHANGED
@@ -144,9 +144,9 @@ const doTest = async (content, withItems, timeLimit, rules) => {
144
144
  const actReport = runReport && runReport.report;
145
145
  // Delete any report files.
146
146
  try {
147
- const reportNames = await fs.readdir('results');
147
+ const reportNames = await fs.readdir('ibmOutput');
148
148
  for (const reportName of reportNames) {
149
- await fs.rm(`results/${reportName}`);
149
+ await fs.rm(`ibmOutput/${reportName}`);
150
150
  }
151
151
  }
152
152
  catch(error) {
package/tests/wave.js CHANGED
@@ -50,7 +50,7 @@ exports.reporter = async (page, options) => {
50
50
  try {
51
51
  // Delete unnecessary properties.
52
52
  const actResult = JSON.parse(actReport);
53
- const {categories} = actResult;
53
+ const {categories, statistics} = actResult;
54
54
  delete categories.feature;
55
55
  delete categories.structure;
56
56
  delete categories.aria;
@@ -83,6 +83,16 @@ exports.reporter = async (page, options) => {
83
83
  items[issueName].wcag = guidelines;
84
84
  });
85
85
  });
86
+ // Add important data to the result.
87
+ if (statistics) {
88
+ data.pageTitle = statistics.pagetitle || '';
89
+ data.pageURL = statistics.pageurl || '';
90
+ data.time = statistics.time || null;
91
+ data.creditsRemaining = statistics.creditsremaining || null;
92
+ data.allItemCount = statistics.allitemcount || null;
93
+ data.totalElements = statistics.totalelements || null;
94
+ }
95
+ // Return the result.
86
96
  return resolve(actResult);
87
97
  }
88
98
  catch (error) {