//DOES NOT WORK
        public void ClickingConfigureNotificationSettingsButtonOpensWindow()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUITests.DefaultTestImages);
                {
                    testRunner.ClickByName("SettingsAndControls", 5);
                    testRunner.Wait(2);
                    testRunner.ClickByName("Configuration Tab", 6);

                    bool printNotificationsWindowExists1 = testRunner.WaitForName("Notification Options Window", 0);
                    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");

                    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;
            string testDBFolder = "MC_Three_Queue_Items";
            MatterControlUITests.DataFolderState staticDataState     = MatterControlUITests.MakeNewStaticDataForTesting(testDBFolder);
            MatterControlApplication             matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
            AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 45);
            MatterControlUITests.RestoreStaticDataAfterTesting(staticDataState, true);
            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 2);             // make sure we ran all our tests
        }
        public void AddToQueueMenuItemAddsZipFiles()
        {
            // 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 File To Queue Menu Item");
                    testRunner.Wait(2);

                    int beforeCount = QueueData.Instance.Count;

                    string pathToType = MatterControlUtilities.GetTestItemPath("Batman.zip");
                    testRunner.Type(pathToType);
                    testRunner.Wait(1);
                    testRunner.Type("{Enter}");
                    testRunner.Wait(1);

                    resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item Batman", 1));
                    resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2", 1));
                    resultsHarness.AddTestResult(QueueData.Instance.Count == beforeCount + 2);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed(3));
        }
Beispiel #3
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
        }
Beispiel #4
0
        /// <summary>
        /// Adds the given asset names to the local library and validates the result
        /// </summary>
        /// <param name="testRunner"></param>
        /// <param name="assetNames">The test assets to add to the library</param>
        public static void AddTestAssetsToLibrary(this AutomationRunner testRunner, params string[] assetNames)
        {
            // Switch to the Local Library tab
            testRunner.NavigateToFolder("Local Library Row Item Collection");

            // Assert that the requested items are *not* in the list
            foreach (string assetName in assetNames)
            {
                string friendlyName = Path.GetFileNameWithoutExtension(assetName);
                Assert.IsFalse(testRunner.WaitForName($"Row Item {friendlyName}", .1), $"{friendlyName} part should not exist at test start");
            }

            // Add Library item
            testRunner.InvokeLibraryAddDialog();

            // Generate the full, quoted paths for the requested assets
            string fullQuotedAssetPaths = string.Join(" ", assetNames.Select(name => $"\"{MatterControlUtilities.GetTestItemPath(name)}\""));

            testRunner.CompleteDialog(fullQuotedAssetPaths);

            // Assert that the added items *are* in the list
            foreach (string assetName in assetNames)
            {
                string friendlyName = Path.GetFileNameWithoutExtension(assetName);
                Assert.IsTrue(testRunner.WaitForName($"Row Item {friendlyName}"), $"{friendlyName} part should exist after adding");
            }
        }
        public void RemoveButtonClickedRemovesMultipleItems()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                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");

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

                    string rowItemPath = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
                    testRunner.ClickByName("Library Add Button");

                    testRunner.Wait(2);
                    testRunner.Type(rowItemPath);
                    testRunner.Type("{Enter}");

                    testRunner.Wait(1);
                    string rowItemOne = "Row Item " + "Calibration - Box";
                    testRunner.ClickByName(rowItemOne, 1);

                    string rowItemTwo = "Row Item " + "Fennec Fox";
                    testRunner.ClickByName(rowItemTwo, 1);

                    testRunner.Wait(1);

                    //Make sure row items exist before remove
                    bool rowItemOneExistsBeforeRemove = testRunner.WaitForName(rowItemOne, 2);
                    bool rowItemTwoExistsBeforeRemove = testRunner.WaitForName(rowItemTwo, 2);
                    resultsHarness.AddTestResult(rowItemOneExistsBeforeRemove == true);
                    resultsHarness.AddTestResult(rowItemTwoExistsBeforeRemove == true);

                    MatterControlUtilities.LibraryRemoveSelectedItem(testRunner);
                    testRunner.Wait(1);

                    //Make sure both selected items are removed
                    bool rowItemOneExists = testRunner.WaitForName(rowItemOne, 2);
                    bool rowItemTwoExists = testRunner.WaitForName(rowItemTwo, 2);
                    resultsHarness.AddTestResult(rowItemOneExists == false);
                    resultsHarness.AddTestResult(rowItemTwoExists == false);


                    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 ExportAsGcode()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    MatterControlUtilities.PrepForTestRun(testRunner);

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

                    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);
        }
