Fix test project build breaks

This commit is contained in:
John Lewin 2018-11-12 14:45:53 -08:00
parent 1114e5ef81
commit cbc856f1c5
3 changed files with 53 additions and 41 deletions

View file

@ -1,5 +1,7 @@
using System.Threading;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MatterHackers.MatterControl.PartPreviewWindow;
using MatterHackers.MatterControl.SlicerConfiguration;
using NUnit.Framework;
@ -18,23 +20,34 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.AddAndSelectPrinter("Airwolf 3D", "HD");
Assert.AreEqual(1, ApplicationController.Instance.ActivePrinters.Count, "One printer should exist after add");
testRunner.SwitchToPrinterSettings();
// Change the printer name
string newName = "Updated name";
testRunner.InlineTitleEdit("Printer Name", newName);
testRunner.WaitFor(() => newName == ProfileManager.Instance.ActiveProfile.Name);
var printer = ApplicationController.Instance.ActivePrinters.First();
string printerID = printer.Settings.ID;
// Wait for change
testRunner.WaitFor(() => newName == ProfileManager.Instance[printerID].Name);
// Validate that the model reflects the new name
Assert.AreEqual(newName, ProfileManager.Instance.ActiveProfile.Name, "ActiveProfile has updated name");
Assert.AreEqual(newName, ProfileManager.Instance[printerID].Name, "ActiveProfile has updated name");
// Validate that the treeview reflects the new name
testRunner.SwitchToHardwareTab();
Assert.IsTrue(testRunner.WaitForName(newName + " Node"), "Widget with updated printer name exists");
// Validate that the tab reflects the new name
var printerTab = testRunner.GetWidgetByName("3D View Tab", out _);
Assert.AreEqual(newName, printerTab.Text);
var printerTab = testRunner.GetWidgetByName("3D View Tab", out _) as ChromeTab;
Assert.AreEqual(newName, printerTab.Title);
// Validate that the settings layer reflects the new name
Assert.AreEqual(newName, printer.Settings.GetValue(SettingsKey.printer_name));
return Task.CompletedTask;
});