testaro 12.2.6 → 12.2.7

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 (3) hide show
  1. package/package.json +1 -1
  2. package/tests/ibm.js +13 -4
  3. package/watch.js +4 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "12.2.6",
3
+ "version": "12.2.7",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/tests/ibm.js CHANGED
@@ -120,11 +120,20 @@ const doTest = async (content, withItems, timeLimit, rules) => {
120
120
  };
121
121
  // Returns results of one or two IBM tests.
122
122
  exports.reporter = async (page, withItems, withNewContent, rules) => {
123
+ let contentType = 'both';
124
+ if (withNewContent) {
125
+ contentType = 'new';
126
+ }
127
+ else if (withNewContent === false) {
128
+ contentType = 'existing';
129
+ }
130
+ console.log(`>>>>>> Content type: ${contentType}`);
123
131
  // If a test with existing content is to be performed:
124
132
  const result = {};
125
- if (! withNewContent) {
126
- const timeLimit = 20;
133
+ const timeLimit = 20;
134
+ if (['existing', 'both'].includes(contentType)) {
127
135
  try {
136
+ console.log('>>>>>> With existing content');
128
137
  const typeContent = await page.content();
129
138
  result.content = await doTest(typeContent, withItems, timeLimit, rules);
130
139
  if (result.content.prevented) {
@@ -138,9 +147,9 @@ exports.reporter = async (page, withItems, withNewContent, rules) => {
138
147
  }
139
148
  }
140
149
  // If a test with new content is to be performed:
141
- if ([true, undefined].includes(withNewContent)) {
142
- const timeLimit = 20;
150
+ if (['new', 'both'].includes(contentType)) {
143
151
  try {
152
+ console.log('>>>>>> With new content');
144
153
  const typeContent = page.url();
145
154
  result.url = await doTest(typeContent, withItems, timeLimit, rules);
146
155
  if (result.url.prevented) {
package/watch.js CHANGED
@@ -92,7 +92,7 @@ const checkNetJob = async watchee => {
92
92
  console.log(job.message);
93
93
  }
94
94
  else {
95
- console.log(job);
95
+ console.log('No network job to do');
96
96
  }
97
97
  return job;
98
98
  };
@@ -138,7 +138,7 @@ const writeNetReport = async report => {
138
138
  error: 'ERROR: Response was not JSON',
139
139
  message: error.message,
140
140
  status: response.statusCode,
141
- content: content.slice(0, 200)
141
+ content: content.slice(0, 3000)
142
142
  });
143
143
  }
144
144
  });
@@ -152,7 +152,8 @@ const writeNetReport = async report => {
152
152
  });
153
153
  });
154
154
  // Send the report to the server.
155
- request.write(JSON.stringify(report, null, 2));
155
+ const reportJSON = JSON.stringify(report, null, 2);
156
+ request.write(reportJSON);
156
157
  request.end();
157
158
  console.log(`Report ${report.id} submitted`);
158
159
  }