Beispiel #7
0
        public void DownloadsAddButtonAddsZipFiles()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    string firstItemName  = "Row Item " + "Chinese Dragon";
                    string secondItemName = "Row Item " + "chichen-itza pyramid";
                    string thirdItemName  = "Row Item " + "Circle Calibration";

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

                    //Get parts to add
                    string rowItemPath = MatterControlUtilities.PathToQueueItemsFolder("Test.zip");

                    //Get files to delete from Downloads once each test has completed and then add them to List
                    string firstFileToDelete  = Path.Combine(MatterControlUtilities.PathToDownloadsFolder, "Circle Calibration.stl");
                    string secondFileToDelete = Path.Combine(MatterControlUtilities.PathToDownloadsFolder, "Chinese Dragon.stl");
                    string thirdFileToDelete  = Path.Combine(MatterControlUtilities.PathToDownloadsFolder, "chichen-itza_pyramid.stl");
                    addedFiles.Add(firstFileToDelete);
                    addedFiles.Add(secondFileToDelete);
                    addedFiles.Add(thirdFileToDelete);

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

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

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

                    bool thirdRowItemWasAdded = testRunner.WaitForName(thirdItemName, 2);
                    resultsHarness.AddTestResult(thirdRowItemWasAdded == true);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };
            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            MatterControlUtilities.CleanUpDownloadsDirectoryAfterTest(addedFiles);

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

                    /*
                     * Tests:
                     * 1. When the remove button on a queue item is clicked the queue tab count decreases by one
                     * 2. When the remove button on a queue item is clicked the item is removed
                     * 3. When the View button on a queue item is clicked the part preview window is opened
                     */


                    testRunner.Wait(2);
                    int currentQueueItemCount = QueueData.Instance.Count;

                    resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item " + "Batman", 1));
                    resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item " + "2013-01-25_Mouthpiece_v2", 1));

                    testRunner.ClickByName("Queue Item " + "Batman", 1);
                    testRunner.ClickByName("Queue Item " + "Batman" + " Remove");
                    testRunner.Wait(2);

                    int queueItemCountAfterRemove = QueueData.Instance.Count;

                    resultsHarness.AddTestResult(currentQueueItemCount - 1 == queueItemCountAfterRemove);

                    bool batmanQueueItemExists = testRunner.WaitForName("Queue Item " + "Batman", 1);
                    resultsHarness.AddTestResult(batmanQueueItemExists == false);

                    bool partPreviewWindowExists1 = testRunner.WaitForName("Queue Item " + "2013-01-25_Mouthpiece_v2" + " Part Preview", 1);
                    resultsHarness.AddTestResult(partPreviewWindowExists1 == false);
                    testRunner.ClickByName("Queue Item " + "2013-01-25_Mouthpiece_v2", 1);
                    testRunner.Wait(2);
                    testRunner.ClickByName("Queue Item " + "2013-01-25_Mouthpiece_v2" + " View", 1);

                    bool partPreviewWindowExists2 = testRunner.WaitForName("Queue Item " + "2013-01-25_Mouthpiece_v2" + " Part Preview", 2);
                    resultsHarness.AddTestResult(partPreviewWindowExists2 == true);


                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

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

            Assert.IsTrue(testHarness.AllTestsPassed(6));
        }
