Skip to content

Commit

Permalink
Merge pull request #673 from WHOIGit/automated_tests
Browse files Browse the repository at this point in the history
API use 0.0.0.0 instead localhost
  • Loading branch information
ethanandrews authored Jul 25, 2024
2 parents 82dd640 + df3f094 commit 43a8548
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions tests/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ var token;
const { JSDOM } = jsdom;
// Required to prevent Error: Cross origin null forbidden thrown by JSDOM
const { window } = new JSDOM('', {
url: "http://localhost:8000",
referrer: "http://localhost:8000",
url: "http://0.0.0.0:8000",
referrer: "http://0.0.0.0:8000",
contentType: "text/html",
userAgent: "node.js",
includeNodeLocations: true
});

var $ = require('jquery')(window);

const url = 'http://localhost:8000/api/v1/';
const url = 'http://0.0.0.0:8000/api/v1/';

// Login and get Api Token
await $.post(url + 'api-token-auth/', { "username": "admin", "password": "admin" }, function (data) {
Expand Down
10 changes: 6 additions & 4 deletions tests/AddBuilds.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,11 @@ var password;

var ele = await driver.findElement(By.xpath("//input[@id='id_date']"));
var dateString = await ele.getAttribute("value");
// Recovery screen date format is 01/05/2021 03:06, trim leading zeroes and time
dateString = dateString.replace(/\b0/g, '');
dateString = dateString.split(" ")[0];
// Recovery screen date format is 01/05/2021
var d = new Date(dateString);
var day = parseInt(d.getDate(), 10);
var month = d.getMonth() + 1;
var newDate = month.toString().trim() + "/" + day.toString().trim() + "/" + d.getFullYear();
await driver.findElement(By.css(".controls > .btn-primary")).click();

// Verify Total Time in Field and Current Deployment Time in Field: 0 days 0 hours
Expand Down Expand Up @@ -529,7 +531,7 @@ var password;

// Deployment to Field Date
try {
assert(bodyText.includes(dateString));
assert(bodyText.includes(newDate));
}
catch (AssertionError) {
console.log("Possible Error: Expecting Inventory Deployment (1 Day Prior) To Field Date: " + dateString);
Expand Down
3 changes: 2 additions & 1 deletion tests/UploadCsv.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ var filename, filename_ext;
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for File Download.");
}
await new Promise(r => setTimeout(r, 20000)); //wait for file write to finish
console.log("Wait 4 minutes for File Write.");
await new Promise(r => setTimeout(r, 240000)); //wait for file write to finish

// Compare Uploaded & Exported Cruise files
// read a line from upload file and find it in exported buffer to verify Cruise was created properly
Expand Down

0 comments on commit 43a8548

Please sign in to comment.