diff --git a/Library/Widgets/PrintLibraryWidget.cs b/Library/Widgets/PrintLibraryWidget.cs index 948908205..7bd80776e 100644 --- a/Library/Widgets/PrintLibraryWidget.cs +++ b/Library/Widgets/PrintLibraryWidget.cs @@ -456,11 +456,6 @@ namespace MatterHackers.MatterControl.PrintLibrary ToolTipText = "Add an.stl, .obj, .amf, .gcode or.zip file to the Library".Localize(), Action = (selectedLibraryItems, listView) => { - /* - - Name = "Library Add Button"; - */ - AggContext.FileDialogs.OpenFileDialog( new OpenFileDialogParams(ApplicationSettings.OpenPrintableFileParams, multiSelect: true), (openParams) => @@ -485,10 +480,6 @@ namespace MatterHackers.MatterControl.PrintLibrary Icon = AggContext.StaticData.LoadIcon("fa-folder-new_16.png", IconColor.Raw), Action = (selectedLibraryItems, listView) => { - /* - Name = "Create Folder From Library Button"; - */ - DialogWindow.Show( new InputBoxPage( "Create Folder".Localize(), diff --git a/Tests/MatterControl.AutomationTests/CreateLibraryFolder.cs b/Tests/MatterControl.AutomationTests/CreateLibraryFolder.cs index 6d888519f..b68de8335 100644 --- a/Tests/MatterControl.AutomationTests/CreateLibraryFolder.cs +++ b/Tests/MatterControl.AutomationTests/CreateLibraryFolder.cs @@ -48,7 +48,7 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.CloseSignInAndPrinterSelect(); testRunner.NavigateToFolder("Local Library Row Item Collection"); - testRunner.ClickByName("Create Folder From Library Button"); + testRunner.InvokeLibraryCreateFolderDialog(); testRunner.Delay(.5); testRunner.Type("Test Text"); diff --git a/Tests/MatterControl.AutomationTests/ExportItemWindowTests.cs b/Tests/MatterControl.AutomationTests/ExportItemWindowTests.cs index 82664cad5..ee243c393 100644 --- a/Tests/MatterControl.AutomationTests/ExportItemWindowTests.cs +++ b/Tests/MatterControl.AutomationTests/ExportItemWindowTests.cs @@ -19,7 +19,7 @@ namespace MatterHackers.MatterControl.Tests.Automation //Navigate to Downloads Library Provider testRunner.NavigateToFolder("Print Queue Row Item Collection"); - testRunner.ClickByName("Library Add Button"); + testRunner.InvokeLibraryAddDialog(); //Get parts to add string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl"); diff --git a/Tests/MatterControl.AutomationTests/LibraryActionTests.cs b/Tests/MatterControl.AutomationTests/LibraryActionTests.cs index eb55a0111..7871ada7c 100644 --- a/Tests/MatterControl.AutomationTests/LibraryActionTests.cs +++ b/Tests/MatterControl.AutomationTests/LibraryActionTests.cs @@ -114,7 +114,7 @@ namespace MatterHackers.MatterControl.Tests.Automation Assert.IsTrue(File.Exists(exportZipPath), "Queue was exported to zip file, file exists on disk at expected path"); // Import the exported zip file and confirm the Queue Count increases by 3 - testRunner.ClickByName("Library Add Button"); + testRunner.InvokeLibraryAddDialog(); testRunner.Delay(1); testRunner.Type(exportZipPath); testRunner.Delay(1); diff --git a/Tests/MatterControl.AutomationTests/LibraryDownloadsTest.cs b/Tests/MatterControl.AutomationTests/LibraryDownloadsTest.cs index 1dde0c3b8..842a38396 100644 --- a/Tests/MatterControl.AutomationTests/LibraryDownloadsTest.cs +++ b/Tests/MatterControl.AutomationTests/LibraryDownloadsTest.cs @@ -34,7 +34,7 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.NavigateToFolder("-Temporary Row Item Collection"); // Add both files to the FileOpen dialog - testRunner.ClickByName("Library Add Button"); + testRunner.InvokeLibraryAddDialog(); testRunner.CompleteDialog( string.Format( "\"{0}\" \"{1}\"", @@ -61,7 +61,7 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.NavigateToFolder("-Temporary Row Item Collection"); // Add AMF part items to Downloads and then type paths into file dialog - testRunner.ClickByName("Library Add Button"); + testRunner.InvokeLibraryAddDialog(); testRunner.CompleteDialog(MatterControlUtilities.GetTestItemPath("Rook.amf"), 4); Assert.IsTrue(testRunner.WaitForName("Row Item Rook.amf"), "Rook item exists"); @@ -81,7 +81,7 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.NavigateToFolder("Downloads Row Item Collection"); testRunner.NavigateToFolder("-Temporary Row Item Collection"); - testRunner.ClickByName("Library Add Button"); + testRunner.InvokeLibraryAddDialog(); testRunner.CompleteDialog(MatterControlUtilities.GetTestItemPath("Test.zip"), 4); testRunner.DoubleClickByName("Test.zip Row Item Collection"); @@ -106,7 +106,7 @@ namespace MatterHackers.MatterControl.Tests.Automation // Navigate to Downloads Library Provider testRunner.NavigateToFolder("Downloads Row Item Collection"); testRunner.NavigateToFolder("-Temporary Row Item Collection"); - testRunner.ClickByName("Library Add Button"); + testRunner.InvokeLibraryAddDialog(); testRunner.CompleteDialog(MatterControlUtilities.GetTestItemPath("Batman.stl"), 2); diff --git a/Tests/MatterControl.AutomationTests/LocalLibraryTests.cs b/Tests/MatterControl.AutomationTests/LocalLibraryTests.cs index 74528e7db..30b874994 100644 --- a/Tests/MatterControl.AutomationTests/LocalLibraryTests.cs +++ b/Tests/MatterControl.AutomationTests/LocalLibraryTests.cs @@ -60,7 +60,7 @@ namespace MatterHackers.MatterControl.Tests.Automation Assert.IsFalse(testRunner.WaitForName("Row Item 2013-01-25 Mouthpiece V2", 1), "Mouthpiece part should not exist at test start"); // Add Library item - testRunner.ClickByName("Library Add Button"); + testRunner.InvokeLibraryAddDialog(); testRunner.Delay(2); testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.zip")); testRunner.Delay(1); @@ -118,7 +118,7 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.NavigateToFolder("Local Library Row Item Collection"); // Create New Folder - testRunner.ClickByName("Create Folder From Library Button"); + testRunner.InvokeLibraryCreateFolderDialog(); testRunner.Delay(.5); testRunner.Type("New Folder"); diff --git a/Tests/MatterControl.AutomationTests/PrintQueueTests.cs b/Tests/MatterControl.AutomationTests/PrintQueueTests.cs index cd0db9436..c2d2a55f7 100644 --- a/Tests/MatterControl.AutomationTests/PrintQueueTests.cs +++ b/Tests/MatterControl.AutomationTests/PrintQueueTests.cs @@ -53,7 +53,7 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.ChangeToQueueContainer(); // Click Add button and select files - testRunner.ClickByName("Library Add Button"); + testRunner.InvokeLibraryAddDialog(); // Open Fennec_Fox testRunner.CompleteDialog( @@ -83,7 +83,7 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.ChangeToQueueContainer(); // Click Add button and select files - testRunner.ClickByName("Library Add Button"); + testRunner.InvokeLibraryAddDialog(); // Open Fennec_Fox, Batman files testRunner.CompleteDialog( @@ -197,7 +197,7 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.ChangeToQueueContainer(); // Click Add button and select files - testRunner.ClickByName("Library Add Button"); + testRunner.InvokeLibraryAddDialog(); // Open Rook testRunner.CompleteDialog( @@ -227,7 +227,7 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.ChangeToQueueContainer(); // Click Add button and select files - testRunner.ClickByName("Library Add Button"); + testRunner.InvokeLibraryAddDialog(); // Open Batman testRunner.CompleteDialog( @@ -257,7 +257,7 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.ChangeToQueueContainer(); // Click Add button and select files - testRunner.ClickByName("Library Add Button"); + testRunner.InvokeLibraryAddDialog(); // Open chichen-itza_pyramid testRunner.CompleteDialog( diff --git a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs index e322c78b2..0a237c2c5 100644 --- a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs +++ b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs @@ -480,6 +480,18 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.Delay(.5); } + public static void InvokeLibraryAddDialog(this AutomationRunner testRunner) + { + testRunner.ClickByName("Print Library Overflow Menu"); + testRunner.ClickByName("Add Menu Item"); + } + + public static void InvokeLibraryCreateFolderDialog(this AutomationRunner testRunner) + { + testRunner.ClickByName("Print Library Overflow Menu"); + testRunner.ClickByName("Create Folder Menu Item"); + } + /// /// Types the specified text into the dialog and sends {Enter} to complete the interaction /// @@ -870,7 +882,7 @@ namespace MatterHackers.MatterControl.Tests.Automation } // Add Library item - testRunner.ClickByName("Library Add Button"); + testRunner.InvokeLibraryAddDialog(); // Generate the full, quoted paths for the requested assets string fullQuotedAssetPaths = string.Join(" ", assetNames.Select(name => $"\"{MatterControlUtilities.GetTestItemPath(name)}\""));