testaro 8.1.13 → 8.1.14

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": "8.1.13",
3
+ "version": "8.1.14",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,8 +10,8 @@ const fs = require('fs/promises');
10
10
  // Override cycle environment variables with validation-specific ones.
11
11
  process.env.PROTOCOL = 'http';
12
12
  const jobDir = `${__dirname}/../jobs`;
13
- process.env.JOB_URL = 'localhost:3007/job';
14
- process.env.REPORT_URL = 'localhost:3007/report';
13
+ process.env.JOB_URL = 'localhost:3007/api/job';
14
+ process.env.REPORT_URL = 'localhost:3007/api';
15
15
  process.env.AGENT = 'testarauth';
16
16
  const {cycle} = require(`${__dirname}/../../watch`);
17
17
  const client = require(process.env.PROTOCOL);
@@ -45,7 +45,7 @@ const requestHandler = (request, response) => {
45
45
  if (method === 'GET') {
46
46
  // If a job is validly requested:
47
47
  console.log('Server got a job request from Testaro');
48
- if (requestURL === '/job?agent=testarauth') {
48
+ if (requestURL === `/api/job?agent=${process.env.AGENT}`) {
49
49
  // If at least 7 seconds has elapsed since timing started:
50
50
  if (Date.now() > startTime + 7000) {
51
51
  // Respond with a job.
@@ -73,14 +73,20 @@ const requestHandler = (request, response) => {
73
73
  console.log('Server got report from Testaro');
74
74
  const ack = {};
75
75
  // If a report is validly submitted:
76
- if (requestURL === '/api?agent=testarauth') {
76
+ if (requestURL === '/api') {
77
77
  // If a job was earlier given to Testaro:
78
78
  if (jobGiven) {
79
79
  // Respond, reporting success or failure.
80
80
  try {
81
81
  const bodyJSON = bodyParts.join('');
82
82
  const body = JSON.parse(bodyJSON);
83
- if (body.job && body.acts && body.jobData) {
83
+ if (
84
+ body.job
85
+ && body.acts
86
+ && body.jobData
87
+ && body.agent
88
+ && body.agent === process.env.AGENT
89
+ ) {
84
90
  ack.result = 'Success: Valid report submitted';
85
91
  }
86
92
  else {