Constrain Cancel button click to Welcome page only

This commit is contained in:
John Lewin 2018-12-19 17:29:36 -08:00
parent 4d4c4cff8f
commit d0d52a4b2d

View file

@ -327,10 +327,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.WaitforDraw(systemWindow);
// close the welcome message
if (testRunner.NameExists("Cancel Wizard Button", 1))
{
testRunner.ClickByName("Cancel Wizard Button");
}
testRunner.EnsureWelcomePageClosed();
// Click 'Add Printer' if not on screen
if (!testRunner.NameExists("Select Make", 0.2))
@ -375,6 +372,17 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.WaitFor(() => !testRunner.WidgetExists<SetupStepComPortOne>());
}
private static void EnsureWelcomePageClosed(this AutomationRunner testRunner)
{
// Close the WelcomePage window if active
if (testRunner.GetWidgetByName("HeaderRow", out _) is GuiWidget headerRow
&& headerRow.Parents<DialogPage>().FirstOrDefault() is WelcomePage welcomePage
&& testRunner.NameExists("Cancel Wizard Button", 1))
{
testRunner.ClickByName("Cancel Wizard Button");
}
}
public static void SwitchToHardwareTab(this AutomationRunner testRunner)
{
testRunner.ClickByName("Hardware Tab");