Example #1
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
        }
        public static void CreateAndRenameLocalLibraryFolder(GuiWidget container, double secondsBetweenClicks = .1)
        {
            AutomationRunner             testRunner;
            EventHandler <DrawEventArgs> beforeDraw = null;

            beforeDraw = (sender, e) =>
            {
                testRunner = new AutomationRunner();
                Task.Run(() =>
                {
                    testRunner.ClickByName("Library Tab");
                    testRunner.NavigateToFolder("Local Library Row Item Collection");
                    testRunner.ClickByName("Create Folder From Library Button");
                    testRunner.Delay(2);
                    testRunner.Type("New Folder");
                    testRunner.ClickByName("Create Folder Button");
                    testRunner.ClickByName("Library Edit Button");
                    testRunner.ClickByName("Row Item New Folder");
                    MatterControlUtilities.LibraryRenameSelectedItem(testRunner);
                    testRunner.Delay(.5);
                    testRunner.Type("Renamed Folder");
                    testRunner.ClickByName("Rename Button");
                });
                container.BeforeDraw -= beforeDraw;
            };
            container.BeforeDraw += beforeDraw;
        }
        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));
        }
Example #4
0
        public static void CreateAndRenameLocalLibraryFolder(GuiWidget container, double secondsBetweenClicks = .1)
        {
            AutomationRunner testrunner;
            DrawEventHandler beforeDraw = null;

            beforeDraw = (sender, e) =>
            {
                testrunner = new AutomationRunner();
                Task.Run(() =>
                {
                    testrunner.ClickByName("Library Tab");
                    NavigateToFolder(testrunner, "Local Library Row Item Collection");
                    testrunner.ClickByName("Create Folder From Library Button");
                    testrunner.Wait(2);
                    testrunner.Type("New Folder");
                    testrunner.ClickByName("Create Folder Button");
                    testrunner.ClickByName("Library Edit Button");
                    testrunner.ClickByName("Row Item New Folder");
                    testrunner.ClickByName("Rename From Library Button");
                    testrunner.Wait(2);
                    testrunner.Type("Renamed Folder");
                    testrunner.ClickByName("Rename Button");
                });
                container.DrawBefore -= beforeDraw;
            };
            container.DrawBefore += beforeDraw;
        }
        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);
        }
        public void ClickCreatePartSheetButton()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    MatterControlUtilities.PrepForTestRun(testRunner);

                    /*
                     * Tests that when the Remove All menu item is clicked
                     * 1. Queue Item count is set to zero
                     * 2. All queue row items that were previously in the queue are removed
                     */

                    bool queueEmpty     = true;
                    int  queueItemCount = QueueData.Instance.Count;

                    if (queueItemCount == 3)
                    {
                        queueEmpty = false;
                    }

                    resultsHarness.AddTestResult(queueEmpty == false);
                    testRunner.ClickByName("Queue... Menu", 2);
                    testRunner.ClickByName(" Create Part Sheet Menu Item", 2);
                    testRunner.Wait(2);

                    string pathToSavePartSheet   = MatterControlUtilities.GetTestItemPath("CreatePartSheet");
                    string validatePartSheetPath = Path.Combine("..", "..", "..", "TestData", "QueueItems", "CreatePartSheet.pdf");

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

                    bool partSheetCreated = File.Exists(validatePartSheetPath);

                    testRunner.Wait(2);
                    resultsHarness.AddTestResult(partSheetCreated == true);


                    if (File.Exists(validatePartSheetPath))
                    {
                        File.Delete(validatePartSheetPath);
                    }

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

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

            Assert.IsTrue(testHarness.AllTestsPassed(5));
        }
Example #8
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 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
        }
Example #10
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
        }
Example #11
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));
        }
Example #12
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));
        }
Example #13
0
        public static void AddAndSelectPrinter(this AutomationRunner testRunner, string make = "Airwolf 3D", string model = "HD")
        {
            testRunner.GetWidgetByName("WidescreenPanel", out SystemWindow systemWindow, 10);

            // make sure we wait for MC to be up and running
            testRunner.WaitforDraw(systemWindow);

            // Click 'Add Printer' if not on screen
            if (!testRunner.NameExists("Select Make", 0.2))
            {
                if (!testRunner.NameExists("Create Printer", 0.2))
                {
                    // go to the start page
                    testRunner.ClickByName("Hardware Tab");
                    testRunner.ClickByName("Create Printer");
                }
                else
                {
                    if (testRunner.NameExists("Print Button", .2))
                    {
                        testRunner.ClickByName("Print Button");
                    }
                    else
                    {
                        testRunner.ClickByName("Create Printer");
                    }
                }
            }

            testRunner.ClickByName("Select Make");
            testRunner.WaitFor(() => testRunner.WidgetExists <PopupWidget>());
            testRunner.Type(make);
            testRunner.Type("{Enter}");
            testRunner.WaitFor(() => !testRunner.WidgetExists <PopupWidget>());

            testRunner.ClickByName("Select Model");
            testRunner.WaitFor(() => testRunner.WidgetExists <PopupWidget>());
            testRunner.Type(model);
            testRunner.Type("{Enter}");
            testRunner.WaitFor(() => !testRunner.WidgetExists <PopupWidget>());

            // An unpredictable period of time will pass between Clicking Save, everything reloading and us returning to the caller.
            // Block until ReloadAll has completed then close and return to the caller, at which point hopefully everything is reloaded.
            testRunner.ClickByName("Next Button");

            testRunner.WaitFor(() => testRunner.WidgetExists <SetupStepComPortOne>());
            testRunner.ClickByName("Cancel Wizard Button");
            testRunner.WaitFor(() => !testRunner.WidgetExists <SetupStepComPortOne>());
        }
        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
        }
        public void RenameDownloadsPrintItem()
        {
            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(2);

                    testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.stl"));
                    testRunner.Wait(1);
                    testRunner.Type("{Enter}");

                    //Rename added item
                    testRunner.ClickByName("Library Edit Button", 2);
                    testRunner.ClickByName("Row Item Batman");
                    testRunner.ClickByName("Rename From Library Button", 2);
                    testRunner.Wait(2);
                    testRunner.Type("Batman Renamed");
                    testRunner.ClickByName("Rename Button");
                    resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Batman Renamed", 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 == 1);
        }
        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 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
        }
Example #18
0
        public void VerifyFocusMakesTextWidgetEditable()
        {
            TextEditWidget editField    = null;
            SystemWindow   systemWindow = new SystemWindow(300, 200)
            {
                BackgroundColor = RGBA_Bytes.Black,
            };

            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                UiThread.RunOnIdle(editField.Focus);
                AutomationRunner testRunner = new AutomationRunner();
                testRunner.Wait(1);

                // Now do the actions specific to this test. (replace this for new tests)
                testRunner.Type("Test Text");

                resultsHarness.AddTestResult(editField.Text == "Test Text", "validate text is typed");

                systemWindow.CloseOnIdle();
            };

            editField = new TextEditWidget(pixelWidth: 200)
            {
                HAnchor = HAnchor.ParentCenter,
                VAnchor = VAnchor.ParentCenter,
            };
            systemWindow.AddChild(editField);

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

            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 1);             // make sure we can all our tests
        }
        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)
                {
                    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);
            Assert.IsTrue(testHarness.TestCount == 2);             // make sure we ran all our tests
        }
Example #20
0
        public void SaveAsToQueue()
        {
            // 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("Row Item Calibration - Box");
                    MatterControlUtilities.LibraryEditSelectedItem(testRunner);
                    testRunner.Wait(1);

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

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

                    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 Print Queue
                    testRunner.Type("Save As Print Queue");
                    MatterControlUtilities.NavigateToFolder(testRunner, "Print Queue Row Item Collection");
                    testRunner.Wait(1);
                    testRunner.ClickByName("Save As Save Button");

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

                    //Make sure there is a new Queue item with a name that matches the new part
                    testRunner.Wait(1);
                    testRunner.ClickByName("Queue Tab");
                    testRunner.Wait(1);
                    resultsHarness.AddTestResult(testRunner.WaitForName("Queue Item Save As Print Queue", 5));

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed(1));
        }
Example #21
0
        public static void RenameLibraryItem(GuiWidget container, double secondsBetweenClicks = .1)
        {
            AutomationRunner testRunner;
            DrawEventHandler beforeDraw = null;

            beforeDraw = (sender, e) =>
            {
                testRunner = new AutomationRunner();
                Task.Run(() =>
                {
                    testRunner.ClickByName("Library Tab");
                    NavigateToFolder(testRunner, "Local Library Row Item Collection");

                    testRunner.ClickByName("Library Edit Button");
                    testRunner.ClickByName("Row Item Calibration - Box");
                    testRunner.Wait(.5);
                    MatterControlUtilities.LibraryRenameSelectedItem(testRunner);
                    testRunner.Wait(.5);
                    testRunner.Type("Renamed Calibration Cube");
                    testRunner.ClickByName("Rename Button");
                });
                container.BeforeDraw -= beforeDraw;
            };
            container.BeforeDraw += beforeDraw;
        }
