mattercontrol/Tests/MatterControl.AutomationTests/LibraryDownloadsTest.cs

147 lines
4.4 KiB
C#
Raw Normal View History

using System;
using System.Threading;
using System.Threading.Tasks;
using MatterHackers.Agg.UI.Tests;
using MatterHackers.GuiAutomation;
using NUnit.Framework;
2022-07-15 17:28:39 -07:00
using TestInvoker;
namespace MatterHackers.MatterControl.Tests.Automation
{
2022-07-15 17:28:39 -07:00
[TestFixture, Category("MatterControl.UI.Automation")]
public class LibraryDownloadsTests
{
[SetUp]
public void Setup()
{
MatterControlUtilities.CreateDownloadsSubFolder();
}
[TearDown]
public void TearDown()
{
MatterControlUtilities.DeleteDownloadsSubFolder();
}
2022-07-15 17:28:39 -07:00
[Test, ChildProcessTest]
public async Task DownloadsAddButtonAddsMultipleFiles()
{
await MatterControlUtilities.RunTest(testRunner =>
{
2018-10-10 13:33:16 -07:00
testRunner.AddAndSelectPrinter();
2016-10-19 11:10:30 -07:00
// Navigate to Downloads Library Provider
testRunner.NavigateToFolder("Downloads Row Item Collection");
testRunner.NavigateToFolder("-Temporary Row Item Collection");
2016-10-19 11:10:30 -07:00
// Add both files to the FileOpen dialog
testRunner.InvokeLibraryAddDialog();
testRunner.CompleteDialog(
2016-10-19 11:10:30 -07:00
string.Format(
2022-07-15 17:28:39 -07:00
"\"{0}\";\"{1}\"",
2016-10-19 11:10:30 -07:00
MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"),
MatterControlUtilities.GetTestItemPath("Batman.stl")),
5);
2016-10-19 11:10:30 -07:00
Assert.IsTrue(testRunner.WaitForName("Row Item Fennec_Fox.stl", 2), "Fennec Fox item exists");
Assert.IsTrue(testRunner.WaitForName("Row Item Batman.stl", 2), "Batman item exists");
return Task.CompletedTask;
});
}
2022-07-15 17:28:39 -07:00
[Test, ChildProcessTest]
public async Task DownloadsAddButtonAddsAMFFiles()
{
await MatterControlUtilities.RunTest(testRunner =>
{
2018-10-10 13:33:16 -07:00
testRunner.AddAndSelectPrinter();
2016-10-19 11:10:30 -07:00
// Navigate to Downloads Library Provider
testRunner.NavigateToFolder("Downloads Row Item Collection");
testRunner.NavigateToFolder("-Temporary Row Item Collection");
2016-10-19 11:10:30 -07:00
2018-10-05 14:21:55 -07:00
// Add AMF part items to Downloads and then type paths into file dialog
testRunner.InvokeLibraryAddDialog();
testRunner.CompleteDialog(MatterControlUtilities.GetTestItemPath("Rook.amf"), 4);
2016-10-19 11:10:30 -07:00
Assert.IsTrue(testRunner.WaitForName("Row Item Rook.amf"), "Rook item exists");
return Task.CompletedTask;
});
}
2022-07-15 17:28:39 -07:00
[Test, ChildProcessTest]
public async Task DownloadsAddButtonAddsZipFiles()
{
await MatterControlUtilities.RunTest(testRunner =>
{
2018-10-10 13:33:16 -07:00
testRunner.AddAndSelectPrinter();
2016-10-19 11:10:30 -07:00
// Navigate to Downloads Library Provider
testRunner.NavigateToFolder("Downloads Row Item Collection");
testRunner.NavigateToFolder("-Temporary Row Item Collection");
2016-10-19 11:10:30 -07:00
testRunner.InvokeLibraryAddDialog();
testRunner.CompleteDialog(MatterControlUtilities.GetTestItemPath("Test.zip"), 4);
2016-10-19 11:10:30 -07:00
testRunner.DoubleClickByName("Test.zip Row Item Collection");
2022-02-06 08:22:31 -08:00
testRunner.DoubleClickByName("TestCompress.zip Row Item Collection");
Assert.IsTrue(testRunner.WaitForName("Row Item Chinese Dragon.stl", 2), "Chinese Dragon item exists");
Assert.IsTrue(testRunner.WaitForName("Row Item chichen-itza_pyramid.stl", 2), "chichen-itza item exists");
Assert.IsTrue(testRunner.WaitForName("Row Item Circle Calibration.stl", 2), "Circle Calibration item exists");
2016-10-19 11:10:30 -07:00
return Task.CompletedTask;
});
}
2022-07-15 17:28:39 -07:00
[Test, ChildProcessTest]
public async Task RenameDownloadsPrintItem()
{
await MatterControlUtilities.RunTest(testRunner =>
{
2018-10-10 13:33:16 -07:00
testRunner.AddAndSelectPrinter();
2016-10-19 11:10:30 -07:00
2017-12-08 18:33:44 -08:00
// Navigate to Downloads Library Provider
testRunner.NavigateToFolder("Downloads Row Item Collection");
testRunner.NavigateToFolder("-Temporary Row Item Collection");
testRunner.InvokeLibraryAddDialog();
2017-12-08 18:33:44 -08:00
testRunner.CompleteDialog(MatterControlUtilities.GetTestItemPath("Batman.stl"), 2);
2016-10-19 11:10:30 -07:00
2017-12-08 18:33:44 -08:00
// Rename added item
testRunner.ClickByName("Row Item Batman.stl");
testRunner.LibraryRenameSelectedItem();
testRunner.WaitForName("InputBoxPage Action Button");
testRunner.Type("Batman Renamed");
testRunner.ClickByName("InputBoxPage Action Button");
Assert.IsTrue(testRunner.WaitForName("Row Item Batman Renamed.stl", 2));
2016-10-19 11:10:30 -07:00
return Task.CompletedTask;
});
}
2022-07-15 17:28:39 -07:00
[Test, ChildProcessTest]
public async Task CreateFolder()
{
await MatterControlUtilities.RunTest(testRunner =>
{
2018-10-10 13:33:16 -07:00
testRunner.AddAndSelectPrinter();
2016-10-19 11:10:30 -07:00
//Navigate to Downloads Library Provider
testRunner.NavigateToFolder("Downloads Row Item Collection");
testRunner.NavigateToFolder("-Temporary Row Item Collection");
2018-10-05 14:21:55 -07:00
testRunner.CreateChildFolder("New Folder");
return Task.CompletedTask;
});
2016-09-19 17:13:00 -07:00
}
}
}