Fix QueueAddButtonAddsAMF test
- Rename to AddAmfFile - Update to new format - Remove testToRun variable, pass lambda directly - Issue MatterHackers/MCCentral#1504
This commit is contained in:
parent
51abfc527a
commit
addd88986a
1 changed files with 21 additions and 23 deletions
|
|
@ -172,7 +172,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task AddOneItemToQueue()
|
||||
{
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
await MatterControlUtilities.RunTest((testRunner) =>
|
||||
{
|
||||
// Expected = initial + 1
|
||||
int expectedCount = QueueData.Instance.ItemCount + 1;
|
||||
|
|
@ -196,15 +196,13 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
Assert.IsTrue(testRunner.WaitForName("Row Item Fennec_Fox.stl", 2), "Named widget should exist after add(Fennec_Fox)");
|
||||
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
});
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task AddTwoItemsToQueue()
|
||||
{
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
await MatterControlUtilities.RunTest((testRunner) =>
|
||||
{
|
||||
// Expected = initial + 2;
|
||||
int expectedCount = QueueData.Instance.ItemCount + 2;
|
||||
|
|
@ -217,8 +215,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
testRunner.ClickByName("Library Add Button", 2);
|
||||
testRunner.WaitForName("Automation Dialog TextEdit", 3);
|
||||
testRunner.Type(string.Format(
|
||||
"\"{0}\" \"{1}\"",
|
||||
MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"),
|
||||
"\"{0}\" \"{1}\"",
|
||||
MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"),
|
||||
MatterControlUtilities.GetTestItemPath("Batman.stl")));
|
||||
|
||||
testRunner.Delay(2);
|
||||
|
|
@ -233,9 +231,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
Assert.IsTrue(testRunner.WaitForName("Row Item Batman.stl", 2), "Named widget should exist after add(Batman)");
|
||||
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -725,32 +721,34 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public async Task QueueAddButtonAddsAMF()
|
||||
public async Task AddAmfFile()
|
||||
{
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
await MatterControlUtilities.RunTest((testRunner) =>
|
||||
{
|
||||
// Expected = initial + 1
|
||||
int expectedCount = QueueData.Instance.ItemCount + 1;
|
||||
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
int initialQueueCount = QueueData.Instance.ItemCount;
|
||||
testRunner.ChangeToQueueContainer();
|
||||
|
||||
// Click Add button
|
||||
testRunner.ClickByName("Queue Add Button");
|
||||
testRunner.Delay(1);
|
||||
// Click Add button and select files
|
||||
testRunner.ClickByName("Library Add Button", 2);
|
||||
testRunner.WaitForName("Automation Dialog TextEdit", 3);
|
||||
|
||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("Rook.amf"));
|
||||
testRunner.Delay(1);
|
||||
testRunner.Type("{Enter}");
|
||||
|
||||
// Widget should exist
|
||||
Assert.IsTrue(testRunner.WaitForName("Queue Item Rook", 5), "Widget for added item should exist in control tree");
|
||||
// Wait up to 3 seconds for expected outcome
|
||||
testRunner.Delay(() => QueueData.Instance.ItemCount == expectedCount, 3);
|
||||
|
||||
// Queue count should increases by one
|
||||
Assert.AreEqual(initialQueueCount + 1, QueueData.Instance.ItemCount, "After adding item, queue count should increase by one");
|
||||
// Assert - one part added and queue count increases by one
|
||||
Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should increase by 1 when adding 1 item");
|
||||
Assert.IsTrue(testRunner.WaitForName("Row Item Rook.amf", 2), "Named widget should exist after add(Rook)");
|
||||
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
await MatterControlUtilities.RunTest(testToRun);
|
||||
});
|
||||
}
|
||||
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue