Skip to content

Commit

Permalink
Download directory changes
Browse files Browse the repository at this point in the history
  • Loading branch information
joannekoch committed Oct 28, 2024
1 parent 99216f1 commit ca89aaf
Show file tree
Hide file tree
Showing 14 changed files with 242 additions and 199 deletions.
1 change: 1 addition & 0 deletions tests/AddBuilds.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ var password;
await driver.findElement(By.id("id_login")).sendKeys(user);
await driver.findElement(By.id("id_password")).sendKeys(password);
await driver.findElement(By.css(".primaryAction")).click();
await new Promise(r => setTimeout(r, 2000));

// ADD BUILDS TEST

Expand Down
23 changes: 5 additions & 18 deletions tests/AddEditInventory.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ var password;
await driver.findElement(By.id("id_login")).sendKeys(user);
await driver.findElement(By.id("id_password")).sendKeys(password);
await driver.findElement(By.css(".primaryAction")).click();
await new Promise(r => setTimeout(r, 2000));

// ADD INVENTORY TEST

Expand Down Expand Up @@ -284,12 +285,7 @@ var password;
}
await driver.findElement(By.id("field-query_c_r0")).sendKeys("Test");
await driver.findElement(By.id("searchform-submit-button")).click();

while ((await driver.findElements(By.css(".even a"))).length == 0)
{
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for Search1.");
}
await new Promise(r => setTimeout(r, 2000));
await driver.findElement(By.css(".even a")).click();

