mattercontrol/Tests/MatterControl.AutomationTests/ExportItemWindowTests.cs

68 lines
2 KiB
C#
Raw Normal View History

using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using MatterHackers.Agg.UI.Tests;
using MatterHackers.GuiAutomation;
using NUnit.Framework;
namespace MatterHackers.MatterControl.Tests.Automation
{
[TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain]
public class ExportGcodeFromExportWindow
{
[Test, Apartment(ApartmentState.STA)]
public async Task ExportAsGcode()
{
AutomationTest testToRun = (testRunner) =>
{
testRunner.CloseSignInAndPrinterSelect();
testRunner.AddAndSelectPrinter("Airwolf 3D", "HD");
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-10-19 11:10:30 -07:00
//Get parts to add
string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl");
//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-10-19 11:10:30 -07:00
//Get test results
2017-08-30 13:41:49 -07:00
testRunner.ClickByName("Row Item Batman.stl");
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);
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);
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-06-27 14:45:15 -07:00
testRunner.Delay(() => File.Exists(fullPathToGcodeFile + ".gcode"), 10);
Assert.IsTrue(File.Exists(fullPathToGcodeFile + ".gcode") == true);
2017-06-27 14:45:15 -07:00
return Task.FromResult(0);
};
await MatterControlUtilities.RunTest(testToRun);
}
}
}