Beispiel #9
0
        public static string CreateChildFolder(this AutomationRunner testRunner, string folderName)
        {
            testRunner.InvokeLibraryCreateFolderDialog();
            testRunner.WaitForName("InputBoxPage Action Button");
            testRunner.Type(folderName);
            testRunner.ClickByName("InputBoxPage Action Button");

            string folderID = $"{folderName} Row Item Collection";

            Assert.IsTrue(testRunner.WaitForName(folderID), $"{folderName} exists");

            return(folderID);
        }
        public static void CloseSignInAndPrinterSelect(this AutomationRunner testRunner, PrepAction preAction = PrepAction.CloseSignInAndPrinterSelect)
        {
            // Non-MCCentral builds won't have the plugin. Reduce the wait time for these cases
            if (testRunner.WaitForName("Connection Wizard Skip Sign In Button", 0.5))
            {
                testRunner.ClickByName("Connection Wizard Skip Sign In Button");
            }

            if (testRunner.WaitForName("Cancel Wizard Button", 1))
            {
                testRunner.ClickByName("Cancel Wizard Button");
            }
        }
        public void LocalLibraryAddButtonAddsMultipleItemsToLibrary()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                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";

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


                    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
        }
Beispiel #12
0
        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));
        }
Beispiel #13
0
        public void DownloadsAddButtonAddsZipFiles()
        {
            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 dialogs
                    testRunner.Wait(2);
                    testRunner.Type(MatterControlUtilities.GetTestItemPath("Test.zip"));
                    testRunner.Wait(1);
                    testRunner.Type("{Enter}");

                    resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Chinese Dragon", 2), "Chinese Dragon item exists");
                    resultsHarness.AddTestResult(testRunner.WaitForName("Row Item chichen-itza pyramid", 2), "chichen-itza item exists");
                    resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Circle Calibration", 2), "Circle Calibration item exists");

                    testRunner.Wait(1);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };
            AutomationTesterHarness testHarness = null;

            try
            {
                testHarness = MatterControlUtilities.RunTest(testToRun);
            }
            catch { }

            // Give MatterControl a moment to shutdown
            Thread.Sleep(2000);
            try
            {
                // Then attempt to clean up
                MatterControlUtilities.DeleteDownloadsSubFolder();
            }
            catch { }

            Assert.IsTrue(testHarness.AllTestsPassed(3));
        }
Beispiel #14
0
        public void DownloadsAddButtonAddsMultipleFiles()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    string itemName    = "Row Item " + "Fennec Fox";
                    string itemNameTwo = "Row Item " + "Batman";

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

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

                    //Get files to delete from Downloads once each test has completed and then add them to List
                    string firstFileToDelete  = Path.Combine(MatterControlUtilities.PathToDownloadsFolder, "Fennec_Fox.stl");
                    string secondFileToDelete = Path.Combine(MatterControlUtilities.PathToDownloadsFolder, "Batman.stl");
                    addedFiles.Add(firstFileToDelete);
                    addedFiles.Add(secondFileToDelete);

                    //Format text to add both items to Downloads and then type paths into file dialogues
                    string textForBothRowItems = String.Format("\"{0}\" \"{1}\"", rowItemPath, secondRowItemPath);
                    testRunner.Wait(2);
                    testRunner.Type(textForBothRowItems);
                    testRunner.Wait(1);
                    testRunner.Type("{Enter}");

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

                    bool secondRowItemWasAdded = testRunner.WaitForName(itemNameTwo, 2);
                    resultsHarness.AddTestResult(secondRowItemWasAdded == true);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };
            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            MatterControlUtilities.CleanUpDownloadsDirectoryAfterTest(addedFiles);

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

                    /*
                     * Tests that Add button can add multiple files to the print queue:
                     * 1. The Queue count is increased by 2
                     * 2. 2 QueueRowItems are created and added to the queue
                     */

                    int queueCountBeforeAdd = QueueData.Instance.Count;

                    //Click Add Button and Add Part To Queue
                    testRunner.ClickByName("Queue Add Button", 2);
                    string pathToFirstQueueItem = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
                    testRunner.Wait(1);
                    string pathToSecondQueueItem = MatterControlUtilities.GetTestItemPath("Batman.stl");
                    string textForBothQueueItems = String.Format("\"{0}\" \"{1}\"", pathToFirstQueueItem, pathToSecondQueueItem);

                    testRunner.Type(textForBothQueueItems);
                    testRunner.Wait(2);
                    testRunner.Type("{Enter}");
                    testRunner.Wait(2);

                    //Confirm that both items were added and  that the queue count increases by the appropriate number
                    int queueCountAfterAdd = QueueData.Instance.Count;

                    resultsHarness.AddTestResult(QueueData.Instance.Count == queueCountBeforeAdd + 2);

                    bool firstQueueItemWasAdded  = testRunner.WaitForName("Queue Item " + "Fennec_Fox", 2);
                    bool secondQueueItemWasAdded = testRunner.WaitForName("Queue Item " + "Batman", 2);

                    resultsHarness.AddTestResult(firstQueueItemWasAdded == true);
                    resultsHarness.AddTestResult(secondQueueItemWasAdded == true);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

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

                    //Items in Batman.zip
                    string firstItemName  = "Row Item " + "Batman";
                    string secondItemName = "Row Item " + "2013-01-25 Mouthpiece v2";

                    //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 firstItemInZipExists  = testRunner.WaitForName(firstItemName, 1);
                    bool secondItemInZipExists = testRunner.WaitForName(secondItemName, 1);
                    resultsHarness.AddTestResult(firstItemInZipExists == false);
                    resultsHarness.AddTestResult(firstItemInZipExists == false);

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

                    //Get Library Item to Add
                    string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.zip");
                    testRunner.Wait(2);
                    testRunner.Type(rowItemPath);
                    testRunner.Wait(1);
                    testRunner.Type("{Enter}");

                    bool firstItemInZipWasAdded  = testRunner.WaitForName(firstItemName, 2);
                    bool secondItemInZipWasAdded = testRunner.WaitForName(secondItemName, 2);
                    resultsHarness.AddTestResult(firstItemInZipWasAdded == true);
                    resultsHarness.AddTestResult(secondItemInZipWasAdded == 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
        }
