2016-09-21 15:34:53 -07:00
|
|
|
|
using System;
|
2016-01-13 17:02:41 -08:00
|
|
|
|
using System.Diagnostics;
|
2016-05-11 09:13:56 -07:00
|
|
|
|
using System.IO;
|
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;
|
|
|
|
|
|
using MatterHackers.GuiAutomation;
|
|
|
|
|
|
using NUnit.Framework;
|
2016-05-11 09:13:56 -07:00
|
|
|
|
|
|
|
|
|
|
namespace MatterHackers.MatterControl.Tests.Automation
|
2016-01-13 17:02:41 -08:00
|
|
|
|
{
|
2016-10-25 06:17:37 -07:00
|
|
|
|
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
|
2016-12-02 11:36:23 -08:00
|
|
|
|
public class ExportGcodeFromExportWindow
|
2016-01-13 17:02:41 -08:00
|
|
|
|
{
|
2016-12-02 11:36:23 -08:00
|
|
|
|
[Test, Apartment(ApartmentState.STA)]
|
2016-10-25 06:17:37 -07:00
|
|
|
|
public async Task ExportAsGcode()
|
2016-01-13 17:02:41 -08:00
|
|
|
|
{
|
2016-10-25 06:17:37 -07:00
|
|
|
|
AutomationTest testToRun = (testRunner) =>
|
2016-01-13 17:02:41 -08:00
|
|
|
|
{
|
2016-10-26 08:35:51 -07:00
|
|
|
|
testRunner.CloseSignInAndPrinterSelect();
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2017-06-04 09:01:56 -07:00
|
|
|
|
testRunner.AddAndSelectPrinter("Airwolf 3D", "HD");
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2016-12-02 11:36:23 -08:00
|
|
|
|
string firstItemName = "Queue Item Batman";
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Navigate to Downloads Library Provider
|
|
|
|
|
|
testRunner.ClickByName("Queue Tab");
|
|
|
|
|
|
testRunner.ClickByName("Queue Add Button", 2);
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Get parts to add
|
|
|
|
|
|
string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl");
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2016-10-25 06:17:37 -07:00
|
|
|
|
//Add STL part items to Downloads and then type paths into file dialog
|
2017-02-01 10:12:31 -08:00
|
|
|
|
testRunner.Delay(1);
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.stl"));
|
2017-02-01 10:12:31 -08:00
|
|
|
|
testRunner.Delay(1);
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Type("{Enter}");
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
//Get test results
|
2016-10-25 06:17:37 -07:00
|
|
|
|
Assert.IsTrue(testRunner.WaitForName(firstItemName, 2) == true);
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.ClickByName("Queue Export Button");
|
2017-02-01 10:12:31 -08:00
|
|
|
|
testRunner.Delay(2);
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.WaitForName("Export Item Window", 2);
|
|
|
|
|
|
testRunner.ClickByName("Export as GCode Button", 2);
|
2017-02-01 10:12:31 -08:00
|
|
|
|
testRunner.Delay(2);
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2016-12-02 11:36:23 -08:00
|
|
|
|
string gcodeOutputPath = MatterControlUtilities.PathToExportGcodeFolder;
|
|
|
|
|
|
|
|
|
|
|
|
Directory.CreateDirectory(gcodeOutputPath);
|
|
|
|
|
|
|
|
|
|
|
|
string fullPathToGcodeFile = Path.Combine(gcodeOutputPath, "Batman");
|
|
|
|
|
|
testRunner.Type(fullPathToGcodeFile);
|
2016-10-19 11:10:30 -07:00
|
|
|
|
testRunner.Type("{Enter}");
|
2017-02-01 10:12:31 -08:00
|
|
|
|
testRunner.Delay(2);
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2016-12-02 11:36:23 -08:00
|
|
|
|
Console.WriteLine(gcodeOutputPath);
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2016-12-02 11:36:23 -08:00
|
|
|
|
Assert.IsTrue(File.Exists(fullPathToGcodeFile + ".gcode") == true);
|
2016-10-25 06:17:37 -07:00
|
|
|
|
|
2017-06-04 08:35:29 -07:00
|
|
|
|
return Task.CompletedTask;
|
2016-01-13 17:02:41 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
2016-10-25 06:17:37 -07:00
|
|
|
|
await MatterControlUtilities.RunTest(testToRun);
|
2016-01-13 17:02:41 -08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|