Example #1
0
        public async Task RenameDownloadsPrintItem()
        {
            await MatterControlUtilities.RunTest(testRunner =>
            {
                testRunner.CloseSignInAndPrinterSelect();

                // Navigate to Downloads Library Provider
                testRunner.NavigateToFolder("Downloads Row Item Collection");
                testRunner.NavigateToFolder("-Temporary Row Item Collection");
                testRunner.InvokeLibraryAddDialog();

                testRunner.CompleteDialog(MatterControlUtilities.GetTestItemPath("Batman.stl"), 2);

                // Rename added item
                testRunner.ClickByName("Row Item Batman.stl");

                testRunner.LibraryRenameSelectedItem();

                testRunner.WaitForName("InputBoxPage Action Button");
                testRunner.Type("Batman Renamed");

                testRunner.ClickByName("InputBoxPage Action Button");

                Assert.IsTrue(testRunner.WaitForName("Row Item Batman Renamed.stl", 2));

                return(Task.CompletedTask);
            });
        }
        public async Task LocalLibraryAddButtonAddZipToLibrary()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                testRunner.AddAndSelectPrinter();

                // Navigate to Local Library
                testRunner.NavigateToFolder("Local Library Row Item Collection");

                // Make sure that Item does not exist before the test begins
                Assert.IsFalse(testRunner.WaitForName("Row Item Batman", 1), "Batman part should not exist at test start");
                Assert.IsFalse(testRunner.WaitForName("Row Item 2013-01-25 Mouthpiece V2", 1), "Mouthpiece part should not exist at test start");

                // Add Library item
                testRunner.InvokeLibraryAddDialog();
                testRunner.Delay(2);
                testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.zip"));
                testRunner.Delay(1);
                testRunner.Type("{Enter}");

                testRunner.WaitForName("Batman Row Item Collection");

                testRunner.DoubleClickByName("Batman Row Item Collection");

                Assert.IsTrue(testRunner.WaitForName("Row Item Batman.stl"), "Batman part should exist after adding");
                Assert.IsTrue(testRunner.WaitForName("Row Item 2013-01-25_Mouthpiece_v2.stl"), "Mouthpiece part should exist after adding");

                return(Task.CompletedTask);
            });
        }
Example #3
0
        public async Task AddOneItemToQueue()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                // Expected = initial + 1
                int expectedCount = QueueData.Instance.ItemCount + 1;

                testRunner.AddAndSelectPrinter();

                testRunner.ChangeToQueueContainer();

                // Click Add button and select files
                testRunner.InvokeLibraryAddDialog();

                // Open Fennec_Fox
                testRunner.CompleteDialog(MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"));

                // Wait for expected outcome
                testRunner.WaitFor(() => QueueData.Instance.ItemCount == expectedCount);

                // Assert - one part  added and queue count increases by one
                Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should increase by 1 when adding 1 item");

                Assert.IsTrue(testRunner.WaitForName("Row Item Fennec_Fox.stl"), "Named widget should exist after add(Fennec_Fox)");

                return(Task.CompletedTask);
            });
        }
Example #4
0
        public async Task AddToQueueMenuItemAddsSingleFile()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();

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

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

                int queueBeforeCount = QueueData.Instance.ItemCount;

                testRunner.Type(queueItemPath);
                testRunner.Delay(1);
                testRunner.Type("{Enter}");
                testRunner.Delay(2);
                Assert.IsTrue(testRunner.WaitForName("Queue Item Fennec_Fox", 2));

                int queueAfterCount = QueueData.Instance.ItemCount;

                Assert.IsTrue(queueAfterCount == queueBeforeCount + 1);

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun);
        }
Example #5
0
        public async Task QueueAddButtonAddsGcodeFile()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();

                int initialQueueCount = QueueData.Instance.ItemCount;

                // Click Add button
                testRunner.ClickByName("Queue Add Button");
                testRunner.Delay(1);

                testRunner.Type(MatterControlUtilities.GetTestItemPath("chichen-itza_pyramid.gcode"));
                testRunner.Delay(1);
                testRunner.Type("{Enter}");

                // Widget should exist
                Assert.IsTrue(testRunner.WaitForName("Queue Item chichen-itza_pyramid", 5), "Widget for added item should exist in control tree");

                // Queue count should increases by one
                Assert.AreEqual(initialQueueCount + 1, QueueData.Instance.ItemCount, "After adding item, queue count should increase by one");

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun);
        }