Beispiel #17
0
        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));
        }
Beispiel #18
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
        }
Beispiel #19
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 ClickOnExportButton()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    // 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);
                    resultsHarness.AddTestResult(exportWindowExists1 == false, "Export window does not exist");

                    testRunner.ClickByName("Queue Export Button", 5);
                    SystemWindow containingWindow;
                    GuiWidget    exportWindow = testRunner.GetWidgetByName("Export Item Window", out containingWindow, 5);
                    resultsHarness.AddTestResult(exportWindow != null, "Export window does exist");
                    if (exportWindow != null)
                    {
                        exportWindow.CloseOnIdle();
                        testRunner.Wait(.5);
                    }

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

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

            Assert.IsTrue(testHarness.AllTestsPassed(2));
        }
Beispiel #21
0
 public static void EnsureContentMenuOpen(this AutomationRunner testRunner)
 {
     if (!testRunner.WaitForName("FolderBreadCrumbWidget", secondsToWait: 0.2))
     {
         testRunner.ClickByName("Add Content Menu");
     }
 }
        public void QueueThumbnailWidgetOpensPartPreview()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    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");

                    testRunner.ClickByName("Queue Item Thumbnail");

                    SystemWindow containingWindow;
                    GuiWidget    partPreviewWindowExists = testRunner.GetWidgetByName("Part Preview Window", out containingWindow, 3);
                    resultsHarness.AddTestResult(partPreviewWindowExists != null, "Part Preview Window Exists");
                    partPreviewWindowExists.CloseOnIdle();
                    testRunner.Wait(.5);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

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

            Assert.IsTrue(testHarness.AllTestsPassed(2));
        }
        //Test Works
        public void ClickOnCreateButton()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    //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);
            Assert.IsTrue(testHarness.TestCount == 2);             // make sure we ran all our tests
        }
        public void QueueThumbnailWidgetOpensPartPreview()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    bool partPreviewWindowExists1 = testRunner.WaitForName("Part Preview Window Thumbnail", 0);
                    resultsHarness.AddTestResult(partPreviewWindowExists1 == false, "Part Preview Window Does Not Exist");

                    testRunner.ClickByName("Queue Item Thumbnail");

                    SystemWindow containingWindow;
                    GuiWidget    partPreviewWindowExists = testRunner.GetWidgetByName("Part Preview Window Thumbnail", out containingWindow, 3);
                    resultsHarness.AddTestResult(partPreviewWindowExists != null, "Part Preview Window Exists");
                    partPreviewWindowExists.CloseOnIdle();
                    testRunner.Wait(.5);

                    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
        }
        //Test Works
        public void ClickOnExportButton()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    //Make sure that the export window does not exist
                    bool exportWindowExists1 = testRunner.WaitForName("Export Window Queue", 0);
                    resultsHarness.AddTestResult(exportWindowExists1 == false, "Export window does not exist");

                    testRunner.ClickByName("Export Queue Button", 5);
                    SystemWindow containingWindow;
                    GuiWidget    exportWindow = testRunner.GetWidgetByName("Export Window Queue", out containingWindow, 5);
                    resultsHarness.AddTestResult(exportWindow != null, "Export window does exist");
                    if (exportWindow != null)
                    {
                        exportWindow.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
        }
