Example #1
0
        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);
        }