Convert CloseFirstPrinterTab into a reusable test helper method
This commit is contained in:
parent
0d111a09a3
commit
8ba2299a76
2 changed files with 16 additions and 14 deletions
|
|
@ -517,8 +517,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
Assert.AreEqual(printer.Settings.GetValue<double>(SettingsKey.layer_height).ToString(), "0.1", "Layer height is the fine override");
|
||||
|
||||
// Close Airwolf
|
||||
CloseFirstPrinterTab(testRunner);
|
||||
|
||||
testRunner.CloseFirstPrinterTab();
|
||||
|
||||
// Assert printer counts
|
||||
Assert.AreEqual(1, ProfileManager.Instance.ActiveProfiles.Count(), "ProfileManager should have 1 profile after Airwolf close");
|
||||
Assert.AreEqual(0, ApplicationController.Instance.ActivePrinters.Count(), "Zero printers should be active after Airwolf close");
|
||||
|
|
@ -530,7 +530,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
Assert.AreEqual(1, ApplicationController.Instance.ActivePrinters.Count(), "One printer should be active after BCN add");
|
||||
|
||||
// Close BCN
|
||||
CloseFirstPrinterTab(testRunner);
|
||||
testRunner.CloseFirstPrinterTab();
|
||||
|
||||
// Reopen Airwolf
|
||||
testRunner.SwitchToHardwareTab();
|
||||
|
|
@ -555,17 +555,6 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
}, maxTimeToRun: 120);
|
||||
}
|
||||
|
||||
private void CloseFirstPrinterTab(AutomationRunner testRunner)
|
||||
{
|
||||
// Close all printer tabs
|
||||
var mainViewWidget = testRunner.GetWidgetByName("PartPreviewContent", out _) as MainViewWidget;
|
||||
if (mainViewWidget.TabControl.AllTabs.First(t => t.TabContent is PrinterTabPage) is GuiWidget widget)
|
||||
{
|
||||
var closeWidget = widget.Descendants<ImageWidget>().First();
|
||||
testRunner.ClickWidget(closeWidget);
|
||||
}
|
||||
}
|
||||
|
||||
private void CloseAllPrinterTabs(AutomationRunner testRunner)
|
||||
{
|
||||
// Close all printer tabs
|
||||
|
|
|
|||
|
|
@ -691,6 +691,19 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
return ApplicationController.Instance.ActivePrinters.First();
|
||||
}
|
||||
|
||||
public static void CloseFirstPrinterTab(this AutomationRunner testRunner)
|
||||
{
|
||||
// Close all printer tabs
|
||||
var mainViewWidget = testRunner.GetWidgetByName("PartPreviewContent", out _) as MainViewWidget;
|
||||
if (mainViewWidget.TabControl.AllTabs.First(t => t.TabContent is PrinterTabPage) is GuiWidget widget)
|
||||
{
|
||||
var closeWidget = widget.Descendants<ImageWidget>().First();
|
||||
Assert.AreEqual("Close Tab Button", closeWidget.Name, "Expected widget ('Close Tab Button') not found");
|
||||
|
||||
testRunner.ClickWidget(closeWidget);
|
||||
}
|
||||
}
|
||||
|
||||
public static void WaitForCommunicationStateDisconnected(this AutomationRunner testRunner, PrinterConfig printer, int maxSeconds = 500)
|
||||
{
|
||||
testRunner.WaitFor(() => printer.Connection.CommunicationState == CommunicationStates.Disconnected, maxSeconds);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue