From 41378d2286abfb40f0fff34c50a6714d485c0510 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Wed, 30 Aug 2017 13:41:49 -0700 Subject: [PATCH] Getting more tests passing --- ApplicationView/WidescreenPanel.cs | 1 + CustomWidgets/ExportPrintItemPage.cs | 4 +- PartPreviewWindow/PlusTabPage.cs | 3 +- .../SetupStepMakeModelName.cs | 2 +- .../AndroidNetworkTroubleshootingPage.cs | 7 +- StaticData/Translations/Master.txt | 15 +++ Submodules/agg-sharp | 2 +- .../CheckBoxInLibraryIsClickable.cs | 79 ---------------- .../ExportItemWindowTests.cs | 13 +-- .../FileMenuTest.cs | 92 ------------------- .../LibraryActionTests.cs | 6 +- .../LocalLibraryTests.cs | 2 +- .../MatterControl.AutomationTests.csproj | 1 - .../PrintingTests.cs | 4 +- .../MatterControl/MatterControlUtilities.cs | 17 ++-- 15 files changed, 47 insertions(+), 201 deletions(-) delete mode 100644 Tests/MatterControl.AutomationTests/CheckBoxInLibraryIsClickable.cs diff --git a/ApplicationView/WidescreenPanel.cs b/ApplicationView/WidescreenPanel.cs index b9d53fae1..185d37fb7 100644 --- a/ApplicationView/WidescreenPanel.cs +++ b/ApplicationView/WidescreenPanel.cs @@ -113,6 +113,7 @@ namespace MatterHackers.MatterControl { public BrandMenuButton() { + Name = "MatterControl BrandMenuButton"; var buttonView = new FlowLayoutWidget() { HAnchor = HAnchor.Stretch, diff --git a/CustomWidgets/ExportPrintItemPage.cs b/CustomWidgets/ExportPrintItemPage.cs index 4ba402e22..491e68c9e 100644 --- a/CustomWidgets/ExportPrintItemPage.cs +++ b/CustomWidgets/ExportPrintItemPage.cs @@ -87,7 +87,8 @@ namespace MatterHackers.MatterControl { HAnchor = HAnchor.Left, Margin = commonMargin, - Cursor = Cursors.Hand + Cursor = Cursors.Hand, + Name = plugin.ButtonText + " Button" }; contentRow.AddChild(pluginButton); @@ -137,6 +138,7 @@ namespace MatterHackers.MatterControl } var exportButton = textImageButtonFactory.Generate("Export".Localize()); + exportButton.Name = "Export Button"; exportButton.Click += (s, e) => { string fileTypeFilter = ""; diff --git a/PartPreviewWindow/PlusTabPage.cs b/PartPreviewWindow/PlusTabPage.cs index d466c633b..592789b16 100644 --- a/PartPreviewWindow/PlusTabPage.cs +++ b/PartPreviewWindow/PlusTabPage.cs @@ -46,7 +46,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow public PlusTabPage(TabControl tabControl, PrinterConfig printer, ThemeConfig theme, PrintItemWrapper printItem) : base(FlowDirection.TopToBottom) { - this.Name = "+"; + this.Name = "+ Tab Page"; this.HAnchor = HAnchor.Stretch; this.VAnchor = VAnchor.Stretch; this.Padding = 15; @@ -79,6 +79,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow }; var createPrinter = theme.ButtonFactory.Generate("Create Printer".Localize()); + createPrinter.Name = "Create Printer"; createPrinter.Margin = buttonSpacing; createPrinter.HAnchor = HAnchor.Left; createPrinter.Click += (s, e) => diff --git a/PrinterControls/PrinterConnections/SetupStepMakeModelName.cs b/PrinterControls/PrinterConnections/SetupStepMakeModelName.cs index fecdb55e1..97a9ad198 100644 --- a/PrinterControls/PrinterConnections/SetupStepMakeModelName.cs +++ b/PrinterControls/PrinterConnections/SetupStepMakeModelName.cs @@ -115,7 +115,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections LoadCalibrationPrints(); #if __ANDROID__ - UiThread.RunOnIdle(WizardWindow.ChangeToPage); + UiThread.RunOnIdle(() => WizardWindow.ChangeToPage()); #else if (AggContext.OperatingSystem == OSType.Windows) { diff --git a/SetupWizard/AndroidNetworkTroubleshootingPage.cs b/SetupWizard/AndroidNetworkTroubleshootingPage.cs index eaef4df85..8ed37a1fd 100644 --- a/SetupWizard/AndroidNetworkTroubleshootingPage.cs +++ b/SetupWizard/AndroidNetworkTroubleshootingPage.cs @@ -42,7 +42,6 @@ namespace MatterHackers.MatterControl public class NetworkTroubleshooting : WizardPage { public NetworkTroubleshooting() - : base(unlocalizedTextForTitle: "Network Troubleshooting".Localize()) { string matterhackersStatusString = "MatterControl was unable to connect to the Internet. Please check your Wifi connection and try again".Localize(); contentRow.AddChild(new TextWidget(matterhackersStatusString + "...", 0, 0, 12, textColor: ActiveTheme.Instance.PrimaryTextColor)); @@ -59,9 +58,9 @@ namespace MatterHackers.MatterControl }; //Add buttons to buttonContainer - footerRow.AddChild(configureButton); - footerRow.AddChild(new HorizontalSpacer()); - footerRow.AddChild(cancelButton); + AddPageAction(configureButton); + + cancelButton.Visible = true; } } } diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index 150366cb4..555402c2d 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -4477,3 +4477,18 @@ Translated:Build: English:Status: Translated:Status: +English:Export selection to: +Translated:Export selection to: + +English:Machine File (G-Code) +Translated:Machine File (G-Code) + +English:Machine File (X3G) +Translated:Machine File (X3G) + +English:Print Notification Settings: +Translated:Print Notification Settings: + +English:NOTE: Standard messaging rates may apply. +Translated:NOTE: Standard messaging rates may apply. + diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 8754ac3a1..e96e08006 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 8754ac3a1edb6e8cfb904f3087cfec819d2416c0 +Subproject commit e96e080061c20035b7876ce9c11eb1f7253e7556 diff --git a/Tests/MatterControl.AutomationTests/CheckBoxInLibraryIsClickable.cs b/Tests/MatterControl.AutomationTests/CheckBoxInLibraryIsClickable.cs deleted file mode 100644 index 337a449dc..000000000 --- a/Tests/MatterControl.AutomationTests/CheckBoxInLibraryIsClickable.cs +++ /dev/null @@ -1,79 +0,0 @@ -/* -Copyright (c) 2014, Lars Brubaker -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The views and conclusions contained in the software and documentation are those -of the authors and should not be interpreted as representing official policies, -either expressed or implied, of the FreeBSD Project. -*/ - -using System; -using System.Threading; -using System.Threading.Tasks; -using MatterHackers.Agg.UI; -using MatterHackers.Agg.UI.Tests; -using MatterHackers.GuiAutomation; -using NUnit.Framework; - -namespace MatterHackers.MatterControl.Tests.Automation -{ - [TestFixture, Category("MatterControl.UI.Automation"), RunInApplicationDomain] - public class CheckBoxInLibraryIsClickable - { - [Test, Apartment(ApartmentState.STA)] - public async Task ClickOnLibraryCheckBoxes() - { - AutomationTest testToRun = (testRunner) => - { - testRunner.CloseSignInAndPrinterSelect(); - - testRunner.NavigateToFolder("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"); - testRunner.Delay(.5); - - GuiWidget foundWidget = testRunner.GetWidgetByName("Row Item Select Checkbox", out systemWindow, 3, searchRegion: rowItemRegion); - CheckBox checkBoxWidget = foundWidget as CheckBox; - Assert.IsTrue(checkBoxWidget != null, "We should have an actual checkbox"); - Assert.IsTrue(checkBoxWidget.Checked == false, "currently not checked"); - - testRunner.ClickByName("Row Item Select Checkbox", searchRegion: rowItemRegion); - Assert.IsTrue(checkBoxWidget.Checked == true, "currently checked"); - - testRunner.ClickByName(itemName); - Assert.IsTrue(checkBoxWidget.Checked == false, "currently not checked"); - - return Task.CompletedTask; - }; - - await MatterControlUtilities.RunTest(testToRun); - } - } -} \ No newline at end of file diff --git a/Tests/MatterControl.AutomationTests/ExportItemWindowTests.cs b/Tests/MatterControl.AutomationTests/ExportItemWindowTests.cs index 8da7a8bf1..a819cfe09 100644 --- a/Tests/MatterControl.AutomationTests/ExportItemWindowTests.cs +++ b/Tests/MatterControl.AutomationTests/ExportItemWindowTests.cs @@ -21,10 +21,9 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.AddAndSelectPrinter("Airwolf 3D", "HD"); - string firstItemName = "Queue Item Batman"; //Navigate to Downloads Library Provider - testRunner.ClickByName("Queue Tab"); - testRunner.ClickByName("Queue Add Button"); + testRunner.NavigateToFolder("Print Queue Row Item Collection"); + testRunner.ClickByName("Library Add Button"); //Get parts to add string rowItemPath = MatterControlUtilities.GetTestItemPath("Batman.stl"); @@ -36,13 +35,15 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.Type("{Enter}"); //Get test results - Assert.IsTrue(testRunner.WaitForName(firstItemName)); + testRunner.ClickByName("Row Item Batman.stl"); - testRunner.ClickByName("Queue Export Button"); + testRunner.ClickByName("Print Library Overflow Menu"); + testRunner.ClickByName("Export Menu Item"); testRunner.Delay(2); testRunner.WaitForName("Export Item Window"); - testRunner.ClickByName("Export as GCode Button"); + testRunner.ClickByName("Machine File (G-Code) Button"); + testRunner.ClickByName("Export Button"); testRunner.Delay(2); string gcodeOutputPath = MatterControlUtilities.PathToExportGcodeFolder; diff --git a/Tests/MatterControl.AutomationTests/FileMenuTest.cs b/Tests/MatterControl.AutomationTests/FileMenuTest.cs index 30d2068c9..5777a26ca 100644 --- a/Tests/MatterControl.AutomationTests/FileMenuTest.cs +++ b/Tests/MatterControl.AutomationTests/FileMenuTest.cs @@ -29,97 +29,5 @@ namespace MatterHackers.MatterControl.Tests.Automation return Task.CompletedTask; }, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items); } - - [Test] - public async Task AddToQueueMenuItemAddsSingleFile() - { - await MatterControlUtilities.RunTest((testRunner) => - { - testRunner.CloseSignInAndPrinterSelect(); - - testRunner.ClickByName("File Menu"); - testRunner.Delay(1); - testRunner.ClickByName("Add File To Queue Menu Item"); - testRunner.Delay(2); - - int expectedCount = QueueData.Instance.ItemCount + 1; - - testRunner.Type(MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl")); - testRunner.Delay(1); - testRunner.Type("{Enter}"); - testRunner.Delay(2); - - testRunner.NavigateToFolder("Print Queue Row Item Collection"); - - Assert.IsTrue(testRunner.WaitForName("Row Item Fennec_Fox")); - Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should increase by one after adding Fennec part"); - - return Task.CompletedTask; - }); - } - - [Test] - public async Task AddToQueueMenuItemAddsMultipleFiles() - { - await MatterControlUtilities.RunTest((testRunner) => - { - testRunner.CloseSignInAndPrinterSelect(); - - testRunner.ClickByName("File Menu"); - testRunner.Delay(1); - testRunner.ClickByName("Add File To Queue Menu Item"); - testRunner.Delay(2); - - int expectedCount = QueueData.Instance.ItemCount + 2; - - testRunner.Type( - string.Format("\"{0}\" \"{1}\"", - MatterControlUtilities.GetTestItemPath("Fennec_Fox.stl"), - MatterControlUtilities.GetTestItemPath("Batman.stl"))); - - testRunner.Delay(2); - testRunner.Type("{Enter}"); - testRunner.Delay(2); - - testRunner.NavigateToFolder("Print Queue Row Item Collection"); - - Assert.IsTrue(testRunner.WaitForName("Row Item Fennec_Fox")); - Assert.IsTrue(testRunner.WaitForName("Row Item Batman")); - - Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should increase by two after adding Fennec and Batman parts"); - - return Task.CompletedTask; - }); - } - - [Test] - public async Task AddToQueueMenuItemAddsZipFiles() - { - await MatterControlUtilities.RunTest((testRunner) => - { - testRunner.CloseSignInAndPrinterSelect(); - - testRunner.ClickByName("File Menu"); - testRunner.Delay(1); - testRunner.ClickByName("Add File To Queue Menu Item"); - testRunner.Delay(2); - - int expectedCount = QueueData.Instance.ItemCount + 2; - - testRunner.Type(MatterControlUtilities.GetTestItemPath("Batman.zip")); - testRunner.Delay(1); - testRunner.Type("{Enter}"); - testRunner.Delay(1); - - testRunner.NavigateToFolder("Print Queue Row Item Collection"); - - Assert.IsTrue(testRunner.WaitForName("Row Item Batman")); - Assert.IsTrue(testRunner.WaitForName("Row Item 2013-01-25_Mouthpiece_v2")); - - Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue count should increase by two after adding contents of Batmap.zip"); - - return Task.CompletedTask; - }); - } } } diff --git a/Tests/MatterControl.AutomationTests/LibraryActionTests.cs b/Tests/MatterControl.AutomationTests/LibraryActionTests.cs index dcc9b4cb0..c8ed9c0e0 100644 --- a/Tests/MatterControl.AutomationTests/LibraryActionTests.cs +++ b/Tests/MatterControl.AutomationTests/LibraryActionTests.cs @@ -119,7 +119,7 @@ namespace MatterHackers.MatterControl.Tests.Automation 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.ClickByName("Library Add Button"); testRunner.Delay(1); testRunner.Type(exportZipPath); testRunner.Delay(1); @@ -187,14 +187,14 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.CloseSignInAndPrinterSelect(); - testRunner.ClickByName("Queue Item Batman"); + testRunner.ClickByName("Row Item Batman.stl"); testRunner.Delay(.2); testRunner.ClickByName("Queue Copy Button"); testRunner.Delay(() => QueueData.Instance.ItemCount == expectedQueueCount, 3); Assert.AreEqual(expectedQueueCount, QueueData.Instance.ItemCount, "Copy button increases queue count by one"); - Assert.IsTrue(testRunner.WaitForName("Queue Item Batman - copy"), "Copied Batman item exists with expected name"); + Assert.IsTrue(testRunner.WaitForName("Row Item Batman - copy"), "Copied Batman item exists with expected name"); testRunner.Delay(.3); return Task.CompletedTask; diff --git a/Tests/MatterControl.AutomationTests/LocalLibraryTests.cs b/Tests/MatterControl.AutomationTests/LocalLibraryTests.cs index 2d28ed125..e76f9ecd3 100644 --- a/Tests/MatterControl.AutomationTests/LocalLibraryTests.cs +++ b/Tests/MatterControl.AutomationTests/LocalLibraryTests.cs @@ -206,7 +206,7 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.Delay(2); // Make sure that the Queue Count increases by one - Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Queue item count should increase by one after add"); + Assert.AreEqual(expectedCount, QueueData.Instance.ItemCount, "Row item count should increase by one after add"); // Navigate to the PrintQueueContainer testRunner.NavigateToLibraryHome(); diff --git a/Tests/MatterControl.AutomationTests/MatterControl.AutomationTests.csproj b/Tests/MatterControl.AutomationTests/MatterControl.AutomationTests.csproj index 13d178d23..82bd8e482 100644 --- a/Tests/MatterControl.AutomationTests/MatterControl.AutomationTests.csproj +++ b/Tests/MatterControl.AutomationTests/MatterControl.AutomationTests.csproj @@ -58,7 +58,6 @@ MatterControlUtilities.cs - diff --git a/Tests/MatterControl.AutomationTests/PrintingTests.cs b/Tests/MatterControl.AutomationTests/PrintingTests.cs index 08390cac7..5dfc0f446 100644 --- a/Tests/MatterControl.AutomationTests/PrintingTests.cs +++ b/Tests/MatterControl.AutomationTests/PrintingTests.cs @@ -463,7 +463,7 @@ namespace MatterHackers.MatterControl.Tests.Automation fanChangedCount++; }; - testRunner.CloseMatterControlViaMenu(); + testRunner.CloseMatterControlViaUi(); testRunner.ClickByName("Yes Button"); @@ -496,7 +496,7 @@ namespace MatterHackers.MatterControl.Tests.Automation { fanChangedCount++; }; - testRunner.CloseMatterControlViaMenu(); + testRunner.CloseMatterControlViaUi(); testRunner.ClickByName("Yes Button"); diff --git a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs index 2f54e8e1e..4d3ef91b6 100644 --- a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs +++ b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs @@ -125,11 +125,13 @@ namespace MatterHackers.MatterControl.Tests.Automation return TestContext.CurrentContext.ResolveProjectPath(4, "Tests", "TestData", "QueueItems", queueItemToLoad); } - public static void CloseMatterControlViaMenu(this AutomationRunner testRunner) + public static void CloseMatterControlViaUi(this AutomationRunner testRunner) { SystemWindow mcWindowLocal = MatterControlApplication.Instance; - testRunner.ClickByName("File Menu"); - testRunner.ClickByName("Exit Menu Item"); + + var mainWindow = testRunner.GetWidgetByName("MatterControl", out _); + var windowCenter = new Point2D(mainWindow.LocalBounds.Center.x, mainWindow.LocalBounds.Center.y); + testRunner.ClickByName("MatterControl", offset: windowCenter + new Point2D(-5, 10)); testRunner.Delay(.2); if (mcWindowLocal.Parent != null) @@ -271,12 +273,9 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.ClickByName("Connection Wizard Skip Sign In Button"); } - if (!testRunner.WaitForName("Select Make", 1)) - { - // TODO: The overflow menu needs to always be on screen and when there's not enough room siblings should be removed from the actions bar and pushed into the overflow menu, rather than the menu clipping from the screen - testRunner.OpenPrintersDropdown(); - testRunner.ClickByName("Add New Printer... Menu Item", delayBeforeReturn: .5); - } + // Go to the new tab screen + testRunner.ClickByName("Create New"); + testRunner.ClickByName("Create Printer"); testRunner.ClickByName("Select Make"); testRunner.Type(make);