public static void AddAndSelectPrinter(this AutomationRunner testRunner, string make = "Airwolf 3D", string model = "HD") { testRunner.GetWidgetByName("WidescreenPanel", out SystemWindow systemWindow, 10); // make sure we wait for MC to be up and running testRunner.WaitforDraw(systemWindow); // Click 'Add Printer' if not on screen if (!testRunner.NameExists("Select Make", 0.2)) { if (!testRunner.NameExists("Create Printer", 0.2)) { // go to the start page testRunner.ClickByName("Hardware Tab"); testRunner.ClickByName("Create Printer"); } else { if (testRunner.NameExists("Print Button", .2)) { testRunner.ClickByName("Print Button"); } else { testRunner.ClickByName("Create Printer"); } } } testRunner.ClickByName("Select Make"); testRunner.WaitFor(() => testRunner.WidgetExists <PopupWidget>()); testRunner.Type(make); testRunner.Type("{Enter}"); testRunner.WaitFor(() => !testRunner.WidgetExists <PopupWidget>()); testRunner.ClickByName("Select Model"); testRunner.WaitFor(() => testRunner.WidgetExists <PopupWidget>()); testRunner.Type(model); testRunner.Type("{Enter}"); testRunner.WaitFor(() => !testRunner.WidgetExists <PopupWidget>()); // An unpredictable period of time will pass between Clicking Save, everything reloading and us returning to the caller. // Block until ReloadAll has completed then close and return to the caller, at which point hopefully everything is reloaded. testRunner.ClickByName("Next Button"); testRunner.WaitFor(() => testRunner.WidgetExists <SetupStepComPortOne>()); testRunner.ClickByName("Cancel Wizard Button"); testRunner.WaitFor(() => !testRunner.WidgetExists <SetupStepComPortOne>()); }
public static Emulator LaunchAndConnectToPrinterEmulator(this AutomationRunner testRunner, string make = "Airwolf 3D", string model = "HD", bool runSlow = false) { SystemWindow systemWindow; testRunner.GetWidgetByName("Hardware Tab", out systemWindow, 10); // make sure we wait for MC to be up and running testRunner.WaitforDraw(systemWindow); // Load the TestEnv config var config = TestAutomationConfig.Load(); // Override the heat up time Emulator.DefaultHeatUpTime = config.HeatupTime; // Override the temp stabilization time WaitForTempStream.WaitAfterReachTempTime = config.TempStabilizationTime; // Create the printer testRunner.AddAndSelectPrinter(make, model); // Force the configured printer to use the emulator driver ApplicationController.Instance.ActivePrinter.Settings.SetValue("driver_type", "Emulator"); // edit the com port 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. testRunner.ClickByName("com_port Field"); testRunner.ClickByName("Emulator Menu Item"); // connect to the created printer testRunner.ClickByName("Connect to printer button"); testRunner.WaitForName("Disconnect from printer button"); // Access through static instance must occur after Connect has occurred and the port has spun up Emulator.Instance.RunSlow = runSlow; return(Emulator.Instance); }
public static void AddAndSelectPrinter(this AutomationRunner testRunner, string make, string model) { SystemWindow systemWindow; testRunner.GetWidgetByName("Start Tab", out systemWindow, 10); // make sure we wait for MC to be up and running testRunner.WaitforDraw(systemWindow); // If SelectMake is not visible and the ConnectionWizard is, click Skip if (!testRunner.NameExists("Select Make", 0.1)) { if (!testRunner.NameExists("Create Printer", 0.1)) { // go to the start page testRunner.ClickByName("Start Tab"); } testRunner.ClickByName("Create Printer"); } testRunner.ClickByName("Select Make"); testRunner.WaitFor(() => testRunner.WidgetExists <PopupWidget>()); testRunner.Type(make); testRunner.Type("{Enter}"); testRunner.WaitFor(() => !testRunner.WidgetExists <PopupWidget>()); testRunner.ClickByName("Select Model"); testRunner.WaitFor(() => testRunner.WidgetExists <PopupWidget>()); testRunner.Type(model); testRunner.Type("{Enter}"); testRunner.WaitFor(() => !testRunner.WidgetExists <PopupWidget>()); // An unpredictable period of time will pass between Clicking Save, everything reloading and us returning to the caller. // Block until ReloadAll has completed then close and return to the caller, at which point hopefully everything is reloaded. testRunner.ClickByName("Save & Continue Button"); testRunner.WaitFor(() => testRunner.WidgetExists <SetupStepComPortOne>()); testRunner.ClickByName("Cancel Wizard Button"); testRunner.WaitFor(() => !testRunner.WidgetExists <SetupStepComPortOne>()); }
public static void WaitForFirstDraw(this AutomationRunner testRunner) { testRunner.GetWidgetByName("WidescreenPanel", out SystemWindow systemWindow, 10); // make sure we wait for MC to be up and running testRunner.WaitforDraw(systemWindow); }