예제 #1
0
		//DOES NOT WORK
		public void ClickingConfigureNotificationSettingsButtonOpensWindow()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{

					testRunner.ClickByName("SettingsAndControls", 5);
					testRunner.ClickByName("Options Tab", 6);

					bool printNotificationsWindowExists1 = testRunner.WaitForName("Notification Options Window", 3);
					resultsHarness.AddTestResult(printNotificationsWindowExists1 == false, "Print Notification Window does not exist");

					testRunner.ClickByName("Configure Notification Settings Button", 6);
					bool printNotificationsWindowExists2 = testRunner.WaitForName("Notification Options Window", 3);
					resultsHarness.AddTestResult(printNotificationsWindowExists2 == true, "Print Notifications Window exists after Configure button is clicked");

					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, "MC_Three_Queue_Items");

			Assert.IsTrue(testHarness.AllTestsPassed);
			Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
		}
예제 #2
0
		public void GetWidgetByNameTestRegionSingleWindow()
		{
			int leftClickCount = 0;

			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner();
				testRunner.ClickByName("left");
				testRunner.Wait(.5);
				resultsHarness.AddTestResult(leftClickCount == 1, "Got left button click");

				SearchRegion rightButtonRegion = testRunner.GetRegionByName("right");

				testRunner.ClickByName("left", searchRegion: rightButtonRegion);
				testRunner.Wait(.5);

				resultsHarness.AddTestResult(leftClickCount == 1, "Did not get left button click");
			};

			SystemWindow buttonContainer = new SystemWindow(300, 200);

			Button leftButton = new Button("left", 10, 40);
			leftButton.Name = "left";
			leftButton.Click += (sender, e) => { leftClickCount++; };
			buttonContainer.AddChild(leftButton);
			Button rightButton = new Button("right", 110, 40);
			rightButton.Name = "right";
			buttonContainer.AddChild(rightButton);

			AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(buttonContainer, testToRun, 10);

			Assert.IsTrue(testHarness.AllTestsPassed);
			Assert.IsTrue(testHarness.TestCount == 2); // make sure we can all our tests
		}
예제 #3
0
		public void ClickOnBuyButton()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUITests.DefaultTestImages);
				{

					//Make sure image does not exist before we click the buy button
					testRunner.MatchLimit = 500000;
					bool imageExists = testRunner.ImageExists("MatterHackersStoreImage.png");
					resultsHarness.AddTestResult(imageExists == false, "Web page is not open");

					//Click Buy button and test that the MatterHackers store web page is open
					testRunner.ClickByName("Buy Materials Button", secondsToWait: 5);
					bool imageExists2 = testRunner.ImageExists("MatterHackersStoreImage.png", 10);
					resultsHarness.AddTestResult(imageExists2 == true, "Web page is open");

					MatterControlUITests.CloseMatterControl(testRunner);
				}
			};

#if !__ANDROID__
				// Set the static data to point to the directory of MatterControl
				StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
#endif
				bool showWindow;
				MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
				AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 60);

				Assert.IsTrue(testHarness.AllTestsPassed);
				Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
		}
예제 #4
0
		void RemoveAllFromQueue(AutomationRunner testRunner)
		{
			Assert.IsTrue(testRunner.ClickByName("Queue... Menu"));
			testRunner.Wait(.2);
			Assert.IsTrue(testRunner.ClickByName(" Remove All Menu Item"));
			testRunner.Wait(.2);
		}
예제 #5
0
		public void ClickingShowTerminalButtonOpensTerminal()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{
					testRunner.ClickByName("SettingsAndControls", 5);
					testRunner.Wait(2);
					testRunner.ClickByName("Options Tab", 6);

					bool terminalWindowExists1 = testRunner.WaitForName("Gcode Terminal", 0);
					resultsHarness.AddTestResult(terminalWindowExists1 == false, "Terminal Window does not exist");

					testRunner.ClickByName("Show Terminal Button", 6);
					testRunner.Wait(1);

					SystemWindow containingWindow;
					GuiWidget terminalWindow = testRunner.GetWidgetByName("Gcode Terminal", out containingWindow, 3);
					resultsHarness.AddTestResult(terminalWindow != null, "Terminal Window exists after Show Terminal button is clicked");
					containingWindow.CloseOnIdle();
					testRunner.Wait(.5);

					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

			Assert.IsTrue(testHarness.AllTestsPassed);
			Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
		}
		//Test Works
		public void ClickCreateButton()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{
					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);
					resultsHarness.AddTestResult(pluginWindowExists1 == false, "Plugin window does not exist");

					testRunner.ClickByName("Design Tool Button", 5);

					//Test that the plugin window does exist after the create button is clicked
					SystemWindow containingWindow;
					GuiWidget pluginWindowExists = testRunner.GetWidgetByName("Plugin Chooser Window", out containingWindow, secondsToWait: 3);
					resultsHarness.AddTestResult(pluginWindowExists != null, "Plugin Chooser Window");
					pluginWindowExists.CloseOnIdle();
					testRunner.Wait(.5);

					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

			Assert.IsTrue(testHarness.AllTestsPassed(2));
		}
		public void CreateFolderStarsOutWithTextFiledFocusedAndEditable()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);

				// 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");

					testRunner.Wait(.5);
					testRunner.Type("Test Text");
					testRunner.Wait(.5);

					SystemWindow containingWindow;
					GuiWidget textInputWidget = testRunner.GetWidgetByName("Create Folder - Text Input", out containingWindow);
					MHTextEditWidget textWidgetMH = textInputWidget as MHTextEditWidget;
					resultsHarness.AddTestResult(textWidgetMH != null, "Found Text Widget");
					resultsHarness.AddTestResult(textWidgetMH.Text == "Test Text", "Had the right text");
					containingWindow.CloseOnIdle();
					testRunner.Wait(.5);

					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

			Assert.IsTrue(testHarness.AllTestsPassed(2));
		}
예제 #8
0
		public void FileMenuAddPrinter()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{

					testRunner.ClickByName("File Menu");
					testRunner.Wait(1);
					testRunner.ClickByName("Add Printer Menu Item");
					testRunner.Wait(1);
					resultsHarness.AddTestResult(testRunner.WaitForName("Printer Connection Window", 3));

					testRunner.ClickByName("Setup Connection Cancel Button");

					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);

			Assert.IsTrue(testHarness.AllTestsPassed);
			Assert.IsTrue(testHarness.TestCount == 1); // make sure we ran all our tests
		}
예제 #9
0
		public void FileMenuAddPrinter()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{
					MatterControlUtilities.PrepForTestRun(testRunner);

					testRunner.ClickByName("File Menu");
					testRunner.Wait(1);
					testRunner.ClickByName("Add Printer Menu Item");
					testRunner.Wait(1);
					resultsHarness.AddTestResult(testRunner.WaitForName("Select Make", 3));

					testRunner.ClickByName("Cancel Wizard Button");

					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);

			Assert.IsTrue(testHarness.AllTestsPassed(1));
		}
예제 #10
0
		public void ClickOnBuyButton()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{

					//Make sure image does not exist before we click the buy button
					testRunner.MatchLimit = 500000;
					bool imageExists = testRunner.ImageExists("MatterHackersStoreImage.png");
					resultsHarness.AddTestResult(imageExists == false, "Web page is not open");

					//Click Buy button and test that the MatterHackers store web page is open
					testRunner.ClickByName("Buy Materials Button", 5);
					bool imageExists2 = testRunner.ImageExists("MatterHackersStoreImage.png", 10);
					resultsHarness.AddTestResult(imageExists2 == true, "Web page is open");

					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);

			Assert.IsTrue(testHarness.AllTestsPassed);
			Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
		}
예제 #11
0
		public void AddToQueueMenuItemAddsSingleFile()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{

					testRunner.ClickByName("File Menu");
					testRunner.Wait(1);
					testRunner.ClickByName("Add File To Queue Menu Item");
					testRunner.Wait(2);

					string queueItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");

					testRunner.Type(queueItemPath);
					testRunner.Wait(1);
					testRunner.Type("{Enter}");
					testRunner.Wait(2);
					resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item Fennec_Fox", 2));

					int queueCount = QueueData.Instance.Count;

					resultsHarness.AddTestResult(queueCount == 1);

					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

			Assert.IsTrue(testHarness.AllTestsPassed);
			Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
		}
예제 #12
0
		public void UiAutomationTests()
		{
			// Run a copy of MatterControl
			bool firstDraw = true;
			MatterControlApplication.AfterFirstDraw = () =>
			{
				if (firstDraw)
				{
					firstDraw = false;
					Task.Run(() =>
					{
						AutomationRunner testRunner = new AutomationRunner("");
						testRunner.Wait(2);

						// Now do the actions specific to this test. (replace this for new tests)
						{
							RemoveAllFromQueue(testRunner);
						}

						MatterControlApplication.Instance.CloseOnIdle();
					});
				}
			};

#if !__ANDROID__
			// Set the static data to point to the directory of MatterControl
			StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", ".."));
#endif
			SystemWindow mcWindow = MatterControlApplication.Instance;
		}
		public void SoftwareLevelingRequiredCorrectWorkflow()
		{
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{
					MatterControlUtilities.PrepForTestRun(testRunner);

					// make a jump start printer
					var emualtorProccess = MatterControlUtilities.LaunchAndConnectToPrinterEmulator(testRunner, false, "JumStart", "V1");

					// make sure it is showing the correct button
					resultsHarness.AddTestResult(!testRunner.WaitForName("Start Print Button", .5), "Start Print hidden");
					resultsHarness.AddTestResult(testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup showing");

					// do print leveling
					testRunner.ClickByName("Next Button", .5);
					testRunner.ClickByName("Next Button", .5);
					testRunner.ClickByName("Next Button", .5);
					for (int i = 0; i < 3; i++)
					{
						testRunner.ClickByName("Move Z positive", .5);
						testRunner.ClickByName("Next Button", .5);
						testRunner.ClickByName("Next Button", .5);
						testRunner.ClickByName("Next Button", .5);
					}

					resultsHarness.AddTestResult(testRunner.ClickByName("Done Button", .5), "Found Done button");

					// make sure the button has changed to start print
					resultsHarness.AddTestResult(testRunner.WaitForName("Start Print Button", .5), "Start Print showing");
					resultsHarness.AddTestResult(!testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup hidden");

					// reset to defaults and make sure print leveling is cleared
					MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness);

					resultsHarness.AddTestResult(testRunner.ClickByName("Slice Settings Options Menu", 1), "Click Options" );
					resultsHarness.AddTestResult(testRunner.ClickByName("Reset to defaults Menu Item", 1), "Select Reset to defaults");
					resultsHarness.AddTestResult(testRunner.ClickByName("Yes Button", .5), "Click yes to revert");
					testRunner.Wait(1);

					// make sure it is showing the correct button
					resultsHarness.AddTestResult(!testRunner.WaitForName("Start Print Button", .5), "Start Print hidden");
					resultsHarness.AddTestResult(testRunner.WaitForName("Finish Setup Button", .5), "Finish Setup showing");

					MatterControlUtilities.CloseMatterControl(testRunner);

					try
					{
						emualtorProccess.Kill();
					}
					catch { }
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

			Assert.IsTrue(testHarness.AllTestsPassed(12));
		}
		private static void HighlightWidget(AutomationRunner testRunner, string widgetNameToHighlight)
		{
			SystemWindow containingWindow;
			var autoLevelRowItem = testRunner.GetWidgetByName(widgetNameToHighlight, out containingWindow, .2);
			if (autoLevelRowItem != null)
			{
				AttentionGetter.GetAttention(autoLevelRowItem);
			}
		}
		public void ExportAsGcode()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{

					MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD", true);

					string firstItemName = "Row Item Batman";
					//Navigate to Downloads Library Provider
					testRunner.ClickByName("Queue Tab");
					testRunner.ClickByName("Queue Add Button", 2);

					//Get parts to add
					string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl");

					//Add STL part items to Downloads and then type paths into file dialogue
					testRunner.Wait(1);
					testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.stl"));
					testRunner.Wait(1);
					testRunner.Type("{Enter}");

					//Get test results 
					resultsHarness.AddTestResult(testRunner.WaitForName(firstItemName, 2) == true);

					testRunner.ClickByName("Queue Edit Button");
					testRunner.ClickByName(firstItemName);
					testRunner.ClickByName("Queue Export Button");
					testRunner.Wait(2);

					testRunner.WaitForName("Export Item Window", 2);
					testRunner.ClickByName("Export as GCode Button", 2);
					testRunner.Wait(2);

					string gcodeExportPath = MatterControlUtilities.PathToExportGcodeFolder;
					testRunner.Type(gcodeExportPath);
					testRunner.Type("{Enter}");
					testRunner.Wait(2);

					Console.WriteLine(gcodeExportPath);

					resultsHarness.AddTestResult(File.Exists(gcodeExportPath) == true);
					Debugger.Break();

					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

			Assert.IsTrue(testHarness.AllTestsPassed);
			Assert.IsTrue(testHarness.TestCount == 2);

		}
		public void CopyButtonClickedMakesCopyOfPartOnBed()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{
					MatterControlUtilities.PrepForTestRun(testRunner);

					SystemWindow systemWindow;

					//Navigate to Local Library 
					testRunner.ClickByName("Library Tab");
					MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
					testRunner.Wait(1);
					testRunner.ClickByName("Row Item Calibration - Box");
					testRunner.ClickByName("Row Item Calibration - Box View Button");
					testRunner.Wait(1);

					//Get View3DWidget and count MeshGroups before Copy button is clicked
					GuiWidget partPreview = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3);
					View3DWidget view3D = partPreview as View3DWidget;

					string copyButtonName = "3D View Copy";
					
					//Click Edit button to make edit controls visible
					testRunner.ClickByName("3D View Edit");
					testRunner.Wait(1);
					int partCountBeforeCopy = view3D.MeshGroups.Count();
					resultsHarness.AddTestResult(partCountBeforeCopy == 1);
					
					
					//Click Copy button and count MeshGroups 
					testRunner.ClickByName(copyButtonName);
					System.Threading.Thread.Sleep(500);
					int partCountAfterCopy = view3D.MeshGroups.Count();
					resultsHarness.AddTestResult(partCountAfterCopy == 2);
					testRunner.Wait(1);

					//Click Copy button a second time and count MeshGroups again
					testRunner.ClickByName(copyButtonName);
					System.Threading.Thread.Sleep(500);
					int partCountAfterSecondCopy = view3D.MeshGroups.Count();
					resultsHarness.AddTestResult(partCountAfterSecondCopy == 3);
					view3D.CloseOnIdle();
					testRunner.Wait(.5);


					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

			Assert.IsTrue(testHarness.AllTestsPassed(3));
		}
예제 #17
0
		public static void CloseMatterControl(AutomationRunner testRunner)
		{
			SystemWindow mcWindowLocal = MatterControlApplication.Instance;
			Assert.IsTrue(testRunner.ClickByName("File Menu", secondsToWait: 2));
			Assert.IsTrue(testRunner.ClickByName("Exit Menu Item", secondsToWait: 2));
			testRunner.Wait(.2);
			if (mcWindowLocal.Parent != null)
			{
				mcWindowLocal.CloseOnIdle();
			}
		}
		public void LibraryQueueViewRefreshesOnAddItem()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{
					MatterControlUtilities.PrepForTestRun(testRunner);

					testRunner.ClickByName("Library Tab", 5);

					MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
					testRunner.Wait(1);
					testRunner.ClickByName("Row Item Calibration - Box");
					testRunner.ClickByName("Row Item Calibration - Box View Button");
					testRunner.Wait(1);

					SystemWindow systemWindow;
					GuiWidget partPreview = testRunner.GetWidgetByName("View3DWidget", out systemWindow, 3);
					View3DWidget view3D = partPreview as View3DWidget;

					resultsHarness.AddTestResult(testRunner.ClickByName("3D View Edit", 3));

					resultsHarness.AddTestResult(testRunner.ClickByName("3D View Copy", 3), "Click Copy");
					// wait for the copy to finish
					testRunner.Wait(.1);
					resultsHarness.AddTestResult(testRunner.ClickByName("3D View Remove", 3), "Click Delete");
					resultsHarness.AddTestResult(testRunner.ClickByName("Save As Menu", 3), "Click Save As Menu");
					resultsHarness.AddTestResult(testRunner.ClickByName("Save As Menu Item", 3), "Click Save As");

					testRunner.Wait(1);

					testRunner.Type("0Test Part");
					resultsHarness.AddTestResult(MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection"));

					resultsHarness.AddTestResult(testRunner.ClickByName("Save As Save Button", 1));

					view3D.CloseOnIdle();
					testRunner.Wait(.5);

					// ensure that it is now in the library folder (that the folder updated)
					resultsHarness.AddTestResult(testRunner.WaitForName("Row Item " + "0Test Part", 5), "The part we added should be in the library");

					testRunner.Wait(.5);

					MatterControlUtilities.CloseMatterControl(testRunner); 
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items);

			Assert.IsTrue(testHarness.AllTestsPassed(8));
		}
		public void LocalLibraryAddButtonAddsMultipleItemsToLibrary()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{


					//Names of Items to be added
					string firstItemName = "Row Item " + "Fennec Fox";
					string secondItemName = "Row Item " + "Batman";

					//Navigate to Local Library 
					testRunner.ClickByName("Library Tab");
					MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");

					//Make sure both Items do not exist before the test begins
					bool firstItemExists= testRunner.WaitForName(firstItemName, 1);
					bool secondItemExists = testRunner.WaitForName(secondItemName, 1);
					resultsHarness.AddTestResult(firstItemExists == false);
					resultsHarness.AddTestResult(secondItemExists == false);

					//Click Local Library Add Button
					testRunner.ClickByName("Library Add Button");

					//Get Library Item to Add
					string firstRowItemPath = MatterControlUtilities.PathToQueueItemsFolder("Fennec_Fox.stl");
					string secondRowItemPath = MatterControlUtilities.PathToQueueItemsFolder("Batman.stl");

					string textForBothRowItems = String.Format("\"{0}\" \"{1}\"", firstRowItemPath, secondRowItemPath);
					testRunner.Wait(2);
					testRunner.Type(textForBothRowItems);
					testRunner.Wait(1);
					testRunner.Type("{Enter}");


					bool firstRowItemWasAdded = testRunner.WaitForName(firstItemName, 2);
					bool secondRowItemWasAdded = testRunner.WaitForName(secondItemName, 2);
					resultsHarness.AddTestResult(firstRowItemWasAdded == true);
					resultsHarness.AddTestResult(secondRowItemWasAdded == true);


					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

			Assert.IsTrue(testHarness.AllTestsPassed);
			Assert.IsTrue(testHarness.TestCount == 4); // make sure we ran all our tests
		}
		public void ClickOnLibraryCheckBoxes()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUITests.DefaultTestImages);

				// Now do the actions specific to this test. (replace this for new tests)
				{
					testRunner.ClickByName("Library Tab");
					testRunner.Wait(1);
					SystemWindow systemWindow;
					GuiWidget rowItem = testRunner.GetWidgetByName("Local Library Row Item Collection", out systemWindow);
					testRunner.Wait(1);

					SearchRegion rowItemRegion = testRunner.GetRegionByName("Local Library Row Item Collection");

					testRunner.ClickByName("Library Edit Button");
					testRunner.Wait(1);

					SystemWindow containingWindow;
					GuiWidget foundWidget = testRunner.GetWidgetByName("Row Item Select Checkbox", out containingWindow, searchRegion: rowItemRegion);
					CheckBox checkBoxWidget = foundWidget as CheckBox;
					resultsHarness.AddTestResult(checkBoxWidget != null, "We should have an actual checkbox");
					resultsHarness.AddTestResult(checkBoxWidget.Checked == false, "currently not checked");

					testRunner.ClickByName("Row Item Select Checkbox", searchRegion: rowItemRegion);
					testRunner.Wait(.5);
					resultsHarness.AddTestResult(checkBoxWidget.Checked == true, "currently checked");

					testRunner.ClickByName("Local Library Row Item Collection");
					testRunner.Wait(.5);
					resultsHarness.AddTestResult(checkBoxWidget.Checked == false, "currently not checked");

					MatterControlUITests.CloseMatterControl(testRunner);
				}

			};

#if !__ANDROID__
			// Set the static data to point to the directory of MatterControl
			StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
#endif
			bool showWindow;
			MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
			AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 1000);

			// NOTE: In the future we may want to make the "Local Library Row Item Collection" not clickable. 
			// If that is the case fix this test to click on a child of "Local Library Row Item Collection" instead.
			Assert.IsTrue(testHarness.AllTestsPassed); 
			Assert.IsTrue(testHarness.TestCount == 4); // make sure we ran all our tests
		}
		public void DownloadsAddButtonAddsMultipleFiles()
		{
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				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");
					MatterControlUtilities.NavigateToFolder(testRunner, "-Temporary Row Item Collection");
					testRunner.ClickByName("Library Add Button");
					testRunner.Wait(3);

					testRunner.Wait(2);

					// Add both files to the FileOpen dialog
					testRunner.Type(
						string.Format(
							"\"{0}\" \"{1}\"",
							MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"),
							MatterControlUtilities.GetTestItemPath("Batman.stl")));

					testRunner.Wait(1);
					testRunner.Type("{Enter}");

					resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Fennec Fox", 2), "Fennec Fox item exists");
					resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Batman", 2), "Batman item exists");
					testRunner.Wait(1);

					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = null;

			try
			{
				testHarness = MatterControlUtilities.RunTest(testToRun);

			}
			catch { }
			finally
			{
				MatterControlUtilities.DeleteDownloadsSubFolder();
			}

			Assert.IsTrue(testHarness.AllTestsPassed(2));
		}