Example #6
0
        public async Task DownloadsAddButtonAddsMultipleFiles()
        {
            await MatterControlUtilities.RunTest(testRunner =>
            {
                testRunner.CloseSignInAndPrinterSelect();

                // Navigate to Downloads Library Provider
                testRunner.NavigateToFolder("Downloads Row Item Collection");
                testRunner.NavigateToFolder("-Temporary Row Item Collection");

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

                Assert.IsTrue(testRunner.WaitForName("Row Item Fennec_Fox.stl", 2), "Fennec Fox item exists");
                Assert.IsTrue(testRunner.WaitForName("Row Item Batman.stl", 2), "Batman item exists");

                return(Task.CompletedTask);
            });
        }
        public async Task AddToQueueFromLibraryButtonAddsItemsToQueue()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();

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

                //Add an item to the library
                string libraryItemToAdd = MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl");
                testRunner.ClickByName("Library Add Button");

                testRunner.Delay(2);
                testRunner.Type(libraryItemToAdd);
                testRunner.Delay(2);
                testRunner.Type("{Enter}");

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

                int queueCountBeforeAdd = QueueData.Instance.ItemCount;

                //Select both Library Items
                string rowItemOne = "Row Item Calibration - Box";
                testRunner.ClickByName(rowItemOne);

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

                //Click the Add To Queue button
                testRunner.Delay(1);
                MatterControlUtilities.LibraryAddSelectionToQueue(testRunner);
                testRunner.Delay(2);

                //Make sure Queue Count increases by the correct amount
                int queueCountAfterAdd = QueueData.Instance.ItemCount;

                Assert.IsTrue(queueCountAfterAdd == queueCountBeforeAdd + 2);

                //Navigate to the Print Queue
                testRunner.ClickByName("Queue Tab");
                testRunner.Delay(1);

                //Test that both added print items exist
                string queueItemOne         = "Queue Item Calibration - Box";
                string queueItemTwo         = "Queue Item Fennec_Fox";
                bool   queueItemOneWasAdded = testRunner.WaitForName(queueItemOne, 2);
                bool   queueItemTwoWasAdded = testRunner.WaitForName(queueItemTwo, 2);

                Assert.IsTrue(queueItemOneWasAdded == true);
                Assert.IsTrue(queueItemTwoWasAdded == true);

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun);
        }
        public async Task LocalLibraryAddButtonAddAMFToLibrary()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();

                string itemName = "Row Item Rook";

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

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

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

                //Get Library Item to Add
                string rowItemPath = MatterControlUtilities.GetTestItemPath("Rook.amf");
                testRunner.Delay(2);
                testRunner.Type(rowItemPath);
                testRunner.Delay(1);
                testRunner.Type("{Enter}");

                bool rowItemWasAdded = testRunner.WaitForName(itemName, 2);
                Assert.IsTrue(rowItemWasAdded == true);

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun, overrideWidth : 1024, overrideHeight : 800);
        }
Example #9
0
        public async Task AddTwoItemsToQueue()
        {
            await MatterControlUtilities.RunTest((testRunner) =>
            {
                // Expected = initial + 2;
                int expectedCount = QueueData.Instance.ItemCount + 2;

                testRunner.AddAndSelectPrinter();

                testRunner.ChangeToQueueContainer();

                // Click Add button and select files
                testRunner.InvokeLibraryAddDialog();

                // Open Fennec_Fox, Batman files
                testRunner.CompleteDialog(
                    string.Format(
                        "\"{0}\" \"{1}\"",
                        MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"),
                        MatterControlUtilities.GetTestItemPath("Batman.stl")),
                    secondsToWait: 2);

                // Wait for expected outcome
                testRunner.WaitFor(() => QueueData.Instance.ItemCount == expectedCount);

                // Assert - two parts added and queue count increases by two
                Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should increase by 2 when adding 2 items");
                Assert.IsTrue(testRunner.WaitForName("Row Item Fennec_Fox.stl"), "Named widget should exist after add(Fennec_Fox)");
                Assert.IsTrue(testRunner.WaitForName("Row Item Batman.stl"), "Named widget should exist after add(Batman)");

                return(Task.CompletedTask);
            });
        }
        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));
        }
        public void AddToQueueMenuItemAddsSingleFile()
        {
            // 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);

                    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
        }
Example #12
0
        public async Task AddToQueueMenuItemAddsMultipleFiles()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();

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

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

                string pathToSecondQueueItem = MatterControlUtilities.GetTestItemPath("Batman.stl");
                string textForBothQueueItems = string.Format("\"{0}\" \"{1}\"", queueItemPath, pathToSecondQueueItem);

                int queueBeforeAddCount = QueueData.Instance.ItemCount;

                testRunner.Type(textForBothQueueItems);
                testRunner.Delay(2);
                testRunner.Type("{Enter}");
                testRunner.Delay(2);
                Assert.IsTrue(testRunner.WaitForName("Queue Item Fennec_Fox", 2));
                Assert.IsTrue(testRunner.WaitForName("Queue Item Batman", 2));

                int queueAfterAddCount = QueueData.Instance.ItemCount;

                Assert.IsTrue(queueAfterAddCount == queueBeforeAddCount + 2);

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun);
        }
Example #13
0
        public async Task AddToQueueMenuItemAddsZipFiles()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();

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

                int beforeCount = QueueData.Instance.ItemCount;

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

                Assert.IsTrue(testRunner.WaitForName("Queue Item Batman", 1));
                Assert.IsTrue(testRunner.WaitForName("Queue Item 2013-01-25_Mouthpiece_v2", 1));
                Assert.IsTrue(QueueData.Instance.ItemCount == beforeCount + 2);

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun);
        }
        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 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));
        }
        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);
        }
Example #17
0
        public async Task ExportToZipImportFromZip()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                // Ensure output file does not exist
                string exportZipPath = MatterControlUtilities.GetTestItemPath("TestExportZip.zip");
                if (File.Exists(exportZipPath))
                {
                    File.Delete(exportZipPath);
                }

                testRunner.CloseSignInAndPrinterSelect();

                Assert.AreEqual(4, QueueData.Instance.ItemCount, "Queue should initially have 4 items");

                // Invoke Queue -> Export to Zip dialog
                testRunner.ClickByName("Queue... Menu", 2);
                testRunner.Delay(.2);
                testRunner.ClickByName(" Export to Zip Menu Item", 2);
                testRunner.Delay(2);
                testRunner.Type(exportZipPath);
                testRunner.Delay(2);
                testRunner.Type("{Enter}");

                testRunner.Delay(() => File.Exists(exportZipPath), 3);
                Assert.IsTrue(File.Exists(exportZipPath), "Queue was exported to zip file, file exists on disk at expected path");

                // Import the exported zip file and confirm the Queue Count increases by 3
                testRunner.ClickByName("Queue Add Button");
                testRunner.Delay(1);
                testRunner.Type(exportZipPath);
                testRunner.Delay(1);
                testRunner.Type("{Enter}");

                testRunner.Delay(() => QueueData.Instance.ItemCount == 8, 5);
                Assert.AreEqual(8, QueueData.Instance.ItemCount, "All parts imported successfully from exported zip");

                testRunner.Delay(.3);

                try
                {
                    if (File.Exists(exportZipPath))
                    {
                        File.Delete(exportZipPath);
                    }
                }
                catch { }

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd : QueueTemplate.Three_Queue_Items);
        }
Example #18
0
        public async Task ExportAsGcode()
        {
            await MatterControlUtilities.RunTest(testRunner =>
            {
                testRunner.WaitForFirstDraw();

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

                //Navigate to Downloads Library Provider
                testRunner.NavigateToFolder("Print Queue Row Item Collection");
                testRunner.InvokeLibraryAddDialog();

                //Get parts to add
                string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl");
                testRunner.Delay()
                .Type(MatterControlUtilities.GetTestItemPath("Batman.stl"))
                .Delay()
                .Type("{Enter}");

                //Get test results
                testRunner.ClickByName("Row Item Batman.stl")
                .ClickByName("Print Library Overflow Menu")
                .ClickByName("Export Menu Item")
                .WaitForName("Export Item Window");

                string gcodeOutputPath = MatterControlUtilities.PathToExportGcodeFolder;
                Directory.CreateDirectory(gcodeOutputPath);
                string fullPathToGcodeFile = Path.Combine(gcodeOutputPath, "Batman");

                testRunner.ClickByName("Machine File (G-Code) Button")
                .ClickByName("Export Button")
                .Delay()
                .Type(fullPathToGcodeFile)
                .Type("{Enter}")
                .WaitFor(() => File.Exists(fullPathToGcodeFile + ".gcode"), 10);

                Assert.IsTrue(File.Exists(fullPathToGcodeFile + ".gcode"), "Exported file not found");

                // add an item to the bed
                fullPathToGcodeFile = Path.Combine(gcodeOutputPath, "Cube");
                testRunner.AddItemToBed()
                .ClickByName("PrintPopupMenu")
                .ClickByName("Export GCode Button")
                .Type(fullPathToGcodeFile)
                .Type("{Enter}")
                .Delay();

                Assert.IsTrue(File.Exists(fullPathToGcodeFile + ".gcode"), "Exported file not found");

                return(Task.FromResult(0));
            });
        }
        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 #20
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 #21
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 #22
0
        public async Task ExportAsGcode()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();

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

                string firstItemName = "Queue 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 dialog
                testRunner.Delay(1);
                testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.stl"));
                testRunner.Delay(1);
                testRunner.Type("{Enter}");

                //Get test results
                Assert.IsTrue(testRunner.WaitForName(firstItemName, 2) == true);

                testRunner.ClickByName("Queue Export Button");
                testRunner.Delay(2);

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

                string gcodeOutputPath = MatterControlUtilities.PathToExportGcodeFolder;

                Directory.CreateDirectory(gcodeOutputPath);

                string fullPathToGcodeFile = Path.Combine(gcodeOutputPath, "Batman");
                testRunner.Type(fullPathToGcodeFile);
                testRunner.Type("{Enter}");
                testRunner.Delay(2);

                Console.WriteLine(gcodeOutputPath);

                Assert.IsTrue(File.Exists(fullPathToGcodeFile + ".gcode") == true);

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun);
        }