Beispiel #26
0
        public static void CloseSignInAndPrinterSelect(this AutomationRunner testRunner)
        {
            testRunner.WaitForFirstDraw();

            // If there is an auth panel make sure we try and close it
            // Non-MCCentral builds won't have the plugin. Reduce the wait time for these cases
            if (testRunner.WaitForName("Connection Wizard Skip Sign In Button", 1))
            {
                testRunner.ClickByName("Connection Wizard Skip Sign In Button");
            }

            if (testRunner.WaitForName("Cancel Wizard Button", 1))
            {
                testRunner.ClickByName("Cancel Wizard Button");
            }
        }
        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));
        }
        public void SaveAsToDownloads()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    //Navigate to Downloads
                    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);

                    //Click Edit button to make edit controls visible
                    testRunner.ClickByName("3D View Edit");
                    testRunner.Wait(1);

                    for (int i = 0; i <= 2; i++)
                    {
                        testRunner.ClickByName("3D View Copy");
                        testRunner.Wait(1);
                    }


                    //Click Save As button to save changes to the part
                    testRunner.ClickByName("Save As Menu");
                    testRunner.Wait(1);
                    testRunner.ClickByName("Save As Menu Item");
                    testRunner.Wait(1);

                    //Type in name of new part and then save to Downloads
                    testRunner.Type("Save As Downloads");
                    MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
                    testRunner.Wait(1);
                    testRunner.ClickByName("Save As Save Button");

                    //Make sure there is a new Downloads item with a name that matches the new opart
                    testRunner.Wait(1);
                    testRunner.ClickByName("Library Tab");
                    testRunner.ClickByName("Bread Crumb Button Home");
                    testRunner.Wait(1);
                    MatterControlUtilities.NavigateToFolder(testRunner, "Downloads Row Item Collection");
                    resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Save As Downloads", 5));

                    //Do clean up for Downloads
                    testRunner.ClickByName("Row Item Save As Downloads", 2);
                    testRunner.ClickByName("Library Edit Button");
                    testRunner.ClickByName("Library Remove Item Button");

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 1);             // make sure we ran all our tests
        }
Beispiel #29
0
 private static void ClickDialogButton(AutomationRunner testRunner, string buttonName, int expectedLayer)
 {
     testRunner.WaitForName(buttonName, 90);
     Assert.AreEqual(expectedLayer, ApplicationController.Instance.ActivePrinter.Connection.CurrentlyPrintingLayer);
     testRunner.ClickByName(buttonName);
     testRunner.WaitFor(() => !testRunner.NameExists(buttonName), 1);
 }
        public void RemoveButtonClickedRemovesSingleItem()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    //Navigate to Local Library
                    testRunner.ClickByName("Library Tab");
                    MatterControlUtilities.NavigateToFolder(testRunner, "Local Library Row Item Collection");

                    testRunner.Wait(1);

                    string rowItem = "Row Item " + "Calibration - Box";
                    testRunner.ClickByName("Library Edit Button");
                    testRunner.Wait(1);
                    testRunner.ClickByName(rowItem);

                    testRunner.ClickByName("Library Remove Item Button");

                    testRunner.Wait(1);

                    //Make sure that Export Item Window exists after Export button is clicked
                    bool rowItemExists = testRunner.WaitForName(rowItem, 2);
                    resultsHarness.AddTestResult(rowItemExists == false);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 1);             // make sure we ran all our tests
        }