public void PrinterNameStaysChanged() { // Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); // Now do the actions specific to this test. (replace this for new tests) { MatterControlUtilities.PrepForTestRun(testRunner); MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD"); MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness); resultsHarness.AddTestResult(testRunner.ClickByName("Printer Tab", 1), "Click Printer Tab"); string widgetName = "Printer Name Edit"; testRunner.ClickByName(widgetName); SystemWindow window; var textWidget = testRunner.GetWidgetByName(widgetName, out window); string newName = "Updated name"; textWidget.Text = newName; testRunner.ClickByName("Printer Tab", 1); testRunner.Wait(4); //Check to make sure the Printer dropdown gets the name change testRunner.ClickByName("Printers... Menu", 2); testRunner.Wait(1); resultsHarness.AddTestResult(testRunner.NameExists(newName + " Menu Item"), "Widget with updated printer name exists"); //Make sure the Active profile name changes as well resultsHarness.AddTestResult(ProfileManager.Instance.ActiveProfile.Name == newName, "ActiveProfile has updated name"); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun); Assert.IsTrue(testHarness.AllTestsPassed(5)); }
public static void SwitchToAdvancedSettings(AutomationRunner testRunner, AutomationTesterHarness resultsHarness) { if (testRunner.NameExists("SettingsAndControls")) { testRunner.ClickByName("SettingsAndControls", 1); testRunner.Wait(.5); } resultsHarness.AddTestResult(testRunner.ClickByName("User Level Dropdown", 1), "Click Settings Mode dropdown"); resultsHarness.AddTestResult(testRunner.ClickByName("Advanced Menu Item", 1), "Click 'Advanced' settings"); testRunner.Wait(.5); }
public static void SwitchToAdvancedSettings(AutomationRunner testRunner) { if (testRunner.NameExists("SettingsAndControls")) { testRunner.ClickByName("SettingsAndControls", 1); testRunner.Wait(.5); } testRunner.ClickByName("User Level Dropdown", 1); testRunner.ClickByName("Advanced Menu Item", 1); testRunner.Wait(.5); }
public static void AddAndSelectPrinter(AutomationRunner testRunner, string make, string model) { if (!testRunner.NameExists("Select Make")) { testRunner.ClickByName("Printers... Menu", 2, delayBeforeReturn: .5); testRunner.ClickByName("Add New Printer... Menu Item", 5, delayBeforeReturn: .5); } testRunner.ClickByName("Select Make", 5); testRunner.Type(make); testRunner.Type("{Enter}"); testRunner.ClickByName("Select Model", 5); testRunner.Type(model); testRunner.Type("{Enter}"); // 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. WaitForReloadAll(testRunner, () => testRunner.ClickByName("Save & Continue Button", 2)); testRunner.ClickByName("Cancel Wizard Button", 5); testRunner.Wait(1); }
public void MatterControlRuns() { Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(); { MatterControlUtilities.PrepForTestRun(testRunner, MatterControlUtilities.PrepAction.CloseSignInAndPrinterSelect); resultsHarness.AddTestResult(testRunner.NameExists("SettingsAndControls")); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, maxTimeToRun: 200); Assert.IsTrue(testHarness.AllTestsPassed(1)); }