Fix QueueAddButtonAddsGcodeFile test
- Rename to AddGCodeFile - Update to new format - Remove testToRun variable, pass lambda directly - Issue MatterHackers/MCCentral#1504
This commit is contained in:
parent
addd88986a
commit
a1e49bb1e7
1 changed files with 15 additions and 13 deletions
|
|
@ -781,32 +781,34 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, Apartment(ApartmentState.STA)]
|
[Test, Apartment(ApartmentState.STA)]
|
||||||
public async Task QueueAddButtonAddsGcodeFile()
|
public async Task AddGCodeFile()
|
||||||
{
|
{
|
||||||
AutomationTest testToRun = (testRunner) =>
|
await MatterControlUtilities.RunTest((testRunner) =>
|
||||||
{
|
{
|
||||||
|
// Expected = initial + 1
|
||||||
|
int expectedCount = QueueData.Instance.ItemCount + 1;
|
||||||
|
|
||||||
testRunner.CloseSignInAndPrinterSelect();
|
testRunner.CloseSignInAndPrinterSelect();
|
||||||
|
|
||||||
int initialQueueCount = QueueData.Instance.ItemCount;
|
testRunner.ChangeToQueueContainer();
|
||||||
|
|
||||||
// Click Add button
|
// Click Add button and select files
|
||||||
testRunner.ClickByName("Queue Add Button");
|
testRunner.ClickByName("Library Add Button", 2);
|
||||||
testRunner.Delay(1);
|
testRunner.WaitForName("Automation Dialog TextEdit", 3);
|
||||||
|
|
||||||
testRunner.Type(MatterControlUtilities.GetTestItemPath("chichen-itza_pyramid.gcode"));
|
testRunner.Type(MatterControlUtilities.GetTestItemPath("chichen-itza_pyramid.gcode"));
|
||||||
testRunner.Delay(1);
|
testRunner.Delay(1);
|
||||||
testRunner.Type("{Enter}");
|
testRunner.Type("{Enter}");
|
||||||
|
|
||||||
// Widget should exist
|
// Wait up to 3 seconds for expected outcome
|
||||||
Assert.IsTrue(testRunner.WaitForName("Queue Item chichen-itza_pyramid", 5), "Widget for added item should exist in control tree");
|
testRunner.Delay(() => QueueData.Instance.ItemCount == expectedCount, 3);
|
||||||
|
|
||||||
// Queue count should increases by one
|
// Assert - one part added and queue count increases by one
|
||||||
Assert.AreEqual(initialQueueCount + 1, QueueData.Instance.ItemCount, "After adding item, queue count should increase by one");
|
Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should increase by 1 when adding 1 item");
|
||||||
|
Assert.IsTrue(testRunner.WaitForName("Row Item chichen-itza_pyramid.gcode", 2), "Named widget should exist after add(chichen-itza)");
|
||||||
|
|
||||||
return Task.FromResult(0);
|
return Task.FromResult(0);
|
||||||
};
|
});
|
||||||
|
|
||||||
await MatterControlUtilities.RunTest(testToRun);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue