Skip to content

Commit

Permalink
Merge pull request #669 from WHOIGit/automated_tests
Browse files Browse the repository at this point in the history
Part Type Test Modifications
  • Loading branch information
ethanandrews authored Jul 18, 2024
2 parents 3dd0ac8 + d9ffa12 commit bfd4c8a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
32 changes: 12 additions & 20 deletions tests/AddEditParts.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ var password;
}

await driver.findElement(By.id("id_field_default_value")).sendKeys("Teledyne RDI");
await driver.findElement(By.id("id_global_for_part_types_4")).click(); //instruments
await driver.findElement(By.id("id_global_for_part_types_2")).click(); //instrument
await driver.findElement(By.css(".btn-primary")).click();

while ((await driver.findElements(By.linkText("Add Custom Field"))).length == 0) {
Expand All @@ -133,7 +133,7 @@ var password;
}

await driver.findElement(By.id("id_field_default_value")).sendKeys("WHLS75-1500");
await driver.findElement(By.id("id_global_for_part_types_4")).click(); //instruments
await driver.findElement(By.id("id_global_for_part_types_2")).click(); //instrument
await driver.findElement(By.css(".btn-primary")).click();

// Add Computerized Part Type
Expand Down Expand Up @@ -344,30 +344,22 @@ var password;
}

// Add & Set the Manufacturer and Model for ADCPS-J
/* The following code is deleted because the Manufacturer and Model are now set
on Instrument Part creation
while ((await driver.findElements(By.linkText("Add New Field"))).length == 0) {
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for Add New Field.");
}
await driver.findElement(By.linkText("Add New Field")).click();
await new Promise(r => setTimeout(r, 2000));
// Find Manufacturer and Model row to select
var i = 1;
while (true) {
if ((await driver.findElement(By.xpath("//div[@id='div_id_user_defined_fields']/div/div[" + i + "]/label")).getText()) == "Manufacturer") {
break;
}
i++;
}
var j = 1;
while (true) {
if ((await driver.findElement(By.xpath("//div[@id='div_id_user_defined_fields']/div/div[" + j + "]/label")).getText()) == "Model") {
break;
}
j++;
while ((await driver.findElements(By.id("id_user_defined_fields_0"))).length == 0) {
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for User Defined Fields.");
}
await driver.findElement(By.id("id_user_defined_fields_" + i)).click();
await driver.findElement(By.id("id_user_defined_fields_" + j)).click();
await driver.findElement(By.css(".controls > .btn-primary")).click();
await driver.findElement(By.id("id_user_defined_fields_0")).click(); //manufacturer
await driver.findElement(By.id("id_user_defined_fields_1")).click(); //model
await new Promise(r => setTimeout(r, 2000));
await driver.findElement(By.css(".controls > .btn-primary")).click(); */

while ((await driver.findElements(By.partialLinkText("Manufacturer"))).length == 0) {
await new Promise(r => setTimeout(r, 2000));
console.log("Wait 2 seconds for Manufacturer.");
Expand Down
2 changes: 1 addition & 1 deletion tests/ImportExportInventory.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ var password;
}

await driver.findElement(By.id("id_field_default_value")).sendKeys("20004");
await driver.findElement(By.id("id_global_for_part_types_6")).click(); //Structural
await driver.findElement(By.id("id_global_for_part_types_5")).click(); //Structural
await driver.findElement(By.css(".btn-primary")).click();

// Import and create new Inventory Item - non CI
Expand Down

0 comments on commit bfd4c8a

Please sign in to comment.