From 9d8e710595f25dd6438ae44d4bdbf5c08cc54483 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Tue, 13 Mar 2018 07:51:28 -0700 Subject: [PATCH 1/4] Remove validation of removed menu item - Issue MatterHackers/MCCentral#2912 Investigate View3DOverflowMenus failure --- .../MatterControl.AutomationTests/MatterControlTests.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Tests/MatterControl.AutomationTests/MatterControlTests.cs b/Tests/MatterControl.AutomationTests/MatterControlTests.cs index 5b00f9f18..22642f267 100644 --- a/Tests/MatterControl.AutomationTests/MatterControlTests.cs +++ b/Tests/MatterControl.AutomationTests/MatterControlTests.cs @@ -66,15 +66,6 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.ClickByName("Model View Button"); testRunner.ClickByName("View3D Overflow Menu"); - Assert.IsTrue(testRunner.WaitForName("Overhang Menu Item"), "Model overflow menu should have Overhang item"); - - testRunner.ClickByName("Layers3D Button"); - testRunner.ClickByName("View3D Overflow Menu"); - Assert.IsTrue(testRunner.WaitForName("Sync To Print Menu Item"), "GCode3D overflow menu should have sync-to-print item"); - - testRunner.ClickByName("Layers2D Button"); - testRunner.ClickByName("View3D Overflow Menu"); - Assert.IsTrue(testRunner.WaitForName("Sync To Print Menu Item"), "GCode2D overflow menu should have sync-to-print item"); return Task.CompletedTask; }); From c09210047cddab3a3e04ff12adb05bc9a6be30d4 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Tue, 13 Mar 2018 08:39:57 -0700 Subject: [PATCH 2/4] Add a mechanism to set the name of a SettingsItem -> Toggle control --- ConfigurationPage/ApplicationSettings/SettingsItem.cs | 2 ++ PartPreviewWindow/GCodeDetailsView.cs | 1 + 2 files changed, 3 insertions(+) diff --git a/ConfigurationPage/ApplicationSettings/SettingsItem.cs b/ConfigurationPage/ApplicationSettings/SettingsItem.cs index 57d0b9ffa..182f013db 100644 --- a/ConfigurationPage/ApplicationSettings/SettingsItem.cs +++ b/ConfigurationPage/ApplicationSettings/SettingsItem.cs @@ -13,6 +13,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage public class ToggleSwitchConfig { public bool Checked { get; set; } + public string Name { get; set; } public Action ToggleAction { get; set; } } @@ -90,6 +91,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage var toggleSwitch = ImageButtonFactory.CreateToggleSwitch(toggleSwitchConfig.Checked, textColor); toggleSwitch.VAnchor = VAnchor.Center; + toggleSwitch.Name = toggleSwitchConfig.Name; toggleSwitch.Margin = new BorderDouble(left: 16); toggleSwitch.CheckedStateChanged += (sender, e) => { diff --git a/PartPreviewWindow/GCodeDetailsView.cs b/PartPreviewWindow/GCodeDetailsView.cs index b71f41dcb..34df2ad0e 100644 --- a/PartPreviewWindow/GCodeDetailsView.cs +++ b/PartPreviewWindow/GCodeDetailsView.cs @@ -251,6 +251,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow theme.Colors.PrimaryTextColor, new SettingsItem.ToggleSwitchConfig() { + Name = option.Title + " Toggle", Checked = option.IsChecked(), ToggleAction = option.SetValue }, From 8eee29fd322ece3185f0670afaa28c0d725765c9 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Tue, 13 Mar 2018 08:41:08 -0700 Subject: [PATCH 3/4] Add a mechanism to bypass the closeInitialPlusTab behavior --- .../MatterControl/MatterControlUtilities.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs index dbaaee31b..d16ac882d 100644 --- a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs +++ b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs @@ -178,7 +178,7 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.WaitforDraw(systemWindow); } - public static void CloseSignInAndPrinterSelect(this AutomationRunner testRunner, PrepAction preAction = PrepAction.CloseSignInAndPrinterSelect) + public static void CloseSignInAndPrinterSelect(this AutomationRunner testRunner, bool closeInitialPlusTab = true) { testRunner.WaitForFirstDraw(); @@ -194,10 +194,13 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.ClickByName("Cancel Wizard Button"); } - var plusTabRegion = testRunner.GetRegionByName("Initial Plus Tab"); - testRunner.ClickByName("Close Tab Button", plusTabRegion); + if (closeInitialPlusTab) + { + var plusTabRegion = testRunner.GetRegionByName("Initial Plus Tab"); + testRunner.ClickByName("Close Tab Button", plusTabRegion); - testRunner.WaitForWidgetDisappear("Initial Plus Tab", 2); + testRunner.WaitForWidgetDisappear("Initial Plus Tab", 2); + } } public static void ChangeToQueueContainer(this AutomationRunner testRunner) From 51dcf0faef6e4e6be0c779ca1997eb88ae62a744 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Tue, 13 Mar 2018 08:42:37 -0700 Subject: [PATCH 4/4] Add support for toggling Sync-to-print after recent menu item removal - Issue MatterHackers/MCCentral#2914 Investigate CancelWorksAsExpected failure --- .../SliceSettingsTests.cs | 13 +++++++------ .../MatterControl/MatterControlUtilities.cs | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Tests/MatterControl.AutomationTests/SliceSettingsTests.cs b/Tests/MatterControl.AutomationTests/SliceSettingsTests.cs index 6d0789eb9..39334af16 100644 --- a/Tests/MatterControl.AutomationTests/SliceSettingsTests.cs +++ b/Tests/MatterControl.AutomationTests/SliceSettingsTests.cs @@ -58,8 +58,9 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.AddItemToBedplate(); - testRunner.OpenGCode3DOverflowMenu(); - testRunner.ClickByName("Sync To Print Menu Item"); + // Toggle Sync-to-print + testRunner.SwitchToGCodeTab(); + testRunner.ClickByName("Sync To Print Toggle"); testRunner.StartPrint(); @@ -94,9 +95,9 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.AddItemToBedplate(); - // Turn on Sync-to-print - testRunner.OpenGCode3DOverflowMenu(); - testRunner.ClickByName("Sync To Print Menu Item"); + // Toggle Sync-to-print + testRunner.SwitchToGCodeTab(); + testRunner.ClickByName("Sync To Print Toggle"); testRunner.StartPrint(); @@ -123,7 +124,7 @@ namespace MatterHackers.MatterControl.Tests.Automation private static void WaitForLayerAndResume(AutomationRunner testRunner, int indexToWaitFor) { testRunner.WaitForName("No Button", 30); - + var printer = ApplicationController.Instance.ActivePrinter; // Wait for layer diff --git a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs index d16ac882d..e7a13331d 100644 --- a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs +++ b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs @@ -826,6 +826,20 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.ClickByName("Controls Tab"); } + /// + /// Switch to Printer -> GCode Tab - NOTE: as a short term hack this helper as adds content to the bed and slices to ensure GCode view options appear as expected + /// + /// + public static void SwitchToGCodeTab(this AutomationRunner testRunner) + { + testRunner.ClickByName("Layers3D Button"); + + // TODO: Remove workaround needed to force GCode options to appear {{ + testRunner.AddItemToBedplate(); + testRunner.ClickByName("Generate Gcode Button"); + // TODO: Remove workaround needed to force GCode options to appear }} + } + private static void EnsurePrinterSidebarOpen(AutomationRunner testRunner) { // If the sidebar exists, we need to expand and pin it