Example #22
0
        public static void AddAndSelectPrinter(AutomationRunner testRunner, string make, string model)
        {
            string manufacturer   = make + " Menu Item";
            string printer        = model + " Menu Item";
            string printerProfile = String.Format("{0} {1} Profile", make, model);

            testRunner.ClickByName("Printers... Menu", 2);

            testRunner.ClickByName("Add New Printer... Menu Item", 2);

            testRunner.ClickByName("Connection Wizard Skip Sign In Button", 2);

            testRunner.ClickByName("Select Make", 2);

            testRunner.Wait(.2);
            testRunner.Type(make);

            testRunner.ClickByName(manufacturer, 2);

            testRunner.ClickByName("Select Model", 2);

            testRunner.ClickByName(printer, 2);

            testRunner.ClickByName("Save & Continue Button", 2);
            testRunner.Wait(2);

            testRunner.ClickByName("Cancel Wizard Button", 2);
            testRunner.Wait(1);
        }
        public void DownloadsAddButtonAddsMultipleFiles()
        {
            // Run a copy of MatterControl
            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);

                    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 DownloadsAddButtonAddsZipFiles()
        {
            // 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(2);

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


                    resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Chinese Dragon", 2) == true);
                    resultsHarness.AddTestResult(testRunner.WaitForName("Row Item chichen-itza pyramid", 2) == true);
                    resultsHarness.AddTestResult(testRunner.WaitForName("Row Item Circle Calibration", 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 == 3);
        }
        public void AddSingleItemToQueue()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    MatterControlUtilities.PrepForTestRun(testRunner);

                    /*
                     * Tests that Queue Add button adds a single part to queue:
                     * 1. The Queue count is increased by 1
                     * 2. A QueueRowItem is 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);
                    testRunner.Wait(2);

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

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


                    //Make sure single part is added and queue count increases by one
                    bool fennecFoxPartWasAdded = testRunner.WaitForName("Queue Item " + "Fennec_Fox", 2);
                    resultsHarness.AddTestResult(fennecFoxPartWasAdded == true);

                    int queueCountAfterAdd = QueueData.Instance.Count;

                    resultsHarness.AddTestResult(queueCountBeforeAdd + 1 == queueCountAfterAdd);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed(2));
        }
Example #26
0
        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));
        }
        public void RenameButtonRenameLocalLibraryItem()
        {
            // 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");

                    //Create New Folder
                    testRunner.ClickByName("Create Folder From Library Button");
                    testRunner.Wait(.5);
                    testRunner.Type("New Folder");
                    testRunner.Wait(.5);
                    testRunner.ClickByName("Create Folder Button");

                    //Check for Created Folder
                    string newLibraryFolder    = "New Folder Row Item Collection";
                    bool   newFolderWasCreated = testRunner.WaitForName(newLibraryFolder, 1);
                    resultsHarness.AddTestResult(newFolderWasCreated == true);

                    testRunner.ClickByName("Library Edit Button");
                    testRunner.ClickByName("New Folder Row Item Collection");
                    MatterControlUtilities.LibraryRenameSelectedItem(testRunner);
                    testRunner.Wait(.5);
                    testRunner.Type("Renamed Library Folder");
                    testRunner.ClickByName("Rename Button");

                    //Make sure that renamed Library Folder Exists
                    bool renamedLibraryFolderExists = testRunner.WaitForName("Renamed Library Folder Row Item Collection", 2);
                    resultsHarness.AddTestResult(renamedLibraryFolderExists == 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
        }
        public void QueueAddButtonAddsAMF()
        {
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    MatterControlUtilities.PrepForTestRun(testRunner);

                    /* Tests that when the Queue Copy button is clicked:
                     * 1. QueueCount = Zero
                     * 2. Add button can add single .amf file to the queue
                     * 3. Queue count inceases by one
                     */
                    int queueCountBeforeTest = QueueData.Instance.Count;

                    //Click Add button
                    testRunner.ClickByName("Queue Add Button", 2);
                    testRunner.Wait(1);

                    string pathToType = MatterControlUtilities.GetTestItemPath("Rook.amf");

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


                    //Make sure Queue Count increases by one
                    int queueCountAfterAMFIsAdded = QueueData.Instance.Count;

                    resultsHarness.AddTestResult(queueCountAfterAMFIsAdded == queueCountBeforeTest + 1);

                    //Make sure amf queue item is added
                    bool firstQueueItemExists = testRunner.WaitForName("Queue Item " + "Rook", 1);
                    resultsHarness.AddTestResult(firstQueueItemExists == true);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed(2));
        }
Example #29
0
        /// <summary>
        /// Types the specified text into the dialog and sends {Enter} to complete the interaction
        /// </summary>
        /// <param name="testRunner">The TestRunner to interact with</param>
        /// <param name="textValue">The text to type</param>
        public static void CompleteDialog(this AutomationRunner testRunner, string textValue, double secondsToWait = 2)
        {
            // AutomationDialog requires no delay
            if (AggContext.FileDialogs is AutomationDialogProvider)
            {
                // Wait for text widget to have focus
                var widget = testRunner.GetWidgetByName("Automation Dialog TextEdit", out _, 5);
                testRunner.WaitFor(() => widget.ContainsFocus);
            }
            else
            {
                testRunner.Delay(secondsToWait);
            }

            testRunner.Type(textValue);

            testRunner.Type("{Enter}");
            testRunner.WaitForWidgetDisappear("Automation Dialog TextEdit", 5);
        }
        public void LocalLibraryAddButtonAddSingleItemToLibrary()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    MatterControlUtilities.PrepForTestRun(testRunner);

                    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.GetTestItemPath("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
        }