public void LocalLibraryAddButtonAddsMultipleItemsToLibrary()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    //Names of Items to be added
                    string firstItemName  = "Row Item " + "Fennec Fox";
                    string secondItemName = "Row Item " + "Batman";

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

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

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

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

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


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


                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 4);             // make sure we ran all our tests
        }
Beispiel #2
0
        private void CloseAllPrinterTabs(AutomationRunner testRunner)
        {
            // Close all printer tabs
            var mainViewWidget = testRunner.GetWidgetByName("PartPreviewContent", out _) as MainViewWidget;

            foreach (var tab in mainViewWidget.TabControl.AllTabs.Where(t => t.TabContent is PrinterTabPage).ToList())
            {
                if (tab is GuiWidget widget)
                {
                    var closeWidget = widget.Descendants <ImageWidget>().First();
                    closeWidget.InvokeClick();
                }
            }
        }
        private static void WaitForLayerAndResume(AutomationRunner testRunner, int indexToWaitFor)
        {
            testRunner.WaitForName("Resume Button", 30);

            SystemWindow containingWindow;
            GuiWidget    layerNumber = testRunner.GetWidgetByName("Current GCode Layer Edit", out containingWindow, 20);

            layerNumber.Invalidate();
            testRunner.Delay(() => layerNumber.Text == indexToWaitFor.ToString(), 2);

            Assert.IsTrue(layerNumber.Text == indexToWaitFor.ToString());
            testRunner.ClickByName("Resume Button", 1);
            testRunner.Delay(.1);
        }
Beispiel #4
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
        }
Beispiel #5
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>());
        }
Beispiel #6
0
        public void RaftEnabledPassedToSliceEngine()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD", true);

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

                    testRunner.ClickByName("Layer View Tab");

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

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

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


                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 1);             // make sure we ran all our tests
        }
        public void Can_Call_Command_With_AutoMapping()
        {
            var xml     = ContentLoader.GetTextFileContent("Automation.Script2.xml");
            var runner  = new AutomationRunner("xml", ContentLoader.TestDllName);
            var results = runner.RunText(xml);

            Assert.IsTrue(runner.Result.Success);
            //Assert.IsTrue(runner.Result.StartTime < runner.Result.EndTime);

            // Check the command result.
            Assert.IsTrue(runner.Result.CommandResults[0].Success);
            Assert.AreEqual(runner.Result.CommandResults[0].Name, "HelloWorldAutoMap");
            Assert.AreEqual(runner.Result.CommandResults[0].Index, 0);
            Assert.AreEqual((string)runner.Result.CommandResults[0].Item, @"HelloWorldAutoMap kishore true 32 2/2/1979");
        }
        public void Can_Substitue_Variables_And_Command_Args()
        {
            var xml     = ContentLoader.GetTextFileContent("Automation.Script4.xml");
            var runner  = new AutomationRunner("xml", ContentLoader.TestDllName);
            var results = runner.RunText(xml);

            Assert.IsTrue(runner.Result.Success);
            //Assert.IsTrue(runner.Result.StartTime < runner.Result.EndTime);

            // Check the command result.
            Assert.IsTrue(runner.Result.CommandResults[0].Success);
            Assert.AreEqual(runner.Result.CommandResults[0].Name, "HelloWorldAutoMap");
            Assert.AreEqual(runner.Result.CommandResults[0].Index, 0);
            Assert.AreEqual((string)runner.Result.CommandResults[0].Item, "HelloWorldAutoMap kishore.reddy_0.9.7 true 101 2/2/1979");
        }
        private static void SetCheckBoxSetting(AutomationRunner testRunner, PrinterConfig printer, string settingToChange, bool valueToSet)
        {
            var    settingsData = PrinterSettings.SettingsData[settingToChange];
            string checkBoxName = $"{settingsData.PresentationName} Field";

            Assert.IsTrue(printer.Settings.GetValue <bool>(settingToChange) != valueToSet);

            //testRunner.ScrollIntoView(checkBoxName);
            //testRunner.ClickByName(checkBoxName);
            testRunner.SelectSliceSettingsField(settingToChange)
            // give some time for the ui to update if necessary
            .Delay(2);

            Assert.IsTrue(printer.Settings.GetValue <bool>(settingToChange) == valueToSet);
        }
        public static void WaitForPage(this AutomationRunner testRunner, string headerText)
        {
            // Helper methods
            bool HeaderExists(string text)
            {
                var header     = testRunner.GetWidgetByName("HeaderRow", out _);
                var textWidget = header.Children <TextWidget>().FirstOrDefault();

                return(textWidget?.Text.StartsWith(text) ?? false);
            }

            testRunner.WaitFor(() => HeaderExists(headerText));

            Assert.IsTrue(HeaderExists(headerText), "Expected page not found: " + headerText);
        }
Beispiel #11
0
        public static bool NavigateToFolder(AutomationRunner testRunner, string libraryRowItemName)
        {
            bool goodNavigate = true;

            SearchRegion libraryRowItemRegion = testRunner.GetRegionByName(libraryRowItemName, 3);

            goodNavigate &= testRunner.ClickByName(libraryRowItemName);
            goodNavigate &= testRunner.MoveToByName(libraryRowItemName);
            testRunner.Wait(.5);

            goodNavigate &= testRunner.ClickByName("Open Collection", searchRegion: libraryRowItemRegion);
            testRunner.Wait(.5);

            return(goodNavigate);
        }
        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));
        }
Beispiel #14
0
        public void ClickOnLibraryCheckBoxes()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);

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

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

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

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

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

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

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

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

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

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            // NOTE: In the future we may want to make the "Local Library Row Item Collection" not clickable.
            // If that is the case fix this test to click on a child of "Local Library Row Item Collection" instead.
            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 4);             // make sure we ran all our tests
        }
Beispiel #15
0
        public void PauseOnLayerDoesPauseOnPrint()
        {
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner();
                {
                    MatterControlUtilities.PrepForTestRun(testRunner, MatterControlUtilities.PrepAction.CloseSignInAndPrinterSelect);

                    var emualtorProccess = MatterControlUtilities.LaunchAndConnectToPrinterEmulator(testRunner);

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

                    MatterControlUtilities.SwitchToAdvancedSettings(testRunner, resultsHarness);

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

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

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

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

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

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

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

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, maxTimeToRun: 200);

            Assert.IsTrue(testHarness.AllTestsPassed(19));
        }
        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 Can_Fail_With_UnKnown_Command()
        {
            var xml     = ContentLoader.GetTextFileContent("Automation.Script_error1_unknown_command.xml");
            var runner  = new AutomationRunner("xml", ContentLoader.TestDllName);
            var results = runner.RunText(xml);

            // Check the entrie script result.
            Assert.IsFalse(runner.Result.Success);
            //Assert.IsTrue(runner.Result.StartTime < runner.Result.EndTime);

            // Check the command result.
            Assert.IsFalse(runner.Result.CommandResults[0].Success);
            Assert.AreEqual(runner.Result.CommandResults[0].Name, "some-crazy-command");
            Assert.AreEqual(runner.Result.CommandResults[0].Message, "Unknown command : some-crazy-command");
            Assert.AreEqual(runner.Result.CommandResults[0].Index, 0);
        }
Beispiel #18
0
        public static void CloseSignInAndPrinterSelect(this AutomationRunner testRunner)
        {
            testRunner.WaitForFirstDraw();

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

            if (testRunner.WaitForName("Cancel Wizard Button", 1))
            {
                testRunner.ClickByName("Cancel Wizard Button");
            }
        }
Beispiel #19
0
        public static void SaveBedplateToFolder(this AutomationRunner testRunner, string newFileName, string folderName)
        {
            testRunner.ClickByName("Bed Options Menu");
            testRunner.ClickByName("Save As Menu Item");

            testRunner.Delay(1);

            testRunner.Type(newFileName);

            testRunner.NavigateToFolder(folderName);

            testRunner.ClickByName("Accept Button");

            // Give the SaveAs window time to close before returning to the caller
            testRunner.Delay(2);
        }
Beispiel #20
0
        public void CanCallFunc()
        {
            var js     = ContentLoader.GetTextFileContent("Lang.script3.js");
            var runner = new AutomationRunner("js", ContentLoader.TestDllName);

            var results = runner.RunText(js);

            Assert.IsTrue(runner.Result.Success);
            //Assert.IsTrue(runner.Result.StartTime < runner.Result.EndTime);

            // Check the command result.
            Assert.IsTrue(runner.Result.CommandResults[0].Success);
            Assert.AreEqual(runner.Result.CommandResults[0].Name, "HelloWorld");
            Assert.AreEqual(runner.Result.CommandResults[0].Index, 14);
            Assert.AreEqual((string)runner.Result.CommandResults[0].Item, @"HelloWorld return value");
        }
        public void Can_Access_InnerXml_Element()
        {
            var xml     = ContentLoader.GetTextFileContent("Automation.Script6.xml");
            var runner  = new AutomationRunner("xml", ContentLoader.TestDllName);
            var results = runner.RunText(xml);

            Assert.IsTrue(runner.Result.Success);



            // Check the command result.
            Assert.IsTrue(runner.Result.CommandResults[0].Success);
            Assert.AreEqual(runner.Result.CommandResults[0].Name, "CreateEvent");
            Assert.AreEqual(runner.Result.CommandResults[0].Index, 0);
            Assert.AreEqual((string)runner.Result.CommandResults[0].Item, "Disucss .NET in startups");
        }
        public void Can_Call_Command()
        {
            var xml     = ContentLoader.GetTextFileContent("Automation.Script1.xml");
            var runner  = new AutomationRunner("xml", ContentLoader.TestDllName);
            var results = runner.RunText(xml);

            // Check the entrie script result.
            Assert.IsTrue(runner.Result.Success);
            //Assert.IsTrue(runner.Result.StartTime < runner.Result.EndTime);

            // Check the command result.
            Assert.IsTrue(runner.Result.CommandResults[0].Success);
            Assert.AreEqual(runner.Result.CommandResults[0].Name, "HelloWorld");
            Assert.AreEqual(runner.Result.CommandResults[0].Index, 0);
            Assert.AreEqual((string)runner.Result.CommandResults[0].Item, "HelloWorld return value");
        }
        public void Can_Include_External_File()
        {
            var xml      = ContentLoader.GetTextFileContent("Automation.Script7.xml");
            var settings = ContentLoader.GetTextFileContent("Automation.CommonSettings.xml");
            var runner   = new AutomationRunner("xml", ContentLoader.TestDllName);

            runner.Script.Include("commonsettings.xml", settings);

            var results = runner.RunText(xml);

            // Check the command result.
            Assert.IsTrue(runner.Result.CommandResults[0].Success);
            Assert.AreEqual(runner.Result.CommandResults[0].Name, "HelloWorldAutoMap");
            Assert.AreEqual(runner.Result.CommandResults[0].Index, 0);
            Assert.AreEqual((string)runner.Result.CommandResults[0].Item, "HelloWorldAutoMap kishore.reddy_0.9.7 true 101 2/2/1979");
        }
        private static void SetCheckBoxSetting(AutomationRunner testRunner, string settingToChange, bool printer, bool valueToSet)
        {
            var    settingsData = SettingsOrganizer.Instance.GetSettingsData(settingToChange);
            string checkBoxName = $"{settingsData.PresentationName} Field";

            Assert.IsTrue(ActiveSliceSettings.Instance.GetValue <bool>(settingToChange) != valueToSet);

            //testRunner.ScrollIntoView(checkBoxName);
            //testRunner.ClickByName(checkBoxName);
            testRunner.SelectSliceSettingsField(printer ? "Printer" : "Advanced", settingToChange);

            // give some time for the ui to update if necessary
            testRunner.Delay(2);

            Assert.IsTrue(ActiveSliceSettings.Instance.GetValue <bool>(settingToChange) == valueToSet);
        }
        public void Can_Assign_Result_To_Variable()
        {
            var xml    = ContentLoader.GetTextFileContent("Automation.Script9.xml");
            var runner = new AutomationRunner("xml", ContentLoader.TestDllName);

            var results = runner.RunText(xml);

            // Check the command result.
            Assert.IsTrue(runner.Result.CommandResults[0].Success);
            Assert.AreEqual(runner.Result.CommandResults[0].Name, "HelloWorld");
            Assert.AreEqual(runner.Result.CommandResults[0].Index, 0);
            Assert.AreEqual((string)runner.Result.CommandResults[0].Item, "HelloWorld return value");

            // Check that the variable greetingresult get the return value of the command.
            Assert.AreEqual(runner.Script.Get <string>("greetingresult"), "HelloWorld return value");
        }
        public void RemoveButtonRemovesMultipleItems()
        {
            //Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    MatterControlUtilities.PrepForTestRun(testRunner);

                    /*
                     * Tests that when one item is selected
                     * 1. Queue Item count equals three before the test starts
                     * 2. Selecting multiple queue itema and then clicking the Remove button removes the item
                     * 3. Selecting multiple queue items and then clicking the Remove button decreases the queue tab count by one
                     */

                    int queueItemCount = QueueData.Instance.Count;

                    testRunner.Wait(2);

                    testRunner.ClickByName("Queue Edit Button", 2);

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

                    testRunner.ClickByName("Queue Remove Button", 2);

                    testRunner.Wait(1);

                    int queueItemCountAfterRemove = QueueData.Instance.Count;

                    resultsHarness.AddTestResult(queueItemCount - 2 == queueItemCountAfterRemove);

                    bool queueItemExists       = testRunner.WaitForName("Queue Item " + "Batman", 2);
                    bool secondQueueItemExists = testRunner.WaitForName("Queue Item " + "2013-01-25_Mouthpiece_v2", 2);

                    resultsHarness.AddTestResult(queueItemExists == false);
                    resultsHarness.AddTestResult(secondQueueItemExists == false);


                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

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

            Assert.IsTrue(testHarness.AllTestsPassed(3));
        }
        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 Can_Get_Total_Output_Of_Commands()
        {
            var xml     = ContentLoader.GetTextFileContent("Automation.Script3.xml");
            var runner  = new AutomationRunner("xml", ContentLoader.TestDllName);
            var results = runner.RunText(xml);
            var output  = results.Messages(Environment.NewLine);

            var expectedMessage =
                "HelloWorld : HelloWorld message" + Environment.NewLine
                + "HelloWorldAutoMap : HelloWorldAutoMap message" + Environment.NewLine;

            Assert.IsTrue(runner.Result.Success);

            // Check the command result.
            Assert.IsTrue(runner.Result.CommandResults.Count == 2);
            Assert.AreEqual(output, expectedMessage);
        }
Beispiel #29
0
        public void HasHeatedBedCheckedHidesBedTemperatureOptions()
        {
            // Run a copy of MatterControl
            Action <AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
            {
                AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages);
                {
                    MatterControlUtilities.SelectAndAddPrinter(testRunner, "Airwolf 3D", "HD", true);

                    //Navigate to Settings Tab and make sure Bed Temp Text box is visible
                    testRunner.ClickByName("SettingsAndControls");
                    testRunner.Wait(1);
                    testRunner.ClickByName("User Level Dropdown");
                    testRunner.Wait(1);
                    testRunner.ClickByName("Advanced Menu Item");
                    testRunner.Wait(1);
                    testRunner.ClickByName("Filament Tab");
                    testRunner.Wait(1);
                    resultsHarness.AddTestResult(testRunner.WaitForName("Bed Temperature Textbox", 2));

                    //Uncheck Has Heated Bed checkbox and make sure Bed Temp Textbox is not visible
                    testRunner.ClickByName("Printer Tab");
                    testRunner.Wait(1);
                    testRunner.ClickByName("Features Tab");
                    testRunner.Wait(1);
                    testRunner.ClickByName("Has Heated Bed Checkbox");
                    testRunner.Wait(.5);
                    testRunner.ClickByName("Filament Tab");
                    testRunner.Wait(1);
                    bool bedTemperatureTextBoxVisible = testRunner.WaitForName("Bed Temperature Textbox", 2);
                    resultsHarness.AddTestResult(bedTemperatureTextBoxVisible == false);

                    //Make sure Bed Temperature Options are not visible in printer controls
                    testRunner.ClickByName("Controls Tab");
                    bool bedTemperatureControlsWidget = testRunner.WaitForName("Bed Temperature Controls Widget", 2);
                    resultsHarness.AddTestResult(bedTemperatureTextBoxVisible == false);

                    MatterControlUtilities.CloseMatterControl(testRunner);
                }
            };

            AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);

            Assert.IsTrue(testHarness.AllTestsPassed);
            Assert.IsTrue(testHarness.TestCount == 3);             // make sure we ran all our tests
        }
        public void 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);
        }