while ((await driver.findElements(By.id("action"))).length == 0) {
Expand Down Expand Up @@ -338,15 +334,11 @@ var password;
await driver.findElement(By.id("field-query_c_r0")).sendKeys("Test");
await driver.findElement(By.css("#qcard_c > .card-body")).click();
await driver.findElement(By.id("searchform-submit-button")).click();
await new Promise(r => setTimeout(r, 2000));
await driver.findElement(By.id("searchbar-query")).click(); //search within these results
await driver.findElement(By.id("searchbar-query")).sendKeys("Coastal Mooring");
await driver.findElement(By.css(".btn-outline-primary:nth-child(1)")).click();

while ((await driver.findElements(By.css(".even a"))).length == 0)
{
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for Search3.");
}
await new Promise(r => setTimeout(r, 2000));
await driver.findElement(By.css(".even a")).click();

// Add subassembly item to valid parent
Expand Down Expand Up @@ -402,12 +394,7 @@ var password;
await driver.findElement(By.id("field-query_c_r1")).sendKeys("Wifi");
await driver.findElement(By.id("searchform-submit-button")).click();

// await new Promise(r => setTimeout(r, 8000));
while ((await driver.findElements(By.css(".even a"))).length == 0)
{
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for Search5.");
}
await new Promise(r => setTimeout(r, 2000));
await driver.findElement(By.css(".even a")).click();

while ((await driver.findElements(By.id("action"))).length == 0) {
Expand Down
14 changes: 10 additions & 4 deletions tests/AddEditParts.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ var password;
if ((await driver.findElements(By.css("#djHideToolBarButton"))).length != 0) {
await driver.findElement(By.css("#djHideToolBarButton")).click();
}
await new Promise(r => setTimeout(r, 2000));

try {

Expand All @@ -82,6 +83,7 @@ var password;
await driver.findElement(By.id("id_login")).sendKeys(user);
await driver.findElement(By.id("id_password")).sendKeys(password);
await driver.findElement(By.css(".primaryAction")).click();
await new Promise(r => setTimeout(r, 2000));

// ADD PARTS TEST

Expand Down Expand Up @@ -134,7 +136,8 @@ var password;

await driver.findElement(By.id("id_field_default_value")).sendKeys("WHLS75-1500");
await driver.findElement(By.id("id_global_for_part_types_2")).click(); //instrument
await driver.findElement(By.css(".btn-primary")).click();
await driver.findElement(By.css(".btn-primary")).click();
await new Promise(r => setTimeout(r, 2000));

// Add Computerized Part Type
await driver.findElement(By.id("navbarAdmintools")).click();
Expand All @@ -154,6 +157,7 @@ var password;
await new Promise(r => setTimeout(r, 2000));
await driver.findElement(By.linkText("Add Part Type")).click();
await driver.findElement(By.css(".btn-primary")).click();
await driver.wait(until.elementLocated(By.id("error_1_id_name")));
assert(await driver.findElement(By.id("error_1_id_name")).getText() == "This field is required.");
await driver.findElement(By.css(".btn-light")).click();

Expand Down Expand Up @@ -426,6 +430,7 @@ var password;
await driver.findElement(By.id("id_name")).clear();
await driver.findElement(By.id("id_name")).sendKeys(" ");
await driver.findElement(By.css(".btn-primary")).click();
await driver.wait(until.elementLocated(By.id("error_1_id_name")));
assert(await driver.findElement(By.id("error_1_id_name")).getText() == "This field is required.");

// Change part type parent
Expand Down Expand Up @@ -458,14 +463,15 @@ var password;
dropdown = await driver.findElement(By.id("id_parent"));
await dropdown.findElement(By.xpath("//option[. = '---------']")).click();
await driver.findElement(By.css(".btn-primary")).click();
await new Promise(r => setTimeout(r, 2000));

// Search for Part Templates and change Part Number
await driver.findElement(By.id("searchbar-query")).sendKeys("Coastal Mooring");
await driver.findElement(By.css(".btn-outline-primary:nth-child(1)")).click(); // 22 | click | linkText=123-456-789 |
await driver.findElement(By.css(".btn-outline-primary:nth-child(1)")).click();
await new Promise(r => setTimeout(r, 2000));
await driver.findElement(By.linkText("123-456-789")).click();

// await new Promise(r => setTimeout(r, 20000)); // 1.6
while ((await driver.findElements(By.id("action"))).length == 0) // 1.6
while ((await driver.findElements(By.id("action"))).length == 0)
{
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for Search1.");
Expand Down
14 changes: 10 additions & 4 deletions tests/AdminUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,16 @@ var password;
await driver.findElement(By.id("id_login")).sendKeys("tech")
await driver.findElement(By.id("id_password")).sendKeys("tech")
await driver.findElement(By.css(".primaryAction")).click()
await new Promise(r => setTimeout(r, 2000));
// Verify "Account Inactive"
var bodyText = await driver.findElement(By.css('body')).getText();
assert(bodyText.includes("Account Inactive"));

await driver.findElement(By.id("log-in-link")).click()
await driver.findElement(By.id("id_login")).sendKeys("inv")
await driver.findElement(By.id("id_password")).sendKeys("inv")
await driver.findElement(By.css(".primaryAction")).click()
await driver.findElement(By.id("id_login")).sendKeys("inv");
await driver.findElement(By.id("id_password")).sendKeys("inv");
await driver.findElement(By.css(".primaryAction")).click();
await new Promise(r => setTimeout(r, 2000));
// Verify "Account Inactive"
bodyText = await driver.findElement(By.css('body')).getText();
assert(bodyText.includes("Account Inactive"));
Expand All @@ -176,6 +178,7 @@ var password;
await driver.findElement(By.id("id_login")).sendKeys("admin")
await driver.findElement(By.id("id_password")).sendKeys("admin")
await driver.findElement(By.css(".primaryAction")).click()
await new Promise(r => setTimeout(r, 2000));

// Activate users and try to login
await driver.findElement(By.linkText("Users")).click()
Expand Down Expand Up @@ -207,7 +210,8 @@ var password;
// Modify My Info
await driver.findElement(By.linkText("My Info")).click()
await driver.findElement(By.id("id_name")).sendKeys("best technician")
await driver.findElement(By.css(".btn-primary")).click()
await driver.findElement(By.css(".btn-primary")).click()
await new Promise(r => setTimeout(r, 2000));
// Verify my info changed
bodyText = await driver.findElement(By.css('body')).getText();
assert(bodyText.includes("best technician"));
Expand All @@ -216,6 +220,7 @@ var password;
await driver.findElement(By.linkText("E-Mail")).click()
await driver.findElement(By.id("id_email")).sendKeys("tech@example.com")
await driver.findElement(By.name("action_add")).click()
await new Promise(r => setTimeout(r, 2000));
// Verify screen text contains tech@example.com
bodyText = await driver.findElement(By.css('body')).getText();
assert(bodyText.includes("tech@example.com"));
Expand All @@ -227,6 +232,7 @@ var password;
await driver.findElement(By.id("id_password1")).sendKeys("tech1234")
await driver.findElement(By.id("id_password2")).sendKeys("tech1234")
await driver.findElement(By.name("action")).click()
await new Promise(r => setTimeout(r, 2000));
await driver.findElement(By.linkText("Sign Out")).click()
await driver.findElement(By.css(".btn-danger")).click()

Expand Down
24 changes: 7 additions & 17 deletions tests/CalibrationsCoefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ var password;
await driver.findElement(By.id("id_login")).sendKeys(user);
await driver.findElement(By.id("id_password")).sendKeys(password);
await driver.findElement(By.css(".primaryAction")).click();
await new Promise(r => setTimeout(r, 2000));

// CALIBRATIONS AND COEFFICIENTS TEST

Expand Down Expand Up @@ -298,10 +299,7 @@ var password;
await driver.findElement(By.id("searchbar-query")).sendKeys("buoy");
await driver.findElement(By.id("searchbar-modelselect")).sendKeys("Part Templates");
await driver.findElement(By.css(".btn-outline-primary:nth-child(1)")).click();
while ((await driver.findElements(By.partialLinkText("555"))).length == 0) {
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for Search.");
}
await new Promise(r => setTimeout(r, 2000));
await driver.findElement(By.partialLinkText("555")).click();
while ((await driver.findElements(By.linkText("Create Calibrations"))).length == 0) {
await new Promise(r => setTimeout(r, 2000));
Expand Down Expand Up @@ -352,20 +350,15 @@ var password;
await dropdown.findElement(By.xpath("//option[. = 'Exact']")).click()
}
await driver.findElement(By.id("searchform-submit-button")).click()
while ((await driver.findElements(By.partialLinkText("1232"))).length == 0) {
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for Search.");
}
await new Promise(r => setTimeout(r, 2000));

await driver.findElement(By.partialLinkText("1232")).click();
while ((await driver.findElements(By.id("calibration-template-tab"))).length == 0) {
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for Tab3.");
}
await driver.findElement(By.id("calibration-template-tab")).click()
while ((await driver.findElements(By.css("#calibration-template .collapsed > .fa"))).length == 0) {
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for Link.");
}
await new Promise(r => setTimeout(r, 2000));
await driver.findElement(By.css("#calibration-template .collapsed > .fa")).click()
await new Promise(r => setTimeout(r, 4000));
// Verify values added in the History
Expand Down Expand Up @@ -410,11 +403,8 @@ var password;
console.log("Wait 2 seconds for Calibrations link.");
}
await driver.findElement(By.linkText("Calibrations")).click();
while ((await driver.findElements(By.linkText("scalib1"))).length == 0) {
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for Calibrations detail.");
}

await new Promise(r => setTimeout(r, 2000));

// Verify min and max coef values
var scalib1_min = await driver.findElement(By.xpath("//td[3]")).getText();
var scalib1_max = await driver.findElement(By.xpath("//td[4]")).getText();
Expand Down
2 changes: 1 addition & 1 deletion tests/Cleanup-Docker.bat
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ node DeleteLocations.js chrome headless admin

node DeleteUser.js chrome headless admin

node DeleteAllCruises.js chrome headless admin
#node DeleteAllCruises.js chrome headless admin

exit 0
1 change: 1 addition & 0 deletions tests/ConstantsConfigs.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ var password;
console.log("Wait 2 seconds for Approved.");
}
await driver.findElement(By.partialLinkText("1232"));
await new Promise(r => setTimeout(r, 2000));

//Approved Flag
{
Expand Down
6 changes: 5 additions & 1 deletion tests/DeleteAssemblies.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@ var password;
await driver.findElement(By.id("id_login")).sendKeys(user);
await driver.findElement(By.id("id_password")).sendKeys(password);
await driver.findElement(By.css(".primaryAction")).click();
await new Promise(r => setTimeout(r, 2000));

// DELETE ASSEMBLIES TEST

// Searches for and deletes the Assemblies added during the Add and Update Assemblies Test
while ((await driver.findElements(By.id("searchbar-query"))).length == 0) // 1.6
while ((await driver.findElements(By.id("searchbar-query"))).length == 0)
{
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for Search.");
Expand Down Expand Up @@ -224,6 +225,7 @@ var password;
await driver.findElement(By.id("navbarTemplates")).click();
await driver.findElement(By.id("navbarAdmintools")).click();
await driver.findElement(By.linkText("Edit Assembly Types")).click();
await new Promise(r => setTimeout(r, 2000));

if ((await driver.findElements(By.xpath("//tr[*]/td[text()='Electric']"))).length != 0) {
var i = 1;
Expand All @@ -234,7 +236,9 @@ var password;
i++;
}
await driver.findElement(By.css("tr:nth-child(" + i + ") .btn-danger")).click();
await new Promise(r => setTimeout(r, 2000));
await driver.findElement(By.css(".btn-danger")).click();
await new Promise(r => setTimeout(r, 2000));
}
else
console.log("Delete Assemblies failed: Electric type not found");
Expand Down
51 changes: 20 additions & 31 deletions tests/DeleteCruise.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ var password;
await driver.findElement(By.id("id_login")).sendKeys(user);
await driver.findElement(By.id("id_password")).sendKeys(password);
await driver.findElement(By.css(".primaryAction")).click();
await new Promise(r => setTimeout(r, 2000));

// DELETE CRUISE/VESSEL TEST

Expand All @@ -100,19 +101,16 @@ var password;
await driver.findElement(By.linkText("Edit Vessel List")).click()
await new Promise(r => setTimeout(r, 2000));

// Delete all Vessels
//while ((await driver.findElements(By.css(".list-group-item:nth-child(" + 1 + ") .fa"))).length != 0) {
// Just delete 1 vessel - takes too long to delete all vessel
if ((await driver.findElements(By.css(".list-group-item:nth-child(" + 1 + ") .fa"))).length != 0) {
await driver.findElement(By.css(".list-group-item:nth-child(" + 1 + ") .fa")).click();
await driver.findElement(By.linkText("Delete")).click();
while ((await driver.findElements(By.css(".btn-danger"))).length == 0) {
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for Confirm.");
}
await driver.findElement(By.css(".btn-danger")).click(); // confirm
// Delete Maui Princess vessel
await driver.findElement(By.partialLinkText("Maui Princess")).click();
await new Promise(r => setTimeout(r, 2000));
await driver.findElement(By.linkText("Delete")).click();
while ((await driver.findElements(By.css(".btn-danger"))).length == 0) {
await new Promise(r => setTimeout(r, 2000));
}
console.log("Wait 2 seconds for Confirm.");
}
await driver.findElement(By.css(".btn-danger")).click(); // confirm
await new Promise(r => setTimeout(r, 2000));

console.log("Vessel Deleted.");

Expand All @@ -124,25 +122,16 @@ var password;
await driver.findElement(By.linkText("Cruises")).click()
await new Promise(r => setTimeout(r, 4000));

// Just delete 1 cruise - takes too long to delete all cruises
//while ((await driver.findElements(By.xpath("//li/ul/li/a"))).length != 0) {
if ((await driver.findElements(By.xpath("//li/ul/li/a"))).length != 0) {
await driver.findElement(By.xpath("//li/ul/li/a")).click();

while ((await driver.findElements(By.linkText("Delete"))).length == 0) {
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for Delete Cruise.");
}
await driver.findElement(By.linkText("Delete")).click();

while ((await driver.findElements(By.css(".btn-danger"))).length == 0) {
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for Confirm.");
}
await driver.findElement(By.css(".btn-danger")).click();
await new Promise(r => setTimeout(r, 4000));
}
//}
// Delete MAUI cruise
await driver.findElement(By.partialLinkText("MAUI")).click();
await new Promise(r => setTimeout(r, 2000));
await driver.findElement(By.linkText("Delete")).click();
while ((await driver.findElements(By.css(".btn-danger"))).length == 0) {
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for Confirm.");
}
await driver.findElement(By.css(".btn-danger")).click();
await new Promise(r => setTimeout(r, 4000));

console.log("Cruise Deleted.");

Expand Down
1 change: 1 addition & 0 deletions tests/DeleteParts.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ var password;
}
await driver.findElement(By.css("tr:nth-child(" + i + ") .btn-danger")).click();
await driver.findElement(By.css(".btn-danger")).click();
await new Promise(r => setTimeout(r, 2000));
}
else
console.log("Delete Parts failed: Computerized type not found");
Expand Down
Loading

0 comments on commit ca89aaf

Please sign in to comment.