2016-09-21 15:34:53 -07:00
|
|
|
|
using System;
|
2016-10-18 07:54:01 -07:00
|
|
|
|
using System.Diagnostics;
|
2016-09-21 15:34:53 -07:00
|
|
|
|
using System.Threading;
|
2016-10-25 06:17:37 -07:00
|
|
|
|
using System.Threading.Tasks;
|
2016-09-21 15:34:53 -07:00
|
|
|
|
using MatterHackers.Agg.UI.Tests;
|
2016-05-11 09:13:56 -07:00
|
|
|
|
using MatterHackers.GuiAutomation;
|
2016-02-01 17:20:18 -08:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
2016-05-11 09:13:56 -07:00
|
|
|
|
namespace MatterHackers.MatterControl.Tests.Automation
|
2016-02-01 17:20:18 -08:00
|
|
|
|
{
|
2016-05-11 09:13:56 -07:00
|
|
|
|
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
2016-02-01 17:20:18 -08:00
|
|
|
|
public class HardwareLevelingUITests
|
|
|
|
|
|
{
|
2016-10-25 06:17:37 -07:00
|
|
|
|
[Test, Apartment(ApartmentState.STA)]
|
|
|
|
|
|
public async Task HasHardwareLevelingHidesLevelingSettings()
|
2016-02-01 17:20:18 -08:00
|
|
|
|
{
|
2016-10-25 06:17:37 -07:00
|
|
|
|
AutomationTest testToRun = (testRunner) =>
|
2016-02-01 17:20:18 -08:00
|
|
|
|
{
|
2016-10-26 08:35:51 -07:00
|
|
|
|
testRunner.CloseSignInAndPrinterSelect();
|
|
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Add printer that has hardware leveling
|
|
|
|
|
|
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
2016-02-01 17:20:18 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
|
2016-09-20 14:32:22 -07:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.ClickByName("Printer Tab", 1);
|
2017-02-01 10:12:31 -08:00
|
|
|
|
testRunner.Delay(1);
|
2016-02-01 17:20:18 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Make sure Print Leveling tab is not visible
|
|
|
|
|
|
bool testPrintLeveling = testRunner.WaitForName("Print Leveling Tab", 3);
|
2016-10-25 06:17:37 -07:00
|
|
|
|
Assert.IsTrue(testPrintLeveling == false);
|
2016-02-01 17:20:18 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Add printer that does not have hardware leveling
|
|
|
|
|
|
MatterControlUtilities.AddAndSelectPrinter(testRunner, "3D Factory", "MendelMax 1.5");
|
2016-09-20 14:32:22 -07:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.ClickByName("Slice Settings Tab", 1);
|
2016-09-20 14:32:22 -07:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.ClickByName("Printer Tab", 1);
|
2016-02-01 17:20:18 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Make sure Print Leveling tab is visible
|
|
|
|
|
|
bool printLevelingVisible = testRunner.WaitForName("Print Leveling Tab", 2);
|
2016-10-25 06:17:37 -07:00
|
|
|
|
Assert.IsTrue(printLevelingVisible == true);
|
|
|
|
|
|
|
|
|
|
|
|
return Task.FromResult(0);
|
2016-02-01 17:20:18 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
2016-10-25 06:17:37 -07:00
|
|
|
|
await MatterControlUtilities.RunTest(testToRun, overrideHeight: 800);
|
2016-02-01 17:20:18 -08:00
|
|
|
|
}
|
2016-09-26 15:59:29 -07:00
|
|
|
|
|
2017-01-19 12:35:33 -08:00
|
|
|
|
[Test, Apartment(ApartmentState.STA)]
|
2016-10-25 06:17:37 -07:00
|
|
|
|
public async Task SoftwareLevelingRequiredCorrectWorkflow()
|
2016-09-26 15:59:29 -07:00
|
|
|
|
{
|
2016-10-25 06:17:37 -07:00
|
|
|
|
AutomationTest testToRun = (testRunner) =>
|
2016-09-26 15:59:29 -07:00
|
|
|
|
{
|
2016-10-26 08:35:51 -07:00
|
|
|
|
testRunner.CloseSignInAndPrinterSelect();
|
2016-09-26 15:59:29 -07:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
// make a jump start printer
|
2017-01-10 13:43:12 -08:00
|
|
|
|
using (var emulatorProcess = testRunner.LaunchAndConnectToPrinterEmulator("JumpStart", "V1", runSlow: false))
|
2016-10-19 11:10:30 -07:00
|
|
|
|
{
|
2017-01-10 13:43:12 -08:00
|
|
|
|
// make sure it is showing the correct button
|
|
|
|
|
|
Assert.IsTrue(!testRunner.WaitForName("Start Print Button", .5), "Start Print hidden");
|
|
|
|
|
|
Assert.IsTrue(testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup showing");
|
|
|
|
|
|
|
|
|
|
|
|
// do print leveling
|
2016-09-26 15:59:29 -07:00
|
|
|
|
testRunner.ClickByName("Next Button", .5);
|
|
|
|
|
|
testRunner.ClickByName("Next Button", .5);
|
|
|
|
|
|
testRunner.ClickByName("Next Button", .5);
|
2017-01-10 13:43:12 -08:00
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
testRunner.ClickByName("Move Z positive", .5);
|
|
|
|
|
|
testRunner.ClickByName("Next Button", .5);
|
|
|
|
|
|
testRunner.ClickByName("Next Button", .5);
|
|
|
|
|
|
testRunner.ClickByName("Next Button", .5);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
testRunner.ClickByName("Done Button", 1);
|
|
|
|
|
|
|
|
|
|
|
|
// make sure the button has changed to start print
|
|
|
|
|
|
Assert.IsTrue(testRunner.WaitForName("Start Print Button", 5), "Start Print showing");
|
|
|
|
|
|
Assert.IsTrue(!testRunner.WaitForName("Finish Setup Button", 1), "Finish Setup hidden");
|
|
|
|
|
|
|
|
|
|
|
|
// reset to defaults and make sure print leveling is cleared
|
|
|
|
|
|
MatterControlUtilities.SwitchToAdvancedSettings(testRunner);
|
|
|
|
|
|
|
|
|
|
|
|
testRunner.ClickByName("Slice Settings Options Menu", 1);
|
2017-01-19 12:35:33 -08:00
|
|
|
|
testRunner.ClickByName("Reset to Defaults Menu Item", 1);
|
2017-01-10 13:43:12 -08:00
|
|
|
|
testRunner.ClickByName("Yes Button", .5);
|
2017-02-01 10:12:31 -08:00
|
|
|
|
testRunner.Delay(1);
|
2017-01-10 13:43:12 -08:00
|
|
|
|
|
|
|
|
|
|
// make sure it is showing the correct button
|
|
|
|
|
|
Assert.IsTrue(!testRunner.WaitForName("Start Print Button", 1), "Start Print hidden");
|
|
|
|
|
|
Assert.IsTrue(testRunner.WaitForName("Finish Setup Button", 1), "Finish Setup showing");
|
2017-01-10 12:24:01 -08:00
|
|
|
|
}
|
2016-09-26 15:59:29 -07:00
|
|
|
|
|
2017-01-10 12:24:01 -08:00
|
|
|
|
return Task.FromResult(0);
|
2016-10-25 06:17:37 -07:00
|
|
|
|
};
|
2016-09-26 15:59:29 -07:00
|
|
|
|
|
2016-10-25 06:17:37 -07:00
|
|
|
|
await MatterControlUtilities.RunTest(testToRun);
|
2016-09-26 15:59:29 -07:00
|
|
|
|
}
|
2016-02-01 17:20:18 -08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|