Improve test execution and failure reporting
This commit is contained in:
parent
887969edde
commit
e38e0eb42f
1 changed files with 43 additions and 6 deletions
|
|
@ -1,5 +1,7 @@
|
|||
using System.Threading;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.GuiAutomation;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using NUnit.Framework;
|
||||
|
|
@ -50,17 +52,52 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
Assert.IsFalse(testRunner.WaitForName("PrintPopupMenu", .5), "Start Print should not be visible if PrintLeveling is required");
|
||||
Assert.IsTrue(testRunner.WaitForName("Finish Setup Button"), "Finish Setup should be visible if PrintLeveling is required");
|
||||
|
||||
// Helper methods
|
||||
bool headerExists(string headerText)
|
||||
{
|
||||
var header = testRunner.GetWidgetByName("HeaderRow", out _);
|
||||
var textWidget = header.Children<TextWidget>().FirstOrDefault();
|
||||
|
||||
return textWidget?.Text.StartsWith(headerText) ?? false;
|
||||
}
|
||||
|
||||
void waitForPage(string headerText)
|
||||
{
|
||||
testRunner.WaitFor(() => headerExists(headerText));
|
||||
Assert.IsTrue(headerExists(headerText), "Expected page not found: " + headerText);
|
||||
}
|
||||
|
||||
void waitForPageAndAdvance(string headerText)
|
||||
{
|
||||
waitForPage(headerText);
|
||||
testRunner.ClickByName("Next Button");
|
||||
}
|
||||
|
||||
// do print leveling
|
||||
testRunner.ClickByName("Next Button");
|
||||
testRunner.ClickByName("Next Button");
|
||||
testRunner.ClickByName("Next Button");
|
||||
testRunner.ClickByName("Next Button");
|
||||
testRunner.ClickByName("Next Button");
|
||||
waitForPageAndAdvance("Initial Printer Setup");
|
||||
|
||||
waitForPageAndAdvance("Print Leveling Overview");
|
||||
|
||||
waitForPageAndAdvance("Select Material");
|
||||
|
||||
waitForPageAndAdvance("Homing The Printer");
|
||||
|
||||
waitForPageAndAdvance("Waiting For Printer To Heat");
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
var section = i * 3 + 1;
|
||||
|
||||
waitForPage($"Step {section} of 9");
|
||||
testRunner.ClickByName("Move Z positive");
|
||||
|
||||
waitForPage($"Step {section} of 9");
|
||||
testRunner.ClickByName("Next Button");
|
||||
|
||||
waitForPage($"Step {section + 1} of 9");
|
||||
testRunner.ClickByName("Next Button");
|
||||
|
||||
waitForPage($"Step {section + 2} of 9");
|
||||
testRunner.ClickByName("Next Button");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue