From c5ea8bb3c0150eaeabdea4ad268f735a2afdf34d Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 28 Dec 2017 09:02:44 -0800 Subject: [PATCH] Update automation tests to account for printer settings changes --- .../HardwareLevelingUITests.cs | 16 ++++++---------- .../PrinterDropDownTests.cs | 8 ++++---- .../PrintingTests.cs | 6 ++---- .../SliceSettingsTests.cs | 13 +++++-------- .../MatterControl/MatterControlUtilities.cs | 17 +++++++++++++++-- 5 files changed, 32 insertions(+), 28 deletions(-) diff --git a/Tests/MatterControl.AutomationTests/HardwareLevelingUITests.cs b/Tests/MatterControl.AutomationTests/HardwareLevelingUITests.cs index 6e9179b05..40998334b 100644 --- a/Tests/MatterControl.AutomationTests/HardwareLevelingUITests.cs +++ b/Tests/MatterControl.AutomationTests/HardwareLevelingUITests.cs @@ -16,20 +16,16 @@ namespace MatterHackers.MatterControl.Tests.Automation // Add printer that has hardware leveling testRunner.AddAndSelectPrinter("Airwolf 3D", "HD"); - testRunner.SwitchToSliceSettings(); - - testRunner.ClickByName("Printer Tab"); - testRunner.Delay(.2); - - Assert.IsFalse(testRunner.WaitForName("Print Leveling Tab", .5), "Print leveling should not exist for an Airwolf HD"); + testRunner.SwitchToPrinterSettings(); + testRunner.ClickByName("Features Tab"); + Assert.IsFalse(testRunner.WaitForName("print_leveling_solution Row", .5), "Print leveling should not exist for an Airwolf HD"); // Add printer that does not have hardware leveling testRunner.AddAndSelectPrinter("3D Factory", "MendelMax 1.5"); - testRunner.ClickByName("Slice Settings Tab"); - testRunner.ClickByName("Printer Tab"); - - Assert.IsTrue(testRunner.WaitForName("Print Leveling Tab"), "Print leveling should exist for a 3D Factory MendelMax"); + testRunner.SwitchToPrinterSettings(); + testRunner.ClickByName("Features Tab"); + Assert.IsTrue(testRunner.WaitForName("print_leveling_solution Row"), "Print leveling should exist for a 3D Factory MendelMax"); return Task.CompletedTask; }, overrideHeight: 800); diff --git a/Tests/MatterControl.AutomationTests/PrinterDropDownTests.cs b/Tests/MatterControl.AutomationTests/PrinterDropDownTests.cs index de4775c66..196efb92e 100644 --- a/Tests/MatterControl.AutomationTests/PrinterDropDownTests.cs +++ b/Tests/MatterControl.AutomationTests/PrinterDropDownTests.cs @@ -21,17 +21,17 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.AddAndSelectPrinter("Airwolf 3D", "HD"); - testRunner.SwitchToSliceSettings(); - - testRunner.ClickByName("Printer Tab"); + testRunner.SwitchToPrinterSettings(); testRunner.ClickByName("Printer Name Field"); var textWidget = testRunner.GetWidgetByName("Printer Name Field", out _); string newName = "Updated name"; textWidget.Text = newName; + + // Force loose focus testRunner.ClickByName("Printer Tab"); - testRunner.Delay(4); + testRunner.Delay(1); //Check to make sure the Printer dropdown gets the name change testRunner.OpenPrintersDropdown(); diff --git a/Tests/MatterControl.AutomationTests/PrintingTests.cs b/Tests/MatterControl.AutomationTests/PrintingTests.cs index fca24d592..cc0986c6f 100644 --- a/Tests/MatterControl.AutomationTests/PrintingTests.cs +++ b/Tests/MatterControl.AutomationTests/PrintingTests.cs @@ -27,10 +27,8 @@ namespace MatterHackers.MatterControl.Tests.Automation { Assert.IsTrue(ProfileManager.Instance.ActiveProfile != null); - testRunner.SwitchToSliceSettings(); - - testRunner.ClickByName("Printer Tab"); - testRunner.ClickByName("Custom G-Code Tab"); + testRunner.SwitchToPrinterSettings(); + testRunner.ClickByName("G-Code Tab"); testRunner.ClickByName("End G-Code Field"); testRunner.Type("^a"); testRunner.Type("{BACKSPACE}"); diff --git a/Tests/MatterControl.AutomationTests/SliceSettingsTests.cs b/Tests/MatterControl.AutomationTests/SliceSettingsTests.cs index 85e0c7e8a..d433eaae2 100644 --- a/Tests/MatterControl.AutomationTests/SliceSettingsTests.cs +++ b/Tests/MatterControl.AutomationTests/SliceSettingsTests.cs @@ -142,9 +142,8 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.AddAndSelectPrinter("Airwolf 3D", "HD"); // Navigate to Local Library - testRunner.SwitchToSliceSettings(); + testRunner.SwitchToPrinterSettings(); - testRunner.ClickByName("Printer Tab"); testRunner.ClickByName("Features Tab"); // Find any sibling toggle switch and scroll the parent to the bottom @@ -167,10 +166,6 @@ namespace MatterHackers.MatterControl.Tests.Automation { using (var emulator = testRunner.LaunchAndConnectToPrinterEmulator()) { - // Navigate to Local Library - testRunner.SwitchToSliceSettings(); - - testRunner.ClickByName("Printer Tab"); testRunner.ClickByName("Features Tab"); // only 1 hotend and 1 extruder @@ -252,7 +247,9 @@ namespace MatterHackers.MatterControl.Tests.Automation // and the on toggle is showing off Assert.IsFalse(heatToggle.Checked); - testRunner.ClickByName("Extruder Tab"); + // Collapse the popup and switch back to the general tab + testRunner.ClickByName("Hotend 0"); + testRunner.ClickByName("General Tab"); testRunner.ClickByName(SliceSettingsOrganizer.Instance.GetSettingsData(SettingsKey.extruder_count).PresentationName + " Field"); testRunner.Type("2"); @@ -400,7 +397,7 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.ClickByName("Bed Temperature Field"); // Uncheck Has Heated Bed checkbox and make sure Bed Temp Textbox is not visible - testRunner.ClickByName("Printer Tab"); + testRunner.SwitchToPrinterSettings(); testRunner.ClickByName("Features Tab"); // Scroll the 'Has Heated Bed' field into view diff --git a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs index 33c7d2a94..ece6a148d 100644 --- a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs +++ b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs @@ -216,8 +216,8 @@ namespace MatterHackers.MatterControl.Tests.Automation ActiveSliceSettings.Instance.SetValue("driver_type", "Emulator"); // edit the com port - testRunner.ClickByName("Slice Settings Sidebar"); - testRunner.ClickByName("Printer Tab"); + testRunner.SwitchToPrinterSettings(); + var serialPortDropDown = testRunner.GetWidgetByName("com_port Field", out _, 1); testRunner.WaitFor(() => serialPortDropDown.Enabled); // Wait until the serialPortDropDown is ready to click it. Ensures the printer is loaded. @@ -725,6 +725,19 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.ClickByName("General Tab"); } + /// + /// Switch to printer settings + /// + /// + public static void SwitchToPrinterSettings(this AutomationRunner testRunner) + { + testRunner.SwitchToSliceSettings(); + + testRunner.ClickByName("Printer Overflow Menu"); + testRunner.ClickByName("Configure Printer Menu Item"); + testRunner.ClickByName("Printer Tab"); + } + /// /// Switch to Printer -> Controls ///