2016-09-21 15:34:53 -07:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Threading;
|
2015-11-13 11:57:19 -08:00
|
|
|
|
using MatterHackers.GuiAutomation;
|
|
|
|
|
|
using MatterHackers.MatterControl.PrintQueue;
|
2016-05-11 09:13:56 -07:00
|
|
|
|
using NUnit.Framework;
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-05-11 09:13:56 -07:00
|
|
|
|
namespace MatterHackers.MatterControl.Tests.Automation
|
2015-11-13 11:57:19 -08:00
|
|
|
|
{
|
2016-05-11 09:13:56 -07:00
|
|
|
|
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
2016-10-20 16:31:37 -07:00
|
|
|
|
public class LocalLibraryTests
|
2015-11-13 11:57:19 -08:00
|
|
|
|
{
|
2016-10-20 16:31:37 -07:00
|
|
|
|
[Test, Apartment(ApartmentState.STA)]
|
2015-11-13 11:57:19 -08:00
|
|
|
|
public void LocalLibraryAddButtonAddSingleItemToLibrary()
|
|
|
|
|
|
{
|
2016-10-07 13:49:01 -07:00
|
|
|
|
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
|
2015-11-13 11:57:19 -08:00
|
|
|
|
{
|
2016-10-19 11:10:30 -07:00
|
|
|
|
MatterControlUtilities.PrepForTestRun(testRunner);
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
string itemName = "Row Item " + "Fennec Fox";
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Navigate to Local Library
|
|
|
|
|
|
testRunner.ClickByName("Library Tab");
|
|
|
|
|
|
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Make sure that Item does not exist before the test begins
|
|
|
|
|
|
bool rowItemExists = testRunner.WaitForName(itemName, 1);
|
|
|
|
|
|
testRunner.AddTestResult(rowItemExists == false);
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Click Local Library Add Button
|
|
|
|
|
|
testRunner.ClickByName("Library Add Button");
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Get Library Item to Add
|
|
|
|
|
|
string rowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
|
|
|
|
|
|
testRunner.Wait(2);
|
|
|
|
|
|
testRunner.Type(rowItemPath);
|
|
|
|
|
|
testRunner.Wait(1);
|
|
|
|
|
|
testRunner.Type("{Enter}");
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
bool rowItemWasAdded = testRunner.WaitForName(itemName, 2);
|
|
|
|
|
|
testRunner.AddTestResult(rowItemWasAdded == true);
|
2015-11-13 11:57:19 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
2016-10-19 11:49:52 -07:00
|
|
|
|
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun);
|
2016-09-19 17:13:00 -07:00
|
|
|
|
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
2015-11-13 11:57:19 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-10-20 16:31:37 -07:00
|
|
|
|
[Test, Apartment(ApartmentState.STA)]
|
2015-11-13 11:57:19 -08:00
|
|
|
|
public void LocalLibraryAddButtonAddsMultipleItemsToLibrary()
|
|
|
|
|
|
{
|
2016-10-07 13:49:01 -07:00
|
|
|
|
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
|
2015-11-13 11:57:19 -08:00
|
|
|
|
{
|
2016-10-19 11:10:30 -07:00
|
|
|
|
MatterControlUtilities.PrepForTestRun(testRunner);
|
|
|
|
|
|
//Names of Items to be added
|
|
|
|
|
|
string firstItemName = "Row Item " + "Fennec Fox";
|
|
|
|
|
|
string secondItemName = "Row Item " + "Batman";
|
|
|
|
|
|
|
|
|
|
|
|
//Navigate to Local Library
|
|
|
|
|
|
testRunner.ClickByName("Library Tab");
|
|
|
|
|
|
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
|
|
|
|
|
|
|
|
|
|
|
//Make sure both Items do not exist before the test begins
|
|
|
|
|
|
bool firstItemExists = testRunner.WaitForName(firstItemName, 1);
|
|
|
|
|
|
bool secondItemExists = testRunner.WaitForName(secondItemName, 1);
|
|
|
|
|
|
testRunner.AddTestResult(firstItemExists == false);
|
|
|
|
|
|
testRunner.AddTestResult(secondItemExists == false);
|
|
|
|
|
|
|
|
|
|
|
|
//Click Local Library Add Button
|
|
|
|
|
|
testRunner.ClickByName("Library Add Button");
|
|
|
|
|
|
|
|
|
|
|
|
//Get Library Item to Add
|
|
|
|
|
|
string firstRowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
|
|
|
|
|
|
string secondRowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl");
|
|
|
|
|
|
|
|
|
|
|
|
string textForBothRowItems = string.Format("\"{0}\" \"{1}\"", firstRowItemPath, secondRowItemPath);
|
|
|
|
|
|
testRunner.Wait(2);
|
|
|
|
|
|
testRunner.Type(textForBothRowItems);
|
|
|
|
|
|
testRunner.Wait(1);
|
|
|
|
|
|
testRunner.Type("{Enter}");
|
|
|
|
|
|
|
|
|
|
|
|
bool firstRowItemWasAdded = testRunner.WaitForName(firstItemName, 2);
|
|
|
|
|
|
bool secondRowItemWasAdded = testRunner.WaitForName(secondItemName, 2);
|
|
|
|
|
|
testRunner.AddTestResult(firstRowItemWasAdded == true);
|
|
|
|
|
|
testRunner.AddTestResult(secondRowItemWasAdded == true);
|
2015-11-13 11:57:19 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
2016-10-19 11:49:52 -07:00
|
|
|
|
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun);
|
2016-09-19 17:13:00 -07:00
|
|
|
|
Assert.IsTrue(testHarness.AllTestsPassed(4));
|
2015-11-13 11:57:19 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-10-20 16:31:37 -07:00
|
|
|
|
[Test, Apartment(ApartmentState.STA)]
|
2015-11-13 11:57:19 -08:00
|
|
|
|
public void LocalLibraryAddButtonAddAMFToLibrary()
|
|
|
|
|
|
{
|
2016-10-07 13:49:01 -07:00
|
|
|
|
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
|
2015-11-13 11:57:19 -08:00
|
|
|
|
{
|
2016-10-19 11:10:30 -07:00
|
|
|
|
MatterControlUtilities.PrepForTestRun(testRunner);
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
string itemName = "Row Item " + "Rook";
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Navigate to Local Library
|
|
|
|
|
|
testRunner.ClickByName("Library Tab");
|
|
|
|
|
|
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Make sure that Item does not exist before the test begins
|
|
|
|
|
|
bool rowItemExists = testRunner.WaitForName(itemName, 1);
|
|
|
|
|
|
testRunner.AddTestResult(rowItemExists == false);
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Click Local Library Add Button
|
|
|
|
|
|
testRunner.ClickByName("Library Add Button");
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Get Library Item to Add
|
|
|
|
|
|
string rowItemPath = MatterControlUtilities.GetTestItemPath("Rook.amf");
|
|
|
|
|
|
testRunner.Wait(2);
|
|
|
|
|
|
testRunner.Type(rowItemPath);
|
|
|
|
|
|
testRunner.Wait(1);
|
|
|
|
|
|
testRunner.Type("{Enter}");
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
bool rowItemWasAdded = testRunner.WaitForName(itemName, 2);
|
|
|
|
|
|
testRunner.AddTestResult(rowItemWasAdded == true);
|
2015-11-13 11:57:19 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
2016-10-19 11:49:52 -07:00
|
|
|
|
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 1024, overrideHeight: 800);
|
2016-09-19 17:13:00 -07:00
|
|
|
|
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
2015-11-13 11:57:19 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-10-20 16:31:37 -07:00
|
|
|
|
[Test, Apartment(ApartmentState.STA)]
|
2015-11-13 11:57:19 -08:00
|
|
|
|
public void LocalLibraryAddButtonAddZipToLibrary()
|
|
|
|
|
|
{
|
2016-10-07 13:49:01 -07:00
|
|
|
|
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
|
2015-11-13 11:57:19 -08:00
|
|
|
|
{
|
2016-10-19 11:10:30 -07:00
|
|
|
|
MatterControlUtilities.PrepForTestRun(testRunner);
|
|
|
|
|
|
|
|
|
|
|
|
//Items in Batman.zip
|
|
|
|
|
|
string firstItemName = "Row Item " + "Batman";
|
|
|
|
|
|
string secondItemName = "Row Item " + "2013-01-25 Mouthpiece v2";
|
|
|
|
|
|
|
|
|
|
|
|
//Navigate to Local Library
|
|
|
|
|
|
testRunner.ClickByName("Library Tab");
|
|
|
|
|
|
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
|
|
|
|
|
|
|
|
|
|
|
//Make sure that Item does not exist before the test begins
|
|
|
|
|
|
bool firstItemInZipExists = testRunner.WaitForName(firstItemName, 1);
|
|
|
|
|
|
bool secondItemInZipExists = testRunner.WaitForName(secondItemName, 1);
|
|
|
|
|
|
testRunner.AddTestResult(firstItemInZipExists == false);
|
|
|
|
|
|
testRunner.AddTestResult(firstItemInZipExists == false);
|
|
|
|
|
|
|
|
|
|
|
|
//Click Local Library Add Button
|
|
|
|
|
|
testRunner.ClickByName("Library Add Button");
|
|
|
|
|
|
|
|
|
|
|
|
//Get Library Item to Add
|
|
|
|
|
|
string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.zip");
|
|
|
|
|
|
testRunner.Wait(2);
|
|
|
|
|
|
testRunner.Type(rowItemPath);
|
|
|
|
|
|
testRunner.Wait(1);
|
|
|
|
|
|
testRunner.Type("{Enter}");
|
|
|
|
|
|
|
|
|
|
|
|
bool firstItemInZipWasAdded = testRunner.WaitForName(firstItemName, 2);
|
|
|
|
|
|
bool secondItemInZipWasAdded = testRunner.WaitForName(secondItemName, 2);
|
|
|
|
|
|
testRunner.AddTestResult(firstItemInZipWasAdded == true);
|
|
|
|
|
|
testRunner.AddTestResult(secondItemInZipWasAdded == true);
|
2015-11-13 11:57:19 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
2016-10-19 11:49:52 -07:00
|
|
|
|
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun);
|
2016-09-19 17:13:00 -07:00
|
|
|
|
Assert.IsTrue(testHarness.AllTestsPassed(4));
|
2015-11-13 11:57:19 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-10-20 16:31:37 -07:00
|
|
|
|
[Test, Apartment(ApartmentState.STA)]
|
2015-11-13 11:57:19 -08:00
|
|
|
|
public void RenameButtonRenameLocalLibraryItem()
|
|
|
|
|
|
{
|
2016-10-07 13:49:01 -07:00
|
|
|
|
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
|
2015-11-13 11:57:19 -08:00
|
|
|
|
{
|
2016-10-19 11:10:30 -07:00
|
|
|
|
MatterControlUtilities.PrepForTestRun(testRunner);
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Navigate To Local Library
|
|
|
|
|
|
testRunner.ClickByName("Library Tab");
|
|
|
|
|
|
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Wait(1);
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
string rowItemToRename = "Row Item " + "Calibration - Box";
|
|
|
|
|
|
testRunner.ClickByName("Library Edit Button");
|
|
|
|
|
|
testRunner.Wait(1);
|
|
|
|
|
|
testRunner.ClickByName(rowItemToRename);
|
|
|
|
|
|
MatterControlUtilities.LibraryRenameSelectedItem(testRunner);
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Wait(2);
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Type("Library Item Renamed");
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.ClickByName("Rename Button");
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
string renamedRowItem = "Row Item " + "Library Item Renamed";
|
|
|
|
|
|
bool libraryItemWasRenamed = testRunner.WaitForName(renamedRowItem, 2);
|
|
|
|
|
|
bool libraryItemBeforeRenameExists = testRunner.WaitForName(rowItemToRename, 2);
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.AddTestResult(libraryItemWasRenamed == true);
|
|
|
|
|
|
testRunner.AddTestResult(libraryItemBeforeRenameExists == false);
|
2015-11-13 11:57:19 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
2016-10-19 11:49:52 -07:00
|
|
|
|
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 600);
|
2016-09-19 17:13:00 -07:00
|
|
|
|
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
2015-11-13 11:57:19 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-10-20 16:31:37 -07:00
|
|
|
|
[Test, Apartment(ApartmentState.STA)]
|
2016-09-13 11:12:13 -07:00
|
|
|
|
public void RenameButtonRenameLocalLibraryFolder()
|
2015-11-13 11:57:19 -08:00
|
|
|
|
{
|
2016-10-07 13:49:01 -07:00
|
|
|
|
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
|
2015-11-13 11:57:19 -08:00
|
|
|
|
{
|
2016-10-19 11:10:30 -07:00
|
|
|
|
MatterControlUtilities.PrepForTestRun(testRunner);
|
|
|
|
|
|
//Navigate to Local Library
|
|
|
|
|
|
testRunner.ClickByName("Library Tab");
|
|
|
|
|
|
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
|
|
|
|
|
|
|
|
|
|
|
//Create New Folder
|
|
|
|
|
|
testRunner.ClickByName("Create Folder From Library Button");
|
|
|
|
|
|
testRunner.Wait(.5);
|
|
|
|
|
|
testRunner.Type("New Folder");
|
|
|
|
|
|
testRunner.Wait(.5);
|
|
|
|
|
|
testRunner.ClickByName("Create Folder Button");
|
|
|
|
|
|
|
|
|
|
|
|
//Check for Created Folder
|
|
|
|
|
|
string newLibraryFolder = "New Folder Row Item Collection";
|
|
|
|
|
|
bool newFolderWasCreated = testRunner.WaitForName(newLibraryFolder, 1);
|
|
|
|
|
|
testRunner.AddTestResult(newFolderWasCreated == true);
|
|
|
|
|
|
|
|
|
|
|
|
testRunner.ClickByName("Library Edit Button");
|
|
|
|
|
|
testRunner.ClickByName("New Folder Row Item Collection");
|
|
|
|
|
|
MatterControlUtilities.LibraryRenameSelectedItem(testRunner);
|
|
|
|
|
|
testRunner.Wait(.5);
|
|
|
|
|
|
testRunner.Type("Renamed Library Folder");
|
|
|
|
|
|
testRunner.ClickByName("Rename Button");
|
|
|
|
|
|
|
|
|
|
|
|
//Make sure that renamed Library Folder Exists
|
|
|
|
|
|
bool renamedLibraryFolderExists = testRunner.WaitForName("Renamed Library Folder Row Item Collection", 2);
|
|
|
|
|
|
testRunner.AddTestResult(renamedLibraryFolderExists == true);
|
2015-11-13 18:06:44 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
2016-10-19 11:49:52 -07:00
|
|
|
|
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun);
|
2016-09-19 17:13:00 -07:00
|
|
|
|
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
2015-11-13 18:06:44 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-10-20 16:31:37 -07:00
|
|
|
|
[Test, Apartment(ApartmentState.STA)]
|
2015-11-13 18:06:44 -08:00
|
|
|
|
public void ClickLibraryEditButtonOpensPartPreviewWindow()
|
|
|
|
|
|
{
|
2016-10-07 13:49:01 -07:00
|
|
|
|
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
|
2015-11-13 18:06:44 -08:00
|
|
|
|
{
|
2016-10-19 11:10:30 -07:00
|
|
|
|
MatterControlUtilities.PrepForTestRun(testRunner);
|
|
|
|
|
|
//Navigate to Local Library
|
|
|
|
|
|
testRunner.ClickByName("Library Tab");
|
|
|
|
|
|
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Wait(1);
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
string rowItem = "Row Item " + "Calibration - Box";
|
|
|
|
|
|
testRunner.ClickByName("Library Edit Button");
|
|
|
|
|
|
testRunner.Wait(1);
|
|
|
|
|
|
testRunner.ClickByName(rowItem);
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
MatterControlUtilities.LibraryEditSelectedItem(testRunner);
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Make sure that Export Item Window exists after Export button is clicked
|
|
|
|
|
|
bool exportItemWindowExists = testRunner.WaitForName("Part Preview Window", 2);
|
|
|
|
|
|
testRunner.AddTestResult(exportItemWindowExists == true);
|
2015-11-13 18:06:44 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
2016-10-19 11:49:52 -07:00
|
|
|
|
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun);
|
2016-09-19 17:13:00 -07:00
|
|
|
|
Assert.IsTrue(testHarness.AllTestsPassed(1));
|
2015-11-13 18:06:44 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-10-20 16:31:37 -07:00
|
|
|
|
[Test, Apartment(ApartmentState.STA)]
|
2015-11-13 18:06:44 -08:00
|
|
|
|
public void RemoveButtonClickedRemovesSingleItem()
|
|
|
|
|
|
{
|
2016-10-07 13:49:01 -07:00
|
|
|
|
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
|
2015-11-13 18:06:44 -08:00
|
|
|
|
{
|
2016-10-19 11:10:30 -07:00
|
|
|
|
MatterControlUtilities.PrepForTestRun(testRunner);
|
|
|
|
|
|
//Navigate to Local Library
|
|
|
|
|
|
testRunner.ClickByName("Library Tab");
|
|
|
|
|
|
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Wait(1);
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
string rowItem = "Row Item " + "Calibration - Box";
|
|
|
|
|
|
testRunner.ClickByName("Library Edit Button");
|
|
|
|
|
|
testRunner.Wait(1);
|
|
|
|
|
|
testRunner.ClickByName(rowItem);
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
MatterControlUtilities.LibraryRemoveSelectedItem(testRunner);
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Wait(1);
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Make sure that Export Item Window exists after Export button is clicked
|
|
|
|
|
|
bool rowItemExists = testRunner.WaitForName(rowItem, 1);
|
|
|
|
|
|
testRunner.AddTestResult(rowItemExists == false);
|
2015-11-13 11:57:19 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
2016-10-19 11:49:52 -07:00
|
|
|
|
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun);
|
2016-09-19 17:13:00 -07:00
|
|
|
|
Assert.IsTrue(testHarness.AllTestsPassed(1));
|
2015-11-13 11:57:19 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-10-20 16:31:37 -07:00
|
|
|
|
[Test, Apartment(ApartmentState.STA)]
|
2015-11-13 18:06:44 -08:00
|
|
|
|
public void RemoveButtonClickedRemovesMultipleItems()
|
|
|
|
|
|
{
|
2016-10-07 13:49:01 -07:00
|
|
|
|
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
|
2015-11-13 18:06:44 -08:00
|
|
|
|
{
|
2016-10-19 11:10:30 -07:00
|
|
|
|
MatterControlUtilities.PrepForTestRun(testRunner);
|
|
|
|
|
|
//Navigate to Local Library
|
|
|
|
|
|
testRunner.ClickByName("Library Tab");
|
|
|
|
|
|
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Wait(1);
|
|
|
|
|
|
testRunner.ClickByName("Library Edit Button");
|
|
|
|
|
|
testRunner.Wait(1);
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
string rowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
|
|
|
|
|
|
testRunner.ClickByName("Library Add Button");
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Wait(2);
|
|
|
|
|
|
testRunner.Type(rowItemPath);
|
|
|
|
|
|
testRunner.Type("{Enter}");
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Wait(1);
|
|
|
|
|
|
string rowItemOne = "Row Item " + "Calibration - Box";
|
|
|
|
|
|
testRunner.ClickByName(rowItemOne, 1);
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
string rowItemTwo = "Row Item " + "Fennec Fox";
|
|
|
|
|
|
testRunner.ClickByName(rowItemTwo, 1);
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Wait(1);
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Make sure row items exist before remove
|
|
|
|
|
|
bool rowItemOneExistsBeforeRemove = testRunner.WaitForName(rowItemOne, 2);
|
|
|
|
|
|
bool rowItemTwoExistsBeforeRemove = testRunner.WaitForName(rowItemTwo, 2);
|
|
|
|
|
|
testRunner.AddTestResult(rowItemOneExistsBeforeRemove == true);
|
|
|
|
|
|
testRunner.AddTestResult(rowItemTwoExistsBeforeRemove == true);
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
MatterControlUtilities.LibraryRemoveSelectedItem(testRunner);
|
|
|
|
|
|
testRunner.Wait(1);
|
2015-11-13 18:06:44 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Make sure both selected items are removed
|
|
|
|
|
|
bool rowItemOneExists = testRunner.WaitForName(rowItemOne, 2);
|
|
|
|
|
|
bool rowItemTwoExists = testRunner.WaitForName(rowItemTwo, 2);
|
|
|
|
|
|
testRunner.AddTestResult(rowItemOneExists == false);
|
|
|
|
|
|
testRunner.AddTestResult(rowItemTwoExists == false);
|
2015-11-13 18:06:44 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
2016-10-19 11:49:52 -07:00
|
|
|
|
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun);
|
2016-09-19 17:13:00 -07:00
|
|
|
|
Assert.IsTrue(testHarness.AllTestsPassed(4));
|
2015-11-13 18:06:44 -08:00
|
|
|
|
}
|
2015-11-13 11:57:19 -08:00
|
|
|
|
|
2016-10-20 16:31:37 -07:00
|
|
|
|
[Test, Apartment(ApartmentState.STA)]
|
2015-11-18 15:28:50 -08:00
|
|
|
|
public void AddToQueueFromLibraryButtonAddsItemToQueue()
|
|
|
|
|
|
{
|
2016-10-07 13:49:01 -07:00
|
|
|
|
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
|
2015-11-18 15:28:50 -08:00
|
|
|
|
{
|
2016-10-19 11:10:30 -07:00
|
|
|
|
MatterControlUtilities.PrepForTestRun(testRunner);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Navigate to Local Library
|
|
|
|
|
|
testRunner.ClickByName("Library Tab");
|
|
|
|
|
|
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
2016-09-19 17:13:00 -07:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Wait(1);
|
|
|
|
|
|
testRunner.ClickByName("Library Edit Button");
|
|
|
|
|
|
testRunner.Wait(1);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Select Library Item
|
|
|
|
|
|
string rowItemOne = "Row Item " + "Calibration - Box";
|
|
|
|
|
|
testRunner.ClickByName(rowItemOne);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Wait(1);
|
2016-09-06 15:31:41 -07:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
int queueCountBeforeAdd = QueueData.Instance.Count;
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Add Library Item to the Print Queue
|
|
|
|
|
|
MatterControlUtilities.LibraryAddSelectionToQueue(testRunner);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Wait(2);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Make sure that the Queue Count increases by one
|
|
|
|
|
|
int queueCountAfterAdd = QueueData.Instance.Count;
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.AddTestResult(queueCountAfterAdd == queueCountBeforeAdd + 1);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Navigate to Queue
|
|
|
|
|
|
testRunner.ClickByName("Queue Tab");
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Wait(1);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Make sure that the Print Item was added
|
|
|
|
|
|
string queueItem = "Queue Item " + "Calibration - Box";
|
|
|
|
|
|
bool queueItemWasAdded = testRunner.WaitForName(queueItem, 2);
|
|
|
|
|
|
testRunner.AddTestResult(queueItemWasAdded == true);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
2016-10-19 11:49:52 -07:00
|
|
|
|
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun);
|
2016-09-19 17:13:00 -07:00
|
|
|
|
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
2015-11-18 15:28:50 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-10-20 16:31:37 -07:00
|
|
|
|
[Test, Apartment(ApartmentState.STA)]
|
2015-11-18 15:28:50 -08:00
|
|
|
|
public void AddToQueueFromLibraryButtonAddsItemsToQueue()
|
|
|
|
|
|
{
|
2016-10-07 13:49:01 -07:00
|
|
|
|
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
|
2015-11-18 15:28:50 -08:00
|
|
|
|
{
|
2016-10-19 11:10:30 -07:00
|
|
|
|
MatterControlUtilities.PrepForTestRun(testRunner);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Navigate to Local Library
|
|
|
|
|
|
testRunner.ClickByName("Library Tab");
|
|
|
|
|
|
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Add an item to the library
|
|
|
|
|
|
string libraryItemToAdd = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
|
|
|
|
|
|
testRunner.ClickByName("Library Add Button");
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Wait(2);
|
|
|
|
|
|
testRunner.Type(libraryItemToAdd);
|
|
|
|
|
|
testRunner.Wait(2);
|
|
|
|
|
|
testRunner.Type("{Enter}");
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Wait(1);
|
|
|
|
|
|
testRunner.ClickByName("Library Edit Button");
|
|
|
|
|
|
testRunner.Wait(1);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
int queueCountBeforeAdd = QueueData.Instance.Count;
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Select both Library Items
|
|
|
|
|
|
string rowItemOne = "Row Item " + "Calibration - Box";
|
|
|
|
|
|
testRunner.ClickByName(rowItemOne);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
string rowItemTwo = "Row Item " + "Fennec Fox";
|
|
|
|
|
|
testRunner.ClickByName(rowItemTwo);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Click the Add To Queue button
|
|
|
|
|
|
testRunner.Wait(1);
|
|
|
|
|
|
MatterControlUtilities.LibraryAddSelectionToQueue(testRunner);
|
|
|
|
|
|
testRunner.Wait(2);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Make sure Queue Count increases by the correct amount
|
|
|
|
|
|
int queueCountAfterAdd = QueueData.Instance.Count;
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.AddTestResult(queueCountAfterAdd == queueCountBeforeAdd + 2);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Navigate to the Print Queue
|
|
|
|
|
|
testRunner.ClickByName("Queue Tab");
|
|
|
|
|
|
testRunner.Wait(1);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Test that both added print items exist
|
|
|
|
|
|
string queueItemOne = "Queue Item " + "Calibration - Box";
|
|
|
|
|
|
string queueItemTwo = "Queue Item " + "Fennec_Fox";
|
|
|
|
|
|
bool queueItemOneWasAdded = testRunner.WaitForName(queueItemOne, 2);
|
|
|
|
|
|
bool queueItemTwoWasAdded = testRunner.WaitForName(queueItemTwo, 2);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.AddTestResult(queueItemOneWasAdded == true);
|
|
|
|
|
|
testRunner.AddTestResult(queueItemTwoWasAdded == true);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
2016-10-19 11:49:52 -07:00
|
|
|
|
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun);
|
2016-09-19 17:13:00 -07:00
|
|
|
|
Assert.IsTrue(testHarness.AllTestsPassed(3));
|
2015-11-18 15:28:50 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-10-20 16:31:37 -07:00
|
|
|
|
[Test, Apartment(ApartmentState.STA)]
|
2015-11-18 15:28:50 -08:00
|
|
|
|
public void LibraryItemThumbnailClickedOpensPartPreview()
|
|
|
|
|
|
{
|
2016-10-07 13:49:01 -07:00
|
|
|
|
Action<AutomationRunner> testToRun = (AutomationRunner testRunner) =>
|
2015-11-18 15:28:50 -08:00
|
|
|
|
{
|
2016-10-19 11:10:30 -07:00
|
|
|
|
MatterControlUtilities.PrepForTestRun(testRunner);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Navigate to Local Library
|
|
|
|
|
|
testRunner.ClickByName("Library Tab");
|
|
|
|
|
|
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Make sure Part Preview Window does not exists before we click the view button
|
|
|
|
|
|
bool partPreviewExistsOne = testRunner.WaitForName("Part Preview Window", 1);
|
|
|
|
|
|
testRunner.AddTestResult(partPreviewExistsOne == false);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
string libraryRowItemName = "Row Item " + "Calibration - Box";
|
|
|
|
|
|
testRunner.ClickByName(libraryRowItemName);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Wait(1);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Click Library Item View Button
|
|
|
|
|
|
string libraryItemViewButton = "Row Item " + "Calibration - Box" + " View Button";
|
|
|
|
|
|
testRunner.ClickByName(libraryItemViewButton);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Make sure that Part Preview Window opens after View button is clicked
|
|
|
|
|
|
bool partPreviewWindowExists = testRunner.WaitForName("Part Preview Window", 1.5);
|
|
|
|
|
|
testRunner.AddTestResult(partPreviewWindowExists == true);
|
2015-11-18 15:28:50 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
2016-10-19 11:49:52 -07:00
|
|
|
|
AutomationRunner testHarness = MatterControlUtilities.RunTest(testToRun);
|
2016-09-19 17:13:00 -07:00
|
|
|
|
Assert.IsTrue(testHarness.AllTestsPassed(2));
|
2015-11-18 15:28:50 -08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2015-11-13 11:57:19 -08:00
|
|
|
|
}
|