testaro 12.2.4 → 12.2.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "12.2.4",
3
+ "version": "12.2.6",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/tests/ibm.js CHANGED
@@ -124,21 +124,33 @@ exports.reporter = async (page, withItems, withNewContent, rules) => {
124
124
  const result = {};
125
125
  if (! withNewContent) {
126
126
  const timeLimit = 20;
127
- const typeContent = await page.content();
128
- result.content = await doTest(typeContent, withItems, timeLimit, rules);
129
- if (result.content.prevented) {
127
+ try {
128
+ const typeContent = await page.content();
129
+ result.content = await doTest(typeContent, withItems, timeLimit, rules);
130
+ if (result.content.prevented) {
131
+ result.prevented = true;
132
+ console.log(`ERROR: Getting ibm test report from page timed out at ${timeLimit} seconds`);
133
+ }
134
+ }
135
+ catch(error) {
130
136
  result.prevented = true;
131
- console.log(`ERROR: Getting ibm test report from page timed out at ${timeLimit} seconds`);
137
+ console.log(`ERROR: ibm test on page crashed with error ${error.message.slice(0, 200)}`);
132
138
  }
133
139
  }
134
140
  // If a test with new content is to be performed:
135
141
  if ([true, undefined].includes(withNewContent)) {
136
142
  const timeLimit = 20;
137
- const typeContent = page.url();
138
- result.url = await doTest(typeContent, withItems, timeLimit, rules);
139
- if (result.url.prevented) {
143
+ try {
144
+ const typeContent = page.url();
145
+ result.url = await doTest(typeContent, withItems, timeLimit, rules);
146
+ if (result.url.prevented) {
147
+ result.prevented = true;
148
+ console.log(`ERROR: Getting ibm test report from URL timed out at ${timeLimit} seconds`);
149
+ }
150
+ }
151
+ catch(error) {
140
152
  result.prevented = true;
141
- console.log(`ERROR: Getting ibm test report from URL timed out at ${timeLimit} seconds`);
153
+ console.log(`ERROR: ibm test on URL crashed with error ${error.message.slice(0, 200)}`);
142
154
  }
143
155
  }
144
156
  // Return the result. Execution of close() crashed the Node process.
package/tests/qualWeb.js CHANGED
@@ -60,11 +60,15 @@ exports.reporter = async (page, withNewContent, rules = null) => {
60
60
  if (report && report.system && report.system.page && report.system.page.dom) {
61
61
  delete report.system.page.dom;
62
62
  // For each section of the report:
63
- ['act-rules', 'wcag-techniques', 'best-practices'].forEach(module => {
63
+ const sections = ['act-rules'];
64
+ if (! rules) {
65
+ sections.push('wcag-techniques', 'best-practices');
66
+ }
67
+ sections.forEach(section => {
64
68
  // For each test:
65
69
  const {modules} = report;
66
- if (modules && modules[module]) {
67
- const {assertions} = modules[module];
70
+ if (modules && modules[section]) {
71
+ const {assertions} = modules[section];
68
72
  if (assertions) {
69
73
  const ruleIDs = Object.keys(assertions);
70
74
  ruleIDs.forEach(ruleID => {
@@ -104,7 +108,7 @@ exports.reporter = async (page, withNewContent, rules = null) => {
104
108
  }
105
109
  else {
106
110
  report.prevented = true;
107
- report.error = `ERROR: No ${module} module`;
111
+ report.error = `ERROR: No ${section} section`;
108
112
  }
109
113
  });
110
114
  // Stop the QualWeb core engine.