예제 #22
0
		public void RaftEnabledPassedToSliceEngine()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{


					MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD", true);

					//Navigate to Local Library 
					testRunner.ClickByName("Library Tab");
					MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
					testRunner.Wait(1);
					testRunner.ClickByName("Row Item Calibration - Box");
					testRunner.ClickByName("Row Item Calibration - Box Print Button");
					testRunner.Wait(1);

					testRunner.ClickByName("Layer View Tab");

					testRunner.ClickByName("Bread Crumb Button Home");
					testRunner.Wait(1);
					testRunner.ClickByName("SettingsAndControls");
					testRunner.Wait(1);
					testRunner.ClickByName("User Level Dropdown");
					testRunner.Wait(1);
					testRunner.ClickByName("Advanced Menu Item");
					testRunner.Wait(1);
					testRunner.ClickByName("Skirt and Raft Tab");
					testRunner.Wait(1);

					testRunner.ClickByName("Create Raft Checkbox");
					testRunner.Wait(1.5);
					testRunner.ClickByName("Save Slice Settings Button");
					testRunner.ClickByName("Generate Gcode Button");
					testRunner.Wait(5);

					//Call compare slice settings methode here
					resultsHarness.AddTestResult(MatterControlUtilities.CompareExpectedSliceSettingValueWithActualVaue("enableRaft", "True"));


					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

			Assert.IsTrue(testHarness.AllTestsPassed);
			Assert.IsTrue(testHarness.TestCount == 1); // make sure we ran all our tests
		}
예제 #23
0
        public override void CreateMouseEvent(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo)
        {
            // figure out where this is on our agg windows
            // for now only send mouse events to the top most window
            //foreach (SystemWindow systemWindow in SystemWindow.OpenWindows)
            SystemWindow systemWindow = SystemWindow.AllOpenSystemWindows[SystemWindow.AllOpenSystemWindows.Count - 1];

            {
                Point2D windowPosition = AutomationRunner.ScreenToSystemWindow(currentMousePosition, systemWindow);
                if (systemWindow.LocalBounds.Contains(windowPosition))
                {
                    MouseButtons mouseButtons = MapButtons(cButtons);
                    // create the agg event
                    if (dwFlags == MOUSEEVENTF_LEFTDOWN)
                    {
                        MouseEventArgs aggEvent = new MouseEventArgs(mouseButtons, 1, windowPosition.x, windowPosition.y, 0);
                        // send it to the window
                        if (LeftButtonDown)
                        {
                            UiThread.RunOnIdle(() => systemWindow.OnMouseMove(aggEvent));
                        }
                        else
                        {
                            UiThread.RunOnIdle(() => systemWindow.OnMouseDown(aggEvent));
                        }
                    }
                    else if (dwFlags == MOUSEEVENTF_LEFTUP)
                    {
                        MouseEventArgs aggEvent = new MouseEventArgs(mouseButtons, 0, windowPosition.x, windowPosition.y, 0);
                        // send it to the window
                        UiThread.RunOnIdle(() => systemWindow.OnMouseUp(aggEvent));
                    }
                    else if (dwFlags == MOUSEEVENTF_RIGHTDOWN)
                    {
                    }
                    else if (dwFlags == MOUSEEVENTF_RIGHTUP)
                    {
                    }
                    else if (dwFlags == MOUSEEVENTF_MIDDLEDOWN)
                    {
                    }
                    else if (dwFlags == MOUSEEVENTF_MIDDLEUP)
                    {
                    }
                }
            }

            base.CreateMouseEvent(dwFlags, dx, dy, cButtons, dwExtraInfo);
        }
		public void ClickOnLibraryCheckBoxes()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);

				// Now do the actions specific to this test. (replace this for new tests)
				{
					testRunner.ClickByName("Library Tab", 3);
					MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");

					SystemWindow systemWindow;
					string itemName = "Row Item " + "Calibration - Box";

					GuiWidget rowItem = testRunner.GetWidgetByName(itemName, out systemWindow, 3);

					SearchRegion rowItemRegion = testRunner.GetRegionByName(itemName, 3);

					testRunner.ClickByName("Library Edit Button", 3);
					testRunner.Wait(.5);

					SystemWindow containingWindow;
					GuiWidget foundWidget = testRunner.GetWidgetByName("Row Item Select Checkbox", out containingWindow, 3, searchRegion: rowItemRegion);
					CheckBox checkBoxWidget = foundWidget as CheckBox;
					resultsHarness.AddTestResult(checkBoxWidget != null, "We should have an actual checkbox");
					resultsHarness.AddTestResult(checkBoxWidget.Checked == false, "currently not checked");

					testRunner.ClickByName("Row Item Select Checkbox", 3, searchRegion: rowItemRegion);
					testRunner.ClickByName("Library Tab");
					resultsHarness.AddTestResult(checkBoxWidget.Checked == true, "currently checked");

					testRunner.ClickByName(itemName, 3);
					testRunner.ClickByName("Library Tab");
					resultsHarness.AddTestResult(checkBoxWidget.Checked == false, "currently not checked");

					MatterControlUtilities.CloseMatterControl(testRunner);
				}

			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

			// NOTE: In the future we may want to make the "Local Library Row Item Collection" not clickable. 
			// If that is the case fix this test to click on a child of "Local Library Row Item Collection" instead.
			Assert.IsTrue(testHarness.AllTestsPassed); 
			Assert.IsTrue(testHarness.TestCount == 4); // make sure we ran all our tests
		}
