Making a function to prep MatterControl prior to runing tests.

Made automation tests call it.
This commit is contained in:
Lars Brubaker 2016-07-29 16:44:00 -07:00
parent c427edbcb1
commit d8138ac51e
17 changed files with 95 additions and 29 deletions

View file

@ -48,6 +48,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
// Now do the actions specific to this test. (replace this for new tests)
{
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("Library Tab", 3);
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
@ -76,7 +78,6 @@ namespace MatterHackers.MatterControl.Tests.Automation
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

View file

@ -48,6 +48,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
// Now do the actions specific to this test. (replace this for new tests)
{
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
testRunner.ClickByName("Create Folder From Library Button");

View file

@ -19,6 +19,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD", true);

View file

@ -17,6 +17,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("File Menu");
testRunner.Wait(1);
@ -44,6 +45,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("File Menu");
testRunner.Wait(1);
@ -80,6 +82,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("File Menu");
testRunner.Wait(1);
@ -120,6 +123,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("File Menu");
testRunner.Wait(1);
@ -146,9 +150,5 @@ namespace MatterHackers.MatterControl.Tests.Automation
Assert.IsTrue(testHarness.AllTestsPassed);
Assert.IsTrue(testHarness.TestCount == 3); // make sure we ran all our tests
}
}
}

View file

@ -16,6 +16,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Add printer that has hardware leveling
MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD", true);

View file

@ -17,6 +17,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.CreateDownloadsSubFolder();
//Navigate to Downloads Library Provider
@ -72,6 +73,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.CreateDownloadsSubFolder();
@ -125,9 +127,9 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.CreateDownloadsSubFolder();
//Navigate to Downloads Library Provider
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
@ -179,6 +181,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.CreateDownloadsSubFolder();
@ -201,8 +204,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Type("Batman Renamed");
testRunner.ClickByName("Rename Button");
resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Batman Renamed", 2) == true);
MatterControlUtilities.CloseMatterControl(testRunner);
}
};
@ -237,6 +239,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.CreateDownloadsSubFolder();

View file

@ -17,6 +17,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
string itemName = "Row Item " + "Fennec Fox";
@ -64,6 +65,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Names of Items to be added
string firstItemName = "Row Item " + "Fennec Fox";
string secondItemName = "Row Item " + "Batman";
@ -120,6 +122,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
string itemName = "Row Item " + "Rook";
@ -167,6 +170,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Items in Batman.zip
string firstItemName = "Row Item " + "Batman";
@ -220,6 +224,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate To Local Library
testRunner.ClickByName("Library Tab");
@ -270,6 +275,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
@ -319,6 +325,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
@ -358,6 +365,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
@ -400,6 +408,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
@ -461,6 +470,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
@ -524,6 +534,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
@ -602,6 +613,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");

View file

@ -17,6 +17,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("SettingsAndControls", 5);
testRunner.Wait(2);
testRunner.ClickByName("Options Tab", 6);
@ -56,6 +57,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("SettingsAndControls", 5);
testRunner.ClickByName("Options Tab", 6);

View file

@ -20,6 +20,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
SystemWindow systemWindow;
@ -76,6 +77,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
SystemWindow systemWindow;
@ -139,6 +141,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
SystemWindow systemWindow;
@ -197,6 +200,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
SystemWindow systemWindow;
@ -271,6 +275,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
SystemWindow systemWindow;
@ -337,6 +342,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
@ -393,6 +399,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Local Library
testRunner.ClickByName("Library Tab");
@ -449,6 +456,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Navigate to Downloads
testRunner.ClickByName("Library Tab");

View file

