mattercontrol/Tests/MatterControl.AutomationTests/ExportItemWindowTests.cs

68 lines
1.9 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");
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-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
Assert.IsTrue(testRunner.WaitForName(firstItemName, 2) == true);
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-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);
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);
Console.WriteLine(gcodeOutputPath);
Assert.IsTrue(File.Exists(fullPathToGcodeFile + ".gcode") == true);
return Task.CompletedTask;
};
await MatterControlUtilities.RunTest(testToRun);
}
}
}