예제 #25
0
		public void DownloadsAddButtonAddsMultipleFiles()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{

				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{
					MatterControlUtilities.CreateDownloadsSubFolder();

					//Navigate to Downloads Library Provider
					testRunner.ClickByName("Library Tab");
					MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
					MatterControlUtilities.NavigateToFolder(testRunner, "Temporary Row Item Collection");
					testRunner.ClickByName("Library Add Button");
					testRunner.Wait(3);

					string firstRowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
					string secondRowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl");
					string textForBothRowItems = String.Format("\"{0}\" \"{1}\"", firstRowItemPath, secondRowItemPath);
					testRunner.Wait(2);
					testRunner.Type(textForBothRowItems);
					testRunner.Wait(1);
					testRunner.Type("{Enter}");

					resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Fennec Fox", 2) == true);
					resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Batman", 2) == true);

					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = null;

			try
			{
				testHarness = MatterControlUtilities.RunTest(testToRun);

			}
			catch { }
			finally
			{
				MatterControlUtilities.CleanupDownloadsDirectory(MatterControlUtilities.PathToDownloadsSubFolder);
			}

			Assert.IsTrue(testHarness.AllTestsPassed);
			Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
		}
		public void PauseOnLayerDoesPauseOnPrint()
		{
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner();
				{
					MatterControlUtilities.PrepForTestRun(testRunner, MatterControlUtilities.PrepAction.CloseSignInAndPrinterSelect);

					var emualtorProccess = MatterControlUtilities.LaunchAndConnectToPrinterEmulator(testRunner);

					resultsHarness.AddTestResult(ProfileManager.Instance.ActiveProfile != null);

					MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness);

					resultsHarness.AddTestResult(testRunner.ClickByName("General Tab", 1));
					resultsHarness.AddTestResult(testRunner.ClickByName("Single Print Tab", 1));
					resultsHarness.AddTestResult(testRunner.ClickByName("Layer(s) To Pause:" + " Edit"));
					testRunner.Type("4;2;a;not;6");

					resultsHarness.AddTestResult(testRunner.ClickByName("Layer View Tab"));

					resultsHarness.AddTestResult(testRunner.ClickByName("Generate Gcode Button", 1));
					resultsHarness.AddTestResult(testRunner.ClickByName("Display Checkbox", 10));
					resultsHarness.AddTestResult(testRunner.ClickByName("Sync To Print Checkbox", 1));

					resultsHarness.AddTestResult(testRunner.ClickByName("Start Print Button", 1));

					WaitForLayerAndResume(resultsHarness, testRunner, 2);
					WaitForLayerAndResume(resultsHarness, testRunner, 4);
					WaitForLayerAndResume(resultsHarness, testRunner, 6);

					resultsHarness.AddTestResult(testRunner.WaitForName("Done Button", 30));
					resultsHarness.AddTestResult(testRunner.WaitForName("Print Again Button", 1));

					try
					{
						emualtorProccess.Kill();
					}
					catch {}

					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, maxTimeToRun: 200);
			Assert.IsTrue(testHarness.AllTestsPassed(19));
		}
		public void DownloadsAddButtonAddsAMFFiles()
		{
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				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");
					MatterControlUtilities.NavigateToFolder(testRunner, "-Temporary Row Item Collection");
					testRunner.ClickByName("Library Add Button");
					testRunner.Wait(2);

					//Add AMF part items to Downloads and then type paths into file dialogues 
					testRunner.Wait(2);
					testRunner.Type(MatterControlUtilities.GetTestItemPath("Rook.amf"));
					testRunner.Wait(1);
					testRunner.Type("{Enter}");

					resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Rook", 2), "Rook item exists");
					testRunner.Wait(1);

					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = null;

			try
			{
				testHarness = MatterControlUtilities.RunTest(testToRun);

			}
			catch { }
			finally
			{
				MatterControlUtilities.DeleteDownloadsSubFolder();
			}

			Assert.IsTrue(testHarness.AllTestsPassed(1));
		}
