fixing tests

This commit is contained in:
LarsBrubaker 2022-02-06 08:22:31 -08:00
parent 1cd32a9afd
commit d59b872737
14 changed files with 146 additions and 60 deletions

View file

@ -14,23 +14,20 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
await MatterControlUtilities.RunTest(testRunner =>
{
testRunner.WaitForFirstDraw();
testRunner.AddAndSelectPrinter("Airwolf 3D", "HD");
//Navigate to Downloads Library Provider
testRunner.NavigateToFolder("Print Queue Row Item Collection");
testRunner.InvokeLibraryAddDialog();
testRunner.WaitForFirstDraw()
.AddAndSelectPrinter("Airwolf 3D", "HD")
//Navigate to Downloads Library Provider
.NavigateToFolder("Print Queue Row Item Collection")
.InvokeLibraryAddDialog();
//Get parts to add
string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl");
testRunner.Delay()
.Type(MatterControlUtilities.GetTestItemPath("Batman.stl"))
.Delay()
.Type("{Enter}");
//Get test results
testRunner.ClickByName("Row Item Batman.stl")
.Type("{Enter}")
//Get test results
.ClickByName("Row Item Batman.stl")
.ClickByName("Print Library Overflow Menu")
.ClickByName("Export Menu Item")
.WaitForName("Export Item Window");
@ -44,20 +41,16 @@ namespace MatterHackers.MatterControl.Tests.Automation
.Delay()
.Type(fullPathToGcodeFile)
.Type("{Enter}")
.WaitFor(() => File.Exists(fullPathToGcodeFile + ".gcode"), 10);
.Assert(() => File.Exists(fullPathToGcodeFile + ".gcode"), "Exported file not found");
Assert.IsTrue(File.Exists(fullPathToGcodeFile + ".gcode"), "Exported file not found");
// add an item to the bed
// add an item to the bed, and export it to gcode
fullPathToGcodeFile = Path.Combine(gcodeOutputPath, "Cube");
testRunner.AddItemToBed()
.ClickByName("PrintPopupMenu")
.ClickByName("Export GCode Button")
.Type(fullPathToGcodeFile)
.Type("{Enter}")
.Delay();
Assert.IsTrue(File.Exists(fullPathToGcodeFile + ".gcode"), "Exported file not found");
.Assert(() => File.Exists(fullPathToGcodeFile + ".gcode"), "Exported file not found");
return Task.FromResult(0);
});

View file

@ -86,7 +86,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.DoubleClickByName("Test.zip Row Item Collection");
testRunner.DoubleClickByName("TestCompress Row Item Collection");
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");

View file

@ -115,9 +115,9 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Delay(1);
testRunner.Type("{Enter}");
testRunner.WaitForName("Batman Row Item Collection");
testRunner.WaitForName("Batman.zip Row Item Collection");
testRunner.DoubleClickByName("Batman Row Item Collection");
testRunner.DoubleClickByName("Batman.zip Row Item Collection");
Assert.IsTrue(testRunner.WaitForName("Row Item Batman.stl"), "Batman part should exist after adding");
Assert.IsTrue(testRunner.WaitForName("Row Item 2013-01-25_Mouthpiece_v2.stl"), "Mouthpiece part should exist after adding");

View file

@ -71,6 +71,36 @@ namespace MatterHackers.MatterControl.Tests.Automation
}, overrideWidth: 1300, maxTimeToRun: 60);
}
[Test]
public async Task AddMultiplePartsMultipleTimes()
{
await MatterControlUtilities.RunTest((testRunner) =>
{
testRunner.OpenPartTab();
var parts = new[]
{
"Row Item Cone",
"Row Item Sphere",
"Row Item Torus"
};
testRunner.AddPrimitivePartsToBed(parts, multiSelect: true);
var view3D = testRunner.GetWidgetByName("View3DWidget", out _, 3) as View3DWidget;
var scene = view3D.Object3DControlLayer.Scene;
testRunner.WaitForName("Selection");
Assert.AreEqual(1, scene.Children.Count, $"Should have 1 scene item after first AddToBed");
testRunner.ClickByName("Print Library Overflow Menu");
testRunner.ClickByName("Add to Bed Menu Item");
testRunner.WaitForName("Selection");
Assert.AreEqual(parts.Length + 1, scene.Children.Count, $"Should have {parts.Length + 1} scene items after second AddToBed");
return Task.CompletedTask;
}, overrideWidth: 1300, maxTimeToRun: 60);
}
[Test]
public async Task DesignTabFileOpperations()
{
@ -252,6 +282,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
.NavigateToLibraryHome()
.NavigateToFolder("Print Queue Row Item Collection");
testRunner.Delay(200);
Assert.IsTrue(testRunner.WaitForName("Row Item Test PartA"), "The part we added should be in the library");
Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should increase by one after Save operation");

View file

@ -144,7 +144,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.NavigateToFolder("Print Queue Row Item Collection");
// Select both items
testRunner.SelectListItems("Row Item Batman", "Row Item 2013-01-25_Mouthpiece_v2");
testRunner.SelectListItems("Row Item Batman.stl", "Row Item 2013-01-25_Mouthpiece_v2.stl");
// Remove items
testRunner.LibraryRemoveSelectedItem();
@ -153,8 +153,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should decrease by two after clicking Remove");
// Make sure both selected items are removed
Assert.IsFalse(testRunner.WaitForName("Row Item Batman", .5), "Batman part should *not* exist after remove");
Assert.IsFalse(testRunner.WaitForName("Row Item 2013-01-25_Mouthpiece_v2", .5), "Mouthpiece part should *not* exist after remove");
Assert.IsFalse(testRunner.WaitForName("Row Item Batman.stl", .5), "Batman part should *not* exist after remove");
Assert.IsFalse(testRunner.WaitForName("Row Item 2013-01-25_Mouthpiece_v2.stl", .5), "Mouthpiece part should *not* exist after remove");
return Task.CompletedTask;
}, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);

View file

@ -33,6 +33,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MatterHackers.Agg;
using MatterHackers.Agg.Platform;
using MatterHackers.Agg.UI;
using MatterHackers.DataConverters3D;
using MatterHackers.GuiAutomation;
@ -48,6 +49,13 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
private const string CoinName = "MatterControl - Coin.stl";
[SetUp]
public void TestSetup()
{
StaticData.RootPath = TestContext.CurrentContext.ResolveProjectPath(4, "StaticData");
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
}
[Test]
public async Task CopyRemoveUndoRedo()
{