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-10-19 11:10:30 -07:00
|
|
|
|
//Navigate to Downloads Library Provider
|
2017-08-30 13:41:49 -07:00
|
|
|
|
testRunner.NavigateToFolder("Print Queue Row Item Collection");
|
|
|
|
|
|
testRunner.ClickByName("Library Add Button");
|
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
|
2017-08-30 13:41:49 -07:00
|
|
|
|
testRunner.ClickByName("Row Item Batman.stl");
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2017-08-30 13:41:49 -07:00
|
|
|
|
testRunner.ClickByName("Print Library Overflow Menu");
|
|
|
|
|
|
testRunner.ClickByName("Export Menu Item");
|
2017-02-01 10:12:31 -08:00
|
|
|
|
testRunner.Delay(2);
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2017-06-14 10:05:39 -07:00
|
|
|
|
testRunner.WaitForName("Export Item Window");
|
2017-08-30 13:41:49 -07:00
|
|
|
|
testRunner.ClickByName("Machine File (G-Code) Button");
|
|
|
|
|
|
testRunner.ClickByName("Export Button");
|
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}");
|
2016-01-13 17:02:41 -08:00
|
|
|
|
|
2017-06-27 14:45:15 -07:00
|
|
|
|
testRunner.Delay(() => File.Exists(fullPathToGcodeFile + ".gcode"), 10);
|
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-27 14:45:15 -07:00
|
|
|
|
return Task.FromResult(0);
|
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
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|