예제 #28
0
        public void SetCursorPosition(int x, int y)
        {
            var          openWindows     = SystemWindow.AllOpenSystemWindows.ToList();
            SystemWindow topSystemWindow = openWindows.Last();

            if (windowToDrawSimulatedMouseOn != topSystemWindow)
            {
                if (windowToDrawSimulatedMouseOn != null)
                {
                    windowToDrawSimulatedMouseOn.AfterDraw -= DrawMouse;
                }

                windowToDrawSimulatedMouseOn = topSystemWindow;

                if (windowToDrawSimulatedMouseOn != null && DrawSimulatedMouse)
                {
                    windowToDrawSimulatedMouseOn.AfterDraw += DrawMouse;
                }
            }

            foreach (var systemWindow in openWindows)
            {
                currentMousePosition = new Point2D(x, y);
                Point2D windowPosition = AutomationRunner.ScreenToSystemWindow(currentMousePosition, systemWindow);
                if (LeftButtonDown)
                {
                    MouseEventArgs aggEvent = new MouseEventArgs(MouseButtons.Left, 0, windowPosition.x, windowPosition.y, 0);
                    UiThread.RunOnIdle(() =>
                    {
                        systemWindow.OnMouseMove(aggEvent);
                        systemWindow.Invalidate();
                    });
                }
                else
                {
                    MouseEventArgs aggEvent = new MouseEventArgs(MouseButtons.None, 0, windowPosition.x, windowPosition.y, 0);
                    UiThread.RunOnIdle(() =>
                    {
                        systemWindow.OnMouseMove(aggEvent);
                        systemWindow.Invalidate();
                    });
                }
            }
        }
		public void RaftEnabledPassedToSliceEngine()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{
					MatterControlUtilities.PrepForTestRun(testRunner);

					MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");

					//Navigate to Local Library 
					testRunner.ClickByName("Library Tab");
					MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
					testRunner.Wait(1);
					testRunner.ClickByName("Row Item Calibration - Box");
					testRunner.ClickByName("Row Item Calibration - Box Print Button");
					testRunner.Wait(1);

					testRunner.ClickByName("Layer View Tab");

					testRunner.ClickByName("Bread Crumb Button Home", 1);

					MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness);

					testRunner.ClickByName("Raft / Priming Tab", 1);

					testRunner.ClickByName("Create Raft Checkbox", 1);
					testRunner.Wait(1.5);
					testRunner.ClickByName("Generate Gcode Button", 1);
					testRunner.Wait(5);

					//Call compare slice settings methode here
					resultsHarness.AddTestResult(MatterControlUtilities.CompareExpectedSliceSettingValueWithActualVaue("enableRaft", "True"));


					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, overrideWidth: 1224, overrideHeight: 800);

			Assert.IsTrue(testHarness.AllTestsPassed(3));
		}
		public void HasHardwareLevelingHidesLevelingSettings()
		{
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{
					//Add printer that has hardware leveling
					MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD", true);

					testRunner.Wait(1);
					testRunner.ClickByName("SettingsAndControls");
					testRunner.Wait(1);
					testRunner.ClickByName("Slice Settings Tab");
					testRunner.Wait(1);
					testRunner.ClickByName("User Level Dropdown");
					testRunner.Wait(1);
					testRunner.ClickByName("Advanced Menu Item");
					testRunner.Wait(1);
					testRunner.ClickByName("Printer Tab");
					testRunner.Wait(1);

					//Make sure Print Leveling tab is not visible 
					bool testPrintLeveling = testRunner.WaitForName("Print Leveling Tab", 3);
					resultsHarness.AddTestResult(testPrintLeveling == false);

					//Add printer that does not have hardware leveling
					MatterControlUtilities.SelectAndAddPrinter(testRunner, "Deezmaker", "Bukito", false);
					testRunner.ClickByName("Slice Settings Tab");
					testRunner.Wait(1);
					testRunner.ClickByName("Printer Tab");

					//Make sure Print Leveling tab is visible
					bool printLevelingVisible = testRunner.WaitForName("Print Leveling Tab", 2);
					resultsHarness.AddTestResult(printLevelingVisible == true);

					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

			Assert.IsTrue(testHarness.AllTestsPassed);
			Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
		}
예제 #31
0
		public void Slicing()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{
					
					//Navigate to Local Library 
					MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD", true);

					testRunner.ClickByName("Library Tab");
					
					MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");
					testRunner.Wait(1);
					testRunner.ClickByName("Row Item Calibration - Box");
					testRunner.ClickByName("Row Item Calibration - Box Print Button");
					testRunner.Wait(1);
					testRunner.ClickByName("Layer View Tab");
					testRunner.Wait(1);
					testRunner.ClickByName("SettingsAndControls");
					testRunner.Wait(1);
					testRunner.ClickByName("Settings Tab");
					testRunner.Wait(1.1);
					testRunner.ClickByName("Skirt and Raft Tab");
					testRunner.Wait(1);
					testRunner.ClickByName("Create Raft Checkbox");
					testRunner.Wait(1);
					testRunner.ClickByName("Generate Gcode Button");
					testRunner.Wait(1.5);




					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

			Assert.IsTrue(testHarness.AllTestsPassed);
			Assert.IsTrue(testHarness.TestCount == 3); // make sure we ran all our tests
		}
		public void LocalLibraryAddButtonAddSingleItemToLibrary()
		{
			// Run a copy of MatterControl
			Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
			{
				AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
				{

					string itemName = "Row Item " + "Fennec Fox";


					//Navigate to Local Library 
					testRunner.ClickByName("Library Tab");
					MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");

					//Make sure that Item does not exist before the test begins
					bool rowItemExists = testRunner.WaitForName(itemName, 1);
					resultsHarness.AddTestResult(rowItemExists == false);

					//Click Local Library Add Button
					testRunner.ClickByName("Library Add Button");

					//Get Library Item to Add
					string rowItemPath = MatterControlUtilities.PathToQueueItemsFolder("Fennec_Fox.stl");
					testRunner.Wait(2);
					testRunner.Type(rowItemPath);
					testRunner.Wait(1);
					testRunner.Type("{Enter}");

					bool rowItemWasAdded = testRunner.WaitForName(itemName, 2);
					resultsHarness.AddTestResult(rowItemWasAdded == true);


					MatterControlUtilities.CloseMatterControl(testRunner);
				}
			};

			AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

			Assert.IsTrue(testHarness.AllTestsPassed);
			Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests
		}
예제 #33
0
        public void CreateMouseEvent(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo)
        {
            // Send mouse event into the first SystemWindow (reverse order) containing the mouse
            foreach (var systemWindow in SystemWindow.AllOpenSystemWindows.Reverse().ToList())
            {
                Point2D windowPosition = AutomationRunner.ScreenToSystemWindow(currentMousePosition, systemWindow);
                if (systemWindow.LocalBounds.Contains(windowPosition))
                {
                    MouseButtons mouseButtons = MapButtons(dwFlags);
                    if (dwFlags == MouseConsts.MOUSEEVENTF_LEFTDOWN)
                    {
                        this.ClickCount = (this.LeftButtonDown) ? 2 : 1;

                        UiThread.RunOnIdle(() =>
                        {
                            systemWindow.OnMouseDown(new MouseEventArgs(mouseButtons, this.ClickCount, windowPosition.x, windowPosition.y, 0));
                            systemWindow.Invalidate();
                        });

                        // Stop processing after first match
                        break;
                    }
                    else if (dwFlags == MouseConsts.MOUSEEVENTF_LEFTUP)
                    {
                        // send it to the window
                        UiThread.RunOnIdle(() =>
                        {
                            systemWindow.OnMouseUp(new MouseEventArgs(mouseButtons, 0, windowPosition.x, windowPosition.y, 0));
                            systemWindow.Invalidate();
                        });

                        // Stop processing after first match
                        break;
                    }
                    else if (dwFlags == MouseConsts.MOUSEEVENTF_RIGHTDOWN)
                    {
                        this.ClickCount = (this.RightButtonDown) ? 2 : 1;

                        UiThread.RunOnIdle(() =>
                        {
                            systemWindow.OnMouseDown(new MouseEventArgs(mouseButtons, this.ClickCount, windowPosition.x, windowPosition.y, 0));
                            systemWindow.Invalidate();
                        });

                        // Stop processing after first match
                        break;
                    }
                    else if (dwFlags == MouseConsts.MOUSEEVENTF_RIGHTUP)
                    {
                        // send it to the window
                        UiThread.RunOnIdle(() =>
                        {
                            systemWindow.OnMouseUp(new MouseEventArgs(mouseButtons, 0, windowPosition.x, windowPosition.y, 0));
                            systemWindow.Invalidate();
                        });

                        // Stop processing after first match
                        break;
                    }
                    else if (dwFlags == MouseConsts.MOUSEEVENTF_MIDDLEDOWN)
                    {
                        this.ClickCount = (this.MiddleButtonDown) ? 2 : 1;

                        UiThread.RunOnIdle(() =>
                        {
                            systemWindow.OnMouseDown(new MouseEventArgs(mouseButtons, this.ClickCount, windowPosition.x, windowPosition.y, 0));
                            systemWindow.Invalidate();
                        });

                        // Stop processing after first match
                        break;
                    }
                    else if (dwFlags == MouseConsts.MOUSEEVENTF_MIDDLEUP)
                    {
                        // send it to the window
                        UiThread.RunOnIdle(() =>
                        {
                            systemWindow.OnMouseUp(new MouseEventArgs(mouseButtons, 0, windowPosition.x, windowPosition.y, 0));
                            systemWindow.Invalidate();
                        });

                        // Stop processing after first match
                        break;
                    }
                }
            }

            this.LeftButtonDown   = (dwFlags == MouseConsts.MOUSEEVENTF_LEFTDOWN);
            this.MiddleButtonDown = (dwFlags == MouseConsts.MOUSEEVENTF_MIDDLEDOWN);
            this.RightButtonDown  = (dwFlags == MouseConsts.MOUSEEVENTF_RIGHTDOWN);
        }
예제 #34
0
 public SearchRegion(AutomationRunner automationRunner)
 {
     this.automationRunner = automationRunner;
 }
예제 #35
0
 public SearchRegion(ImageBuffer imageContents, ScreenRectangle screenBounds, AutomationRunner automationRunner)
     : this(automationRunner)
 {
     this.ScreenRect    = screenBounds;
     this.imageContents = imageContents;
 }
예제 #36
0
 private void DrawMouse(GuiWidget drawingWidget, DrawEventArgs e)
 {
     AutomationRunner.RenderMouse(currentlyHookedWindow, e.graphics2D);
 }
예제 #37
0
 public AggInputMethods(AutomationRunner automationRunner, bool drawSimulatedMouse)
 {
     this.DrawSimulatedMouse = drawSimulatedMouse;
     this.automationRunner   = automationRunner;
 }