diff --git a/Tests/MatterControl.AutomationTests/HardwareLevelingUITests.cs b/Tests/MatterControl.AutomationTests/HardwareLevelingUITests.cs index c53fc62cf..9658b7886 100644 --- a/Tests/MatterControl.AutomationTests/HardwareLevelingUITests.cs +++ b/Tests/MatterControl.AutomationTests/HardwareLevelingUITests.cs @@ -45,8 +45,7 @@ namespace MatterHackers.MatterControl.Tests.Automation using (var emulator = testRunner.LaunchAndConnectToPrinterEmulator("JumpStart", "V1", runSlow: false)) { // make sure it is showing the correct button - Assert.IsFalse(testRunner.WaitForName("PrintPopupMenu", .5), "Start Print should not be visible if PrintLeveling is required"); - Assert.IsTrue(testRunner.WaitForName("Finish Setup Button"), "Finish Setup should be visible if PrintLeveling is required"); + testRunner.OpenPrintPopupMenu(false, false); // HACK: automatically resuming setup wizard. Long term we want a better plan testRunner.ClickByName("Finish Setup Button"); @@ -64,9 +63,10 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.ClickByName("Reset to Defaults Menu Item"); testRunner.ClickByName("Yes Button"); + testRunner.OpenPrintPopupMenu(false, false); + // make sure it is showing the correct button Assert.IsTrue(testRunner.WaitForName("Finish Setup Button"), "Finish Setup should be visible after reset to Defaults"); - Assert.IsTrue(!testRunner.WaitForName("PrintPopupMenu"), "Start Print should not be visible after reset to Defaults"); } return Task.CompletedTask; diff --git a/Tests/MatterControl.AutomationTests/PrintingTests.cs b/Tests/MatterControl.AutomationTests/PrintingTests.cs index 3f8b8721d..b585a182b 100644 --- a/Tests/MatterControl.AutomationTests/PrintingTests.cs +++ b/Tests/MatterControl.AutomationTests/PrintingTests.cs @@ -92,6 +92,8 @@ namespace MatterHackers.MatterControl.Tests.Automation { Assert.AreEqual(1, ApplicationController.Instance.ActivePrinters.Count(), "One printer should be defined after add"); + testRunner.OpenPrintPopupMenu(false, false); + testRunner.ClickByName("Finish Setup Button"); testRunner.Complete9StepLeveling(); diff --git a/Tests/MatterControl.AutomationTests/SliceSettingsTests.cs b/Tests/MatterControl.AutomationTests/SliceSettingsTests.cs index 131c91d86..77d76bb5a 100644 --- a/Tests/MatterControl.AutomationTests/SliceSettingsTests.cs +++ b/Tests/MatterControl.AutomationTests/SliceSettingsTests.cs @@ -96,7 +96,7 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.ClickByName("Layer(s) To Pause Field"); testRunner.Type("2"); - testRunner.ClickByName("Start Print Button"); + testRunner.StartPrint(); // Wait for the Ok button testRunner.WaitForName("Yes Button", 30); diff --git a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs index 1610ce284..0484f8f28 100644 --- a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs +++ b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs @@ -320,7 +320,6 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.WaitforDraw(systemWindow); // close the welcome message - if (testRunner.NameExists("Cancel Wizard Button", 1)) { testRunner.ClickByName("Cancel Wizard Button"); @@ -797,7 +796,7 @@ namespace MatterHackers.MatterControl.Tests.Automation /// Switch to the primary SliceSettings tab /// /// - public static void OpenPrintPopupMenu(this AutomationRunner testRunner) + public static void OpenPrintPopupMenu(this AutomationRunner testRunner, bool openAdvanced = true, bool doFinishSetup = true) { var printerConnection = ApplicationController.Instance.DragDropData.View3DWidget.Printer.Connection; @@ -808,26 +807,31 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.WaitFor(() => printerConnection.CommunicationState == CommunicationStates.Connected); } - if (testRunner.NamedWidgetExists("Finish Setup Button")) - { - testRunner.ClickByName("Finish Setup Button"); - testRunner.ClickByName("Already Loaded Button"); - } - - // Wait for button to become enabled - var printerPopup = testRunner.GetWidgetByName("PrintPopupMenu", out _); - testRunner.WaitFor(() => printerPopup.Enabled); - - // check if the print menu is already open + // if the menu is not already open if (!testRunner.NameExists("Advanced Section", .2)) { // open it testRunner.ClickByName("PrintPopupMenu"); + } - if (!testRunner.NameExists("Layer(s) To Pause Field", .2)) - { - testRunner.ClickByName("Advanced Section"); - } + // wait for it to be all the way open + testRunner.WaitForName("Advanced Section"); + + // make sure we are in a state that can print + if (doFinishSetup + && testRunner.NameExists("Finish Setup Button")) + { + testRunner.ClickByName("Finish Setup Button"); + testRunner.ClickByName("Already Loaded Button"); + // open it again + testRunner.ClickByName("PrintPopupMenu"); + testRunner.WaitForName("Advanced Section"); + } + + if (openAdvanced + && !testRunner.NameExists("Layer(s) To Pause Field", .2)) + { + testRunner.ClickByName("Advanced Section"); } }