Getting more tests passing

This commit is contained in:
Lars Brubaker 2017-08-30 13:41:49 -07:00
parent ee207ee770
commit 41378d2286
15 changed files with 47 additions and 201 deletions

View file

@ -113,6 +113,7 @@ namespace MatterHackers.MatterControl
{
public BrandMenuButton()
{
Name = "MatterControl BrandMenuButton";
var buttonView = new FlowLayoutWidget()
{
HAnchor = HAnchor.Stretch,

View file

@ -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 = "";

View file

@ -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) =>

View file

@ -115,7 +115,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
LoadCalibrationPrints();
#if __ANDROID__
UiThread.RunOnIdle(WizardWindow.ChangeToPage<AndroidConnectDevicePage>);
UiThread.RunOnIdle(() => WizardWindow.ChangeToPage<AndroidConnectDevicePage>());
#else
if (AggContext.OperatingSystem == OSType.Windows)
{

View file

@ -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;
}
}
}

View file

@ -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.

@ -1 +1 @@
Subproject commit 8754ac3a1edb6e8cfb904f3087cfec819d2416c0
Subproject commit e96e080061c20035b7876ce9c11eb1f7253e7556

View file

@ -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);
}
}
}

View file

@ -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;

View file

@ -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;
});
}
}
}

View file

@ -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;

View file

@ -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();

View file

@ -58,7 +58,6 @@
<Compile Include="..\MatterControl.Tests\MatterControl\MatterControlUtilities.cs">
<Link>MatterControlUtilities.cs</Link>
</Compile>
<Compile Include="CheckBoxInLibraryIsClickable.cs" />
<Compile Include="MatterControlTests.cs" />
<Compile Include="CreateLibraryFolder.cs" />
<Compile Include="ExportItemWindowTests.cs" />

View file

@ -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");

View file

@ -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);