@ -48,6 +48,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
//Make sure image does not exist before we click the buy button
testRunner.MatchLimit = 500000;
@ -82,10 +83,9 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
/*
* Tests that clicking the create button opens create tools plugin window
*/
MatterControlUtilities.PrepForTestRun(testRunner);
// Tests that clicking the create button opens create tools plugin window
MatterControlUtilities.PrepForTestRun(testRunner);
//Make sure that plugin window does not exist
bool pluginWindowExists1 = testRunner.WaitForName("Plugin Chooser Window", 0);
@ -125,10 +125,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
/*
* Tests that clicking the queue export button with a single item selected opens export item window
*/
// Tests that clicking the queue export button with a single item selected opens export item window
MatterControlUtilities.PrepForTestRun(testRunner);
//Make sure that the export window does not exist
bool exportWindowExists1 = testRunner.WaitForName( "Export Item Window", 0);
@ -167,7 +165,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
//bool exportButtonExists = testRunner.NameExists("Export Queue Button");
bool exportButtonExists = testRunner.WaitForName("Export Queue Button", 10);
testRunner.Wait(5);
@ -194,10 +193,9 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
/*
* Tests that clicking a queue item thumbnail opens a Part Preview window
*/
MatterControlUtilities.PrepForTestRun(testRunner);
// Tests that clicking a queue item thumbnail opens a Part Preview window
bool partPreviewWindowExists1 = testRunner.WaitForName("Part Preview Window Thumbnail", 0);
resultsHarness.AddTestResult(partPreviewWindowExists1 == false, "Part Preview Window Does Not Exist");
@ -231,11 +229,11 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
/* Tests that when the Queue Copy button is clicked:
* 1. The Queue Tab Count is increased by one
* 2. A Queue Row item is created and added to the queue with the correct name
*/
*/
int queueCountBeforeCopyButtonIsClicked = QueueData.Instance.Count;
bool copyIncreasesQueueDataCount = false;
@ -277,6 +275,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
/*
* Tests that Queue Add button adds a single part to queue:
@ -342,6 +341,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
/*
* Tests that Add button can add multiple files to the print queue:
@ -413,6 +413,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
/*
*Tests that when one item is selected
*1. Queue Item count equals three before the test starts
@ -471,6 +472,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
/*
*Tests that when the edit button is clicked we go into editmode (print queue items have checkboxes on them)
*1. After Edit button is clicked print queue items have check boxes
@ -534,6 +536,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
/*
*Tests that when one item is selected
*1. Queue Item count equals three before the test starts
@ -598,6 +601,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
/*
*Tests that when one item is selected
*1. Queue Item count equals three before the test starts
@ -665,6 +669,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
/*
*Tests Export to Zip menu item is clicked the queue is compressed and exported to location on disk
*1. Check that there are items in the queue
@ -761,6 +766,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
/*
*Tests Export to Zip menu item is clicked the queue is compressed and exported to location on disk
*1. Check that there are items in the queue
@ -812,6 +818,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
/*
*Tests that when the Remove All menu item is clicked
*1. Queue Item count is set to zero
@ -882,6 +889,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
/*
*Tests that when the Remove All menu item is clicked
*1. Queue Item count is set to zero
@ -946,6 +954,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
/*
*Tests:
@ -1022,6 +1031,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
/* Tests that when the Queue Copy button is clicked:
* 1. QueueCount = Zero
@ -1090,6 +1100,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
/* Tests that when the Queue Copy button is clicked:
* 1. QueueCount = Zero
@ -1157,6 +1168,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
/* Tests that when the Queue Copy button is clicked:
* 1. QueueCount = Zero
@ -1221,6 +1233,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
/* Tests that when the Queue Copy button is clicked:
* 1. QueueCount = Zero

View file

@ -16,6 +16,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD", true);
//Navigate to Local Library
@ -68,6 +70,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD", true);
@ -108,6 +111,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD", true);

View file

@ -16,6 +16,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
{
AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
{
MatterControlUtilities.PrepForTestRun(testRunner);
testRunner.ClickByName("Library Tab", 5);
MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");

View file

@ -110,6 +110,22 @@ namespace MatterHackers.MatterControl.Tests.Automation
}
}
public enum PrepAction
{
CloseLoginAndPrinterSelect,
};
public static void PrepForTestRun(AutomationRunner testRunner, PrepAction preAction = PrepAction.CloseLoginAndPrinterSelect)
{
switch (preAction)
{
case PrepAction.CloseLoginAndPrinterSelect:
testRunner.ClickByName("Connection Wizard Skip Sign In Button", 5);
testRunner.ClickByName("Cancel Wizard Button", 5);
break;
}
}
public static bool CompareExpectedSliceSettingValueWithActualVaue(string sliceSetting, string expectedValue)
{
string tempFolderPath = Path.Combine("..", "..", "..", "..", "Tests", "temp");