2016-09-21 15:34:53 -07:00
using System ;
using System.Threading ;
2016-10-25 06:17:37 -07:00
using System.Threading.Tasks ;
2015-11-13 11:57:19 -08:00
using MatterHackers.GuiAutomation ;
2016-12-07 14:34:23 -08:00
using MatterHackers.MatterControl.PrinterCommunication ;
2015-11-13 11:57:19 -08:00
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)]
2016-10-25 06:17:37 -07:00
public async Task LocalLibraryAddButtonAddSingleItemToLibrary ( )
2015-11-13 11:57:19 -08:00
{
2016-10-25 06:17:37 -07:00
AutomationTest testToRun = ( testRunner ) = >
2015-11-13 11:57:19 -08:00
{
2016-10-26 08:35:51 -07:00
testRunner . CloseSignInAndPrinterSelect ( ) ;
2015-11-13 11:57:19 -08:00
2016-11-03 08:46:08 -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" ) ;
2016-10-26 06:49:50 -07:00
testRunner . NavigateToFolder ( "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 ) ;
2016-10-25 06:17:37 -07:00
Assert . IsTrue ( 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 ) ;
2016-10-25 06:17:37 -07:00
Assert . IsTrue ( rowItemWasAdded = = true ) ;
return Task . FromResult ( 0 ) ;
2015-11-13 11:57:19 -08:00
} ;
2016-10-25 06:17:37 -07:00
await MatterControlUtilities . RunTest ( testToRun ) ;
2015-11-13 11:57:19 -08:00
}
2016-10-20 16:31:37 -07:00
[Test, Apartment(ApartmentState.STA)]
2016-10-25 06:17:37 -07:00
public async Task LocalLibraryAddButtonAddsMultipleItemsToLibrary ( )
2015-11-13 11:57:19 -08:00
{
2016-10-25 06:17:37 -07:00
AutomationTest testToRun = ( testRunner ) = >
2015-11-13 11:57:19 -08:00
{
2016-10-26 08:35:51 -07:00
testRunner . CloseSignInAndPrinterSelect ( ) ;
2016-10-19 11:10:30 -07:00
//Names of Items to be added
2016-11-03 08:46:08 -07:00
string firstItemName = "Row Item Fennec Fox" ;
string secondItemName = "Row Item Batman" ;
2016-10-19 11:10:30 -07:00
//Navigate to Local Library
testRunner . ClickByName ( "Library Tab" ) ;
2016-10-26 06:49:50 -07:00
testRunner . NavigateToFolder ( "Local Library Row Item Collection" ) ;
2016-10-19 11:10:30 -07:00
//Make sure both Items do not exist before the test begins
bool firstItemExists = testRunner . WaitForName ( firstItemName , 1 ) ;
bool secondItemExists = testRunner . WaitForName ( secondItemName , 1 ) ;
2016-10-25 06:17:37 -07:00
Assert . IsTrue ( firstItemExists = = false ) ;
Assert . IsTrue ( secondItemExists = = false ) ;
2016-10-19 11:10:30 -07:00
//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 ) ;
2016-10-25 06:17:37 -07:00
Assert . IsTrue ( firstRowItemWasAdded = = true ) ;
Assert . IsTrue ( secondRowItemWasAdded = = true ) ;
return Task . FromResult ( 0 ) ;
2015-11-13 11:57:19 -08:00
} ;
2016-10-25 06:17:37 -07:00
await MatterControlUtilities . RunTest ( testToRun ) ;
2015-11-13 11:57:19 -08:00
}
2016-10-20 16:31:37 -07:00
[Test, Apartment(ApartmentState.STA)]
2016-10-25 06:17:37 -07:00
public async Task LocalLibraryAddButtonAddAMFToLibrary ( )
2015-11-13 11:57:19 -08:00
{
2016-10-25 06:17:37 -07:00
AutomationTest testToRun = ( testRunner ) = >
2015-11-13 11:57:19 -08:00
{
2016-10-26 08:35:51 -07:00
testRunner . CloseSignInAndPrinterSelect ( ) ;
2015-11-13 11:57:19 -08:00
2016-11-03 08:46:08 -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" ) ;
2016-10-26 06:49:50 -07:00
testRunner . NavigateToFolder ( "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 ) ;
2016-10-25 06:17:37 -07:00
Assert . IsTrue ( 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 ) ;
2016-10-25 06:17:37 -07:00
Assert . IsTrue ( rowItemWasAdded = = true ) ;
return Task . FromResult ( 0 ) ;
2015-11-13 11:57:19 -08:00
} ;
2016-10-25 06:17:37 -07:00
await MatterControlUtilities . RunTest ( testToRun , overrideWidth : 1024 , overrideHeight : 800 ) ;
2015-11-13 11:57:19 -08:00
}
2016-10-20 16:31:37 -07:00
[Test, Apartment(ApartmentState.STA)]
2016-10-25 06:17:37 -07:00
public async Task LocalLibraryAddButtonAddZipToLibrary ( )
2015-11-13 11:57:19 -08:00
{
2016-10-25 06:17:37 -07:00
AutomationTest testToRun = ( testRunner ) = >
2015-11-13 11:57:19 -08:00
{
2016-10-26 08:35:51 -07:00
testRunner . CloseSignInAndPrinterSelect ( ) ;
2016-10-19 11:10:30 -07:00
//Items in Batman.zip
2016-11-03 08:46:08 -07:00
string firstItemName = "Row Item Batman" ;
string secondItemName = "Row Item 2013-01-25 Mouthpiece v2" ;
2016-10-19 11:10:30 -07:00
//Navigate to Local Library
testRunner . ClickByName ( "Library Tab" ) ;
2016-10-26 06:49:50 -07:00
testRunner . NavigateToFolder ( "Local Library Row Item Collection" ) ;
2016-10-19 11:10:30 -07:00
//Make sure that Item does not exist before the test begins
bool firstItemInZipExists = testRunner . WaitForName ( firstItemName , 1 ) ;
bool secondItemInZipExists = testRunner . WaitForName ( secondItemName , 1 ) ;
2016-10-25 06:17:37 -07:00
Assert . IsTrue ( firstItemInZipExists = = false ) ;
Assert . IsTrue ( firstItemInZipExists = = false ) ;
2016-10-19 11:10:30 -07:00
//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 ) ;
2016-10-25 06:17:37 -07:00
Assert . IsTrue ( firstItemInZipWasAdded = = true ) ;
Assert . IsTrue ( secondItemInZipWasAdded = = true ) ;
return Task . FromResult ( 0 ) ;
2015-11-13 11:57:19 -08:00
} ;
2016-10-25 06:17:37 -07:00
await MatterControlUtilities . RunTest ( testToRun ) ;
2015-11-13 11:57:19 -08:00
}
2016-10-25 06:17:37 -07:00
2016-10-20 16:31:37 -07:00
[Test, Apartment(ApartmentState.STA)]
2016-10-25 06:17:37 -07:00
public async Task RenameButtonRenameLocalLibraryItem ( )
2015-11-13 11:57:19 -08:00
{
2016-10-25 06:17:37 -07:00
AutomationTest testToRun = ( testRunner ) = >
2015-11-13 11:57:19 -08:00
{
2016-10-26 08:35:51 -07:00
testRunner . CloseSignInAndPrinterSelect ( ) ;
2015-11-13 11:57:19 -08:00
2016-10-19 11:10:30 -07:00
//Navigate To Local Library
testRunner . ClickByName ( "Library Tab" ) ;
2016-10-26 06:49:50 -07:00
testRunner . NavigateToFolder ( "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-11-03 08:46:08 -07:00
string rowItemToRename = "Row Item Calibration - Box" ;
2016-10-19 11:10:30 -07:00
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-11-03 08:46:08 -07:00
string renamedRowItem = "Row Item Library Item Renamed" ;
2016-10-19 11:10:30 -07:00
bool libraryItemWasRenamed = testRunner . WaitForName ( renamedRowItem , 2 ) ;
bool libraryItemBeforeRenameExists = testRunner . WaitForName ( rowItemToRename , 2 ) ;
2015-11-13 11:57:19 -08:00
2016-10-25 06:17:37 -07:00
Assert . IsTrue ( libraryItemWasRenamed = = true ) ;
Assert . IsTrue ( libraryItemBeforeRenameExists = = false ) ;
return Task . FromResult ( 0 ) ;
2015-11-13 11:57:19 -08:00
} ;
2016-10-25 06:17:37 -07:00
await MatterControlUtilities . RunTest ( testToRun , overrideWidth : 600 ) ;
2015-11-13 11:57:19 -08:00
}
2016-10-20 16:31:37 -07:00
[Test, Apartment(ApartmentState.STA)]
2016-11-05 11:48:08 -07:00
public async Task RenameButtonRenamesLocalLibraryFolder ( )
2015-11-13 11:57:19 -08:00
{
2016-10-25 06:17:37 -07:00
AutomationTest testToRun = ( testRunner ) = >
2015-11-13 11:57:19 -08:00
{
2016-10-26 08:35:51 -07:00
testRunner . CloseSignInAndPrinterSelect ( ) ;
2016-11-05 11:48:08 -07:00
// Navigate to Local Library
2016-10-19 11:10:30 -07:00
testRunner . ClickByName ( "Library Tab" ) ;
2016-11-05 11:48:08 -07:00
testRunner . Wait ( . 2 ) ;
2016-10-26 06:49:50 -07:00
testRunner . NavigateToFolder ( "Local Library Row Item Collection" ) ;
2016-10-19 11:10:30 -07:00
2016-11-05 11:48:08 -07:00
// Create New Folder
2016-10-19 11:10:30 -07:00
testRunner . ClickByName ( "Create Folder From Library Button" ) ;
testRunner . Wait ( . 5 ) ;
2016-11-05 11:48:08 -07:00
2016-10-19 11:10:30 -07:00
testRunner . Type ( "New Folder" ) ;
testRunner . Wait ( . 5 ) ;
2016-11-05 11:48:08 -07:00
2016-10-19 11:10:30 -07:00
testRunner . ClickByName ( "Create Folder Button" ) ;
2016-11-05 11:48:08 -07:00
testRunner . Wait ( . 2 ) ;
2016-10-19 11:10:30 -07:00
2016-11-05 11:48:08 -07:00
// Confirm newly created folder exists
Assert . IsTrue ( testRunner . WaitForName ( "New Folder Row Item Collection" , 1 ) , "New folder should appear as GuiWidget" ) ;
2016-10-19 11:10:30 -07:00
testRunner . ClickByName ( "Library Edit Button" ) ;
2016-11-05 11:48:08 -07:00
testRunner . Wait ( . 2 ) ;
2016-10-19 11:10:30 -07:00
testRunner . ClickByName ( "New Folder Row Item Collection" ) ;
2016-11-05 11:48:08 -07:00
testRunner . Wait ( . 2 ) ;
2016-10-19 11:10:30 -07:00
MatterControlUtilities . LibraryRenameSelectedItem ( testRunner ) ;
testRunner . Wait ( . 5 ) ;
testRunner . Type ( "Renamed Library Folder" ) ;
2016-11-05 11:48:08 -07:00
2016-10-19 11:10:30 -07:00
testRunner . ClickByName ( "Rename Button" ) ;
2016-11-05 11:48:08 -07:00
testRunner . Wait ( . 2 ) ;
2016-10-19 11:10:30 -07:00
2016-11-05 11:48:08 -07:00
// Make sure the renamed Library Folder exists
Assert . IsTrue ( testRunner . WaitForName ( "Renamed Library Folder Row Item Collection" , 2 ) , "Renamed folder should exist" ) ;
2016-10-25 06:17:37 -07:00
return Task . FromResult ( 0 ) ;
2015-11-13 18:06:44 -08:00
} ;
2016-10-25 06:17:37 -07:00
await MatterControlUtilities . RunTest ( testToRun ) ;
2015-11-13 18:06:44 -08:00
}
2016-10-20 16:31:37 -07:00
[Test, Apartment(ApartmentState.STA)]
2016-10-25 06:17:37 -07:00
public async Task ClickLibraryEditButtonOpensPartPreviewWindow ( )
2015-11-13 18:06:44 -08:00
{
2016-10-25 06:17:37 -07:00
AutomationTest testToRun = ( testRunner ) = >
2015-11-13 18:06:44 -08:00
{
2016-10-26 08:35:51 -07:00
testRunner . CloseSignInAndPrinterSelect ( ) ;
2016-10-19 11:10:30 -07:00
//Navigate to Local Library
testRunner . ClickByName ( "Library Tab" ) ;
2016-10-26 06:49:50 -07:00
testRunner . NavigateToFolder ( "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-11-03 08:46:08 -07:00
string rowItem = "Row Item Calibration - Box" ;
2016-10-19 11:10:30 -07:00
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 ) ;
2016-10-25 06:17:37 -07:00
Assert . IsTrue ( exportItemWindowExists = = true ) ;
return Task . FromResult ( 0 ) ;
2015-11-13 18:06:44 -08:00
} ;
2016-10-25 06:17:37 -07:00
await MatterControlUtilities . RunTest ( testToRun ) ;
2015-11-13 18:06:44 -08:00
}
2016-10-20 16:31:37 -07:00
[Test, Apartment(ApartmentState.STA)]
2016-10-25 06:17:37 -07:00
public async Task RemoveButtonClickedRemovesSingleItem ( )
2015-11-13 18:06:44 -08:00
{
2016-10-25 06:17:37 -07:00
AutomationTest testToRun = ( testRunner ) = >
2015-11-13 18:06:44 -08:00
{
2016-10-26 08:35:51 -07:00
testRunner . CloseSignInAndPrinterSelect ( ) ;
2016-10-19 11:10:30 -07:00
//Navigate to Local Library
testRunner . ClickByName ( "Library Tab" ) ;
2016-10-26 06:49:50 -07:00
testRunner . NavigateToFolder ( "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-11-03 08:46:08 -07:00
string rowItem = "Row Item Calibration - Box" ;
2016-10-19 11:10:30 -07:00
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 ) ;
2016-10-25 06:17:37 -07:00
Assert . IsTrue ( rowItemExists = = false ) ;
return Task . FromResult ( 0 ) ;
2015-11-13 11:57:19 -08:00
} ;
2016-10-25 06:17:37 -07:00
await MatterControlUtilities . RunTest ( testToRun ) ;
2015-11-13 11:57:19 -08:00
}
2016-10-20 16:31:37 -07:00
[Test, Apartment(ApartmentState.STA)]
2016-10-25 06:17:37 -07:00
public async Task RemoveButtonClickedRemovesMultipleItems ( )
2015-11-13 18:06:44 -08:00
{
2016-10-25 06:17:37 -07:00
AutomationTest testToRun = ( testRunner ) = >
2015-11-13 18:06:44 -08:00
{
2016-10-26 08:35:51 -07:00
testRunner . CloseSignInAndPrinterSelect ( ) ;
2016-11-01 23:27:08 -07:00
// Navigate to Local Library
2016-10-19 11:10:30 -07:00
testRunner . ClickByName ( "Library Tab" ) ;
2016-10-26 06:49:50 -07:00
testRunner . NavigateToFolder ( "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}" ) ;
testRunner . Wait ( 1 ) ;
2016-11-01 23:27:08 -07:00
2016-11-03 08:46:08 -07:00
string rowItemOne = "Row Item Calibration - Box" ;
2016-10-19 11:10:30 -07:00
testRunner . ClickByName ( rowItemOne , 1 ) ;
2015-11-13 18:06:44 -08:00
2016-11-03 08:46:08 -07:00
string rowItemTwo = "Row Item Fennec Fox" ;
2016-10-19 11:10:30 -07:00
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-11-01 23:27:08 -07:00
// Make sure row items exist before remove
2016-11-05 11:12:20 -07:00
Assert . IsTrue ( testRunner . WaitForName ( rowItemOne , 2 ) , "rowItemOne should exist before remove" ) ;
Assert . IsTrue ( testRunner . WaitForName ( rowItemTwo , 2 ) , "rowItemTwo should exist before remove" ) ;
2015-11-13 18:06:44 -08:00
2016-11-01 23:27:08 -07:00
// Remove items
2016-10-19 11:10:30 -07:00
MatterControlUtilities . LibraryRemoveSelectedItem ( testRunner ) ;
testRunner . Wait ( 1 ) ;
2015-11-13 18:06:44 -08:00
2016-11-01 23:27:08 -07:00
// Make sure both selected items are removed
Assert . IsFalse ( testRunner . WaitForName ( rowItemOne , 2 ) , "rowItemOne should *not* exist after remove" ) ;
Assert . IsFalse ( testRunner . WaitForName ( rowItemTwo , 2 ) , "rowItemTwo should *not* exist after remove" ) ;
2016-10-25 06:17:37 -07:00
return Task . FromResult ( 0 ) ;
2015-11-13 18:06:44 -08:00
} ;
2016-10-25 06:17:37 -07:00
await MatterControlUtilities . RunTest ( testToRun ) ;
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)]
2016-10-25 06:17:37 -07:00
public async Task AddToQueueFromLibraryButtonAddsItemToQueue ( )
2015-11-18 15:28:50 -08:00
{
2016-10-25 06:17:37 -07:00
AutomationTest testToRun = ( testRunner ) = >
2015-11-18 15:28:50 -08:00
{
2016-10-26 08:35:51 -07:00
testRunner . CloseSignInAndPrinterSelect ( ) ;
2015-11-18 15:28:50 -08:00
2016-10-19 11:10:30 -07:00
//Navigate to Local Library
testRunner . ClickByName ( "Library Tab" ) ;
2016-10-26 06:49:50 -07:00
testRunner . NavigateToFolder ( "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
2016-11-03 08:46:08 -07:00
string rowItemOne = "Row Item Calibration - Box" ;
2016-10-19 11:10:30 -07:00
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-12-04 12:26:04 -08:00
int queueCountBeforeAdd = QueueData . Instance . ItemCount ;
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
2016-12-04 12:26:04 -08:00
int queueCountAfterAdd = QueueData . Instance . ItemCount ;
2015-11-18 15:28:50 -08:00
2016-10-25 06:17:37 -07:00
Assert . IsTrue ( 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
2016-11-03 08:46:08 -07:00
string queueItem = "Queue Item Calibration - Box" ;
2016-10-19 11:10:30 -07:00
bool queueItemWasAdded = testRunner . WaitForName ( queueItem , 2 ) ;
2016-10-25 06:17:37 -07:00
Assert . IsTrue ( queueItemWasAdded = = true ) ;
return Task . FromResult ( 0 ) ;
2015-11-18 15:28:50 -08:00
} ;
2016-10-25 06:17:37 -07:00
await MatterControlUtilities . RunTest ( testToRun ) ;
2015-11-18 15:28:50 -08:00
}
2016-10-20 16:31:37 -07:00
[Test, Apartment(ApartmentState.STA)]
2016-10-25 06:17:37 -07:00
public async Task AddToQueueFromLibraryButtonAddsItemsToQueue ( )
2015-11-18 15:28:50 -08:00
{
2016-10-25 06:17:37 -07:00
AutomationTest testToRun = ( testRunner ) = >
2015-11-18 15:28:50 -08:00
{
2016-10-26 08:35:51 -07:00
testRunner . CloseSignInAndPrinterSelect ( ) ;
2015-11-18 15:28:50 -08:00
2016-10-19 11:10:30 -07:00
//Navigate to Local Library
testRunner . ClickByName ( "Library Tab" ) ;
2016-10-26 06:49:50 -07:00
testRunner . NavigateToFolder ( "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-12-04 12:26:04 -08:00
int queueCountBeforeAdd = QueueData . Instance . ItemCount ;
2015-11-18 15:28:50 -08:00
2016-10-19 11:10:30 -07:00
//Select both Library Items
2016-11-03 08:46:08 -07:00
string rowItemOne = "Row Item Calibration - Box" ;
2016-10-19 11:10:30 -07:00
testRunner . ClickByName ( rowItemOne ) ;
2015-11-18 15:28:50 -08:00
2016-11-03 08:46:08 -07:00
string rowItemTwo = "Row Item Fennec Fox" ;
2016-10-19 11:10:30 -07:00
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
2016-12-04 12:26:04 -08:00
int queueCountAfterAdd = QueueData . Instance . ItemCount ;
2015-11-18 15:28:50 -08:00
2016-10-25 06:17:37 -07:00
Assert . IsTrue ( 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
2016-11-03 08:46:08 -07:00
string queueItemOne = "Queue Item Calibration - Box" ;
string queueItemTwo = "Queue Item Fennec_Fox" ;
2016-10-19 11:10:30 -07:00
bool queueItemOneWasAdded = testRunner . WaitForName ( queueItemOne , 2 ) ;
bool queueItemTwoWasAdded = testRunner . WaitForName ( queueItemTwo , 2 ) ;
2015-11-18 15:28:50 -08:00
2016-10-25 06:17:37 -07:00
Assert . IsTrue ( queueItemOneWasAdded = = true ) ;
Assert . IsTrue ( queueItemTwoWasAdded = = true ) ;
return Task . FromResult ( 0 ) ;
2015-11-18 15:28:50 -08:00
} ;
2016-10-25 06:17:37 -07:00
await MatterControlUtilities . RunTest ( testToRun ) ;
2015-11-18 15:28:50 -08:00
}
2016-10-20 16:31:37 -07:00
[Test, Apartment(ApartmentState.STA)]
2016-10-25 06:17:37 -07:00
public async Task LibraryItemThumbnailClickedOpensPartPreview ( )
2015-11-18 15:28:50 -08:00
{
2016-10-25 06:17:37 -07:00
AutomationTest testToRun = ( testRunner ) = >
2015-11-18 15:28:50 -08:00
{
2016-10-26 08:35:51 -07:00
testRunner . CloseSignInAndPrinterSelect ( ) ;
2015-11-18 15:28:50 -08:00
2016-11-01 22:52:25 -07:00
// Navigate to Local Library
2016-10-19 11:10:30 -07:00
testRunner . ClickByName ( "Library Tab" ) ;
2016-10-26 06:49:50 -07:00
testRunner . NavigateToFolder ( "Local Library Row Item Collection" ) ;
2015-11-18 15:28:50 -08:00
2016-11-01 22:52:25 -07:00
Assert . IsFalse ( testRunner . WaitForName ( "Part Preview Window" , 1 ) , "Preview Window should not exist before we click the view button" ) ;
2015-11-18 15:28:50 -08:00
2016-11-01 22:52:25 -07:00
testRunner . ClickByName ( "Row Item Calibration - Box" ) ;
2016-10-19 11:10:30 -07:00
testRunner . Wait ( 1 ) ;
2015-11-18 15:28:50 -08:00
2016-11-01 22:52:25 -07:00
// Click Library Item View Button
2016-11-03 08:46:08 -07:00
testRunner . ClickByName ( "Row Item Calibration - Box View Button" ) ;
2015-11-18 15:28:50 -08:00
2016-11-01 22:52:25 -07:00
Assert . IsTrue ( testRunner . WaitForName ( "Part Preview Window" , 2 ) , "Part Preview Window should be open after View button is clicked" ) ;
testRunner . Wait ( . 2 ) ;
2016-10-25 06:17:37 -07:00
return Task . FromResult ( 0 ) ;
2015-11-18 15:28:50 -08:00
} ;
2016-10-25 06:17:37 -07:00
await MatterControlUtilities . RunTest ( testToRun ) ;
2015-11-18 15:28:50 -08:00
}
2016-12-07 13:21:53 -08:00
[Test, Apartment(ApartmentState.STA)]
public async Task PrintLibraryItem ( )
{
AutomationTest testToRun = ( testRunner ) = >
{
2016-12-12 17:33:02 -08:00
testRunner . WaitForName ( "Cancel Wizard Button" , 1 ) ;
2016-12-07 13:21:53 -08:00
2017-01-10 17:20:24 -08:00
using ( var emulatorDisposable = testRunner . LaunchAndConnectToPrinterEmulator ( ) )
2017-01-10 13:43:12 -08:00
{
// Navigate to Local Library
testRunner . ClickByName ( "Library Tab" ) ;
testRunner . NavigateToFolder ( "Local Library Row Item Collection" ) ;
2016-12-07 13:21:53 -08:00
2017-01-10 13:43:12 -08:00
testRunner . ClickByName ( "Row Item Calibration - Box" ) ;
2016-12-07 13:21:53 -08:00
2017-01-10 13:43:12 -08:00
int initialQueueCount = QueueData . Instance . ItemCount ;
2016-12-07 13:21:53 -08:00
2017-01-10 13:43:12 -08:00
// Click Library Item Print Button
testRunner . ClickByName ( "Row Item Calibration - Box Print Button" ) ;
testRunner . Wait ( . 5 ) ;
2016-12-07 13:21:53 -08:00
2017-01-10 13:43:12 -08:00
Assert . AreEqual ( initialQueueCount + 1 , QueueData . Instance . ItemCount , "Queue count should increment by one after clicking 'Print'" ) ;
Assert . AreEqual ( "Calibration - Box" , QueueData . Instance . PrintItems [ 0 ] . Name , "Library item should be inserted at queue index 0" ) ;
Assert . AreEqual ( "Calibration - Box" , QueueData . Instance . SelectedPrintItem . Name , "Library item should be the selected item" ) ;
Assert . AreEqual ( "Calibration - Box" , PrinterConnectionAndCommunication . Instance . ActivePrintItem . Name , "PrinterConnectionCommunication item should be the expected item" ) ;
2016-12-07 13:21:53 -08:00
2017-01-10 13:43:12 -08:00
testRunner . ClickByName ( "Cancel Print Button" ) ;
2016-12-07 13:21:53 -08:00
2017-01-10 13:43:12 -08:00
testRunner . WaitForName ( "Start Print Button" , 5 ) ;
}
2016-12-07 13:21:53 -08:00
return Task . FromResult ( 0 ) ;
} ;
await MatterControlUtilities . RunTest ( testToRun ) ;
}
2015-11-18 15:28:50 -08:00
}
2015-11-13 11:57:19 -08:00
}