Add and reuse utility function for adding test assets to library
- Allows test body to focus on code being tested - Ensures consistency in adding assets to library - Exposes how Fennec part differs from others due to renaming behavior
This commit is contained in:
parent
f674f389ba
commit
9a91ddf219
2 changed files with 54 additions and 131 deletions
|
|
@ -18,25 +18,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
await MatterControlUtilities.RunTest((testRunner) =>
|
||||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
string itemName = "Row Item Fennec Fox";
|
||||
|
||||
// Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
Assert.IsFalse(testRunner.WaitForName(itemName, 1), "Fennec Fox should not exist at test start");
|
||||
|
||||
// Click Local Library Add Button
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
|
||||
// Get Library Item to Add
|
||||
testRunner.Delay(2);
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"));
|
||||
testRunner.Delay(1);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
Assert.IsTrue(testRunner.WaitForName(itemName, 2));
|
||||
testRunner.AddTestAssetsToLibrary("Batman.stl");
|
||||
|
||||
return Task.FromResult(0);
|
||||
});
|
||||
|
|
@ -48,30 +30,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
await MatterControlUtilities.RunTest((testRunner) =>
|
||||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
// Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
// Make sure both Items do not exist before the test begins
|
||||
Assert.IsFalse(testRunner.WaitForName("Row Item Fennec Fox", 1), "Fennec Fox part should not exist at test start");
|
||||
Assert.IsFalse(testRunner.WaitForName("Row Item Batman", 1), "Batman part should not exist at test start");
|
||||
|
||||
// Click Local Library Add Button
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
|
||||
testRunner.Delay(2);
|
||||
|
||||
// Type file paths for each file into File Open dialog
|
||||
testRunner.Type(string.Format("\"{0}\" \"{1}\"",
|
||||
MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"),
|
||||
MatterControlUtilities.GetTestItemPath("Batman.stl")));
|
||||
|
||||
testRunner.Delay(1);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Fennec Fox", 2), "Fennec Fox part should exist after adding");
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Batman", 2), "Batman part should exist after adding");
|
||||
testRunner.AddTestAssetsToLibrary("Rook.amf", "Batman.stl");
|
||||
|
||||
return Task.FromResult(0);
|
||||
});
|
||||
|
|
@ -83,22 +42,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
await MatterControlUtilities.RunTest((testRunner) =>
|
||||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
// Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
// Make sure that Item does not exist before the test begins
|
||||
Assert.IsFalse(testRunner.WaitForName("Row Item Rook", 1), "Rook part should not exist at test start");
|
||||
|
||||
// Add Library item
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.Delay(2);
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Rook.amf"));
|
||||
testRunner.Delay(1);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Rook", 2), "Rook part should exist after adding");
|
||||
testRunner.AddTestAssetsToLibrary("Rook.amf");
|
||||
|
||||
return Task.FromResult(0);
|
||||
}, overrideWidth: 1024, overrideHeight: 800);
|
||||
|
|
@ -140,16 +84,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
// Navigate To Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
// Add Library item
|
||||
testRunner.ClickByName("Library Add Button", 5);
|
||||
testRunner.Delay(2);
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Rook.amf"));
|
||||
testRunner.Delay(1);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.AddTestAssetsToLibrary("Rook.amf");
|
||||
|
||||
testRunner.ClickByName("Row Item Rook", 2);
|
||||
|
||||
|
|
@ -177,6 +112,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
await MatterControlUtilities.RunTest((testRunner) =>
|
||||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
// Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.Delay(.2);
|
||||
|
|
@ -221,24 +157,14 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
// Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
// Add Library item
|
||||
testRunner.ClickByName("Library Add Button", 5);
|
||||
testRunner.Delay(2);
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Rook.amf"));
|
||||
testRunner.Delay(1);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.AddTestAssetsToLibrary("Rook.amf");
|
||||
|
||||
// Select and remove item
|
||||
testRunner.ClickByName("Row Item Rook", 5);
|
||||
testRunner.ClickByName("Row Item Rook");
|
||||
MatterControlUtilities.LibraryRemoveSelectedItem(testRunner);
|
||||
testRunner.Delay(1);
|
||||
|
||||
// Make sure that Export Item Window exists after Export button is clicked
|
||||
Assert.IsFalse(testRunner.WaitForName("Row Item Rook", 1));
|
||||
// Make sure that the item has been removed
|
||||
Assert.IsFalse(testRunner.WaitForName("Row Item Rook"));
|
||||
|
||||
return Task.FromResult(0);
|
||||
});
|
||||
|
|
@ -251,27 +177,10 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
// Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
|
||||
testRunner.Delay(2);
|
||||
|
||||
// Type file paths for each file into File Open dialog
|
||||
testRunner.Type(string.Format("\"{0}\" \"{1}\"",
|
||||
MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"),
|
||||
MatterControlUtilities.GetTestItemPath("Batman.stl")));
|
||||
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
// Make sure row items exist before remove
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Batman", 6), "Batman part should exist after add");
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Fennec Fox", 2), "Fennec part should exist after add");
|
||||
testRunner.AddTestAssetsToLibrary("Rook.amf", "Batman.stl");
|
||||
|
||||
// Select both items
|
||||
testRunner.ClickByName("Row Item Fennec Fox", 1);
|
||||
testRunner.ClickByName("Row Item Rook", 1);
|
||||
Keyboard.SetKeyDownState(Keys.ControlKey, down: true);
|
||||
testRunner.ClickByName("Row Item Batman", 1);
|
||||
Keyboard.SetKeyDownState(Keys.ControlKey, down: false);
|
||||
|
|
@ -281,8 +190,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
testRunner.Delay(1);
|
||||
|
||||
// Make sure both selected items are removed
|
||||
Assert.IsFalse(testRunner.WaitForName("Row Item Batman", 1), "Batman part should *not* exist after remove");
|
||||
Assert.IsFalse(testRunner.WaitForName("Row Item Fennec Fox", 1), "Fennec part *not* exist after remove");
|
||||
Assert.IsFalse(testRunner.WaitForName("Row Item Rook", 1), "Rook part should *not* exist after remove");
|
||||
Assert.IsFalse(testRunner.WaitForName("Row Item Batman", 1), "Batman part *not* exist after remove");
|
||||
|
||||
return Task.FromResult(0);
|
||||
});
|
||||
|
|
@ -297,16 +206,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
// Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
// Add Library item
|
||||
testRunner.ClickByName("Library Add Button", 5);
|
||||
testRunner.Delay(2);
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Rook.amf"));
|
||||
testRunner.Delay(1);
|
||||
testRunner.Type("{Enter}");
|
||||
testRunner.AddTestAssetsToLibrary("Rook.amf");
|
||||
|
||||
// Select Library Item
|
||||
testRunner.ClickByName("Row Item Rook");
|
||||
|
|
@ -338,23 +238,10 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
// Navigate to Local Library
|
||||
testRunner.ClickByName("Library Tab");
|
||||
testRunner.NavigateToFolder("Local Library Row Item Collection");
|
||||
|
||||
// Add an item to the library
|
||||
testRunner.ClickByName("Library Add Button");
|
||||
testRunner.Delay(2);
|
||||
|
||||
// Type file paths for each file into File Open dialog
|
||||
testRunner.Type(string.Format("\"{0}\" \"{1}\"",
|
||||
MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"),
|
||||
MatterControlUtilities.GetTestItemPath("Batman.stl")));
|
||||
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
testRunner.AddTestAssetsToLibrary("Rook.amf", "Batman.stl");
|
||||
|
||||
// Select both items
|
||||
testRunner.ClickByName("Row Item Fennec Fox", 5);
|
||||
testRunner.ClickByName("Row Item Rook", 5);
|
||||
Keyboard.SetKeyDownState(Keys.ControlKey, down: true);
|
||||
testRunner.ClickByName("Row Item Batman", 1);
|
||||
Keyboard.SetKeyDownState(Keys.ControlKey, down: false);
|
||||
|
|
@ -374,7 +261,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
testRunner.NavigateToFolder("Print Queue Row Item Collection");
|
||||
|
||||
// Make sure that the items exist in the PrintQueueContainer
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Fennec Fox", 5), "Fennec item should exist in the Queue after Add");
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Rook", 5), "Rook item should exist in the Queue after Add");
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Batman", 5), "Batman item should exist in the Queue after Add");
|
||||
|
||||
return Task.FromResult(0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue