Beispiel #1
0
        public static void AddItemToBedplate(this AutomationRunner testRunner, string containerName = "Calibration Parts Row Item Collection", string partName = "Row Item Calibration - Box.stl")
        {
            if (!testRunner.NameExists(partName, 1) && !string.IsNullOrEmpty(containerName))
            {
                testRunner.NavigateToFolder(containerName);
            }

            var partWidget = testRunner.GetWidgetByName(partName, out _) as ListViewItemBase;

            if (!partWidget.IsSelected)
            {
                testRunner.ClickByName(partName);
            }
            testRunner.ClickByName("Print Library Overflow Menu");

            var view3D      = testRunner.GetWidgetByName("View3DWidget", out _) as View3DWidget;
            var scene       = view3D.InteractionLayer.Scene;
            var preAddCount = scene.Children.Count();

            testRunner.ClickByName("Add to Bed Menu Item");
            // wait for the object to be added
            testRunner.WaitFor(() => scene.Children.Count == preAddCount + 1);
            // wait for the object to be done loading
            var insertionGroup = scene.Children.LastOrDefault() as InsertionGroupObject3D;

            if (insertionGroup != null)
            {
                testRunner.WaitFor(() => scene.Children.LastOrDefault() as InsertionGroupObject3D != null, 10);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Adds the given asset names to the local library and validates the result
        /// </summary>
        /// <param name="testRunner"></param>
        /// <param name="assetNames">The test assets to add to the library</param>
        public static void AddTestAssetsToLibrary(this AutomationRunner testRunner, params string[] assetNames)
        {
            // Switch to the Local Library tab
            testRunner.NavigateToFolder("Local Library Row Item Collection");

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

            // Add Library item
            testRunner.InvokeLibraryAddDialog();

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

            testRunner.CompleteDialog(fullQuotedAssetPaths);

            // Assert that the added items *are* in the list
            foreach (string assetName in assetNames)
            {
                string friendlyName = Path.GetFileNameWithoutExtension(assetName);
                Assert.IsTrue(testRunner.WaitForName($"Row Item {friendlyName}"), $"{friendlyName} part should exist after adding");
            }
        }
        public static void CreateAndRenameLocalLibraryFolder(GuiWidget container, double secondsBetweenClicks = .1)
        {
            AutomationRunner             testRunner;
            EventHandler <DrawEventArgs> beforeDraw = null;

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

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

                    testRunner.ClickByName("Library Edit Button");
                    testRunner.ClickByName("Row Item Calibration - Box");
                    testRunner.Delay(2);
                    MatterControlUtilities.LibraryAddSelectionToQueue(testRunner);
                    testRunner.ClickByName("Queue Tab");
                });
                container.BeforeDraw -= beforeDraw;
            };
            container.BeforeDraw += beforeDraw;
        }
Beispiel #6
0
 public static void ChangeToQueueContainer(this AutomationRunner testRunner)
 {
     testRunner.NavigateToFolder("Print Queue Row Item Collection");
 }