Example #23
0
        public async Task ThumbnailGenerationMode()
        {
            await MatterControlUtilities.RunTest(async (testRunner) =>
            {
                // Automation tests should initialize with orthographic thumbnails
                var item     = new FileSystemFileItem(MatterControlUtilities.GetTestItemPath("Rook.amf"));
                var provider = ApplicationController.Instance.Library.GetContentProvider(item);

                // Generate thumbnail
                var stopWatch = Stopwatch.StartNew();
                await provider.GetThumbnail(item, 400, 400);

                Assert.Less(stopWatch.ElapsedMilliseconds, 2000, "Elapsed thumbnail generation for Rook.amf should be less than 2 seconds for expected orthographic mode");
            });
        }
        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
        }
        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 async Task RemoveButtonClickedRemovesMultipleItems()
        {
            AutomationTest testToRun = (testRunner) =>
            {
                testRunner.CloseSignInAndPrinterSelect();

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

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

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

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

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

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

                testRunner.Delay(1);

                // Make sure row items exist before remove
                Assert.IsTrue(testRunner.WaitForName(rowItemOne, 2), "rowItemOne should exist before remove");
                Assert.IsTrue(testRunner.WaitForName(rowItemTwo, 2), "rowItemTwo should exist before remove");

                // Remove items
                MatterControlUtilities.LibraryRemoveSelectedItem(testRunner);
                testRunner.Delay(1);

                // Make sure both selected items are removed
                Assert.IsFalse(testRunner.WaitForName(rowItemOne, 2), "rowItemOne should *not* exist after remove");
                Assert.IsFalse(testRunner.WaitForName(rowItemTwo, 2), "rowItemTwo should *not* exist after remove");

                return(Task.FromResult(0));
            };

            await MatterControlUtilities.RunTest(testToRun);
        }
        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 async Task ParentFolderRefreshedOnPathPop()
        {
            // Expected: When descending into a child folder and moving items into the parent, popping the path to the parent should refresh and show the moved content
            await MatterControlUtilities.RunTest(testRunner =>
            {
                testRunner.AddAndSelectPrinter();

                // Navigate to Local Library
                testRunner.NavigateToFolder("Local Library Row Item Collection");

                string folderID = testRunner.CreateChildFolder("New Folder");

                testRunner.DoubleClickByName(folderID);

                // Add Library item
                testRunner.InvokeLibraryAddDialog();
                testRunner.Delay(2);
                testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.stl"));
                testRunner.Delay(1);
                testRunner.Type("{Enter}");

                string newFileID = "Row Item Batman";

                testRunner.ClickByName(newFileID);

                testRunner.LibraryMoveSelectedItem();

                testRunner.NavigateToFolder("Local Library Row Item Collection");

                // Click Move
                testRunner.ClickByName("Accept Button");

                // Wait for closed window/closed row
                testRunner.WaitForWidgetDisappear("Move Item Window", 5);
                testRunner.WaitForWidgetDisappear("Row Item Batman", 2);

                // Return to the Local Library folder
                testRunner.ClickByName("Library Up Button");

                // Assert that the expected item appears in the parent after popping the path
                testRunner.ClickByName(newFileID);

                return(Task.CompletedTask);
            });
        }