Added automated test to ensure that setting values are being passed to MatterSlice with the correct values. Also added a stress test in slice settings.
This commit is contained in:
parent
4310c9629e
commit
1e4c1cda53
6 changed files with 164 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ namespace MatterHackers.MatterControl
|
|||
public MenuOptionHelp()
|
||||
: base("Help".Localize())
|
||||
{
|
||||
Name = "Help Menu";
|
||||
}
|
||||
|
||||
override protected IEnumerable<MenuItemAction> GetMenuItems()
|
||||
|
|
|
|||
|
|
@ -168,6 +168,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
|
||||
generateGCodeButton = textImageButtonFactory.Generate(LocalizedString.Get("Generate"));
|
||||
generateGCodeButton.Name = "Generate Gcode Button";
|
||||
generateGCodeButton.Click += new EventHandler(generateButton_Click);
|
||||
buttonBottomPanel.AddChild(generateGCodeButton);
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
|
||||
saveButton = textImageButtonFactory.Generate(LocalizedString.Get("Save").ToUpper(), centerText: true);
|
||||
saveButton.Name = "Save Slice Settings Button";
|
||||
saveButton.VAnchor = VAnchor.ParentCenter;
|
||||
saveButton.Visible = true;
|
||||
saveButton.Margin = new BorderDouble(5, 0, 5, 0);
|
||||
|
|
@ -1094,6 +1095,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
case OrganizerSettingsData.DataEditTypes.CHECK_BOX:
|
||||
{
|
||||
CheckBox checkBoxWidget = new CheckBox("");
|
||||
checkBoxWidget.Name = settingData.PresentationName + " Checkbox";
|
||||
checkBoxWidget.ToolTipText = settingData.HelpText;
|
||||
checkBoxWidget.VAnchor = Agg.UI.VAnchor.ParentBottom;
|
||||
checkBoxWidget.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
|
|
@ -1170,6 +1172,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
case OrganizerSettingsData.DataEditTypes.HARDWARE_PRESENT:
|
||||
{
|
||||
CheckBox checkBoxWidget = new CheckBox("");
|
||||
checkBoxWidget.Name = settingData.PresentationName + " Checkbox";
|
||||
checkBoxWidget.ToolTipText = settingData.HelpText;
|
||||
checkBoxWidget.VAnchor = Agg.UI.VAnchor.ParentBottom;
|
||||
checkBoxWidget.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@
|
|||
<Compile Include="PartPreviewTests.cs" />
|
||||
<Compile Include="PrintQueueTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SliceSetingsTests.cs" />
|
||||
<Compile Include="SqLiteLibraryProvider.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
|||
116
Tests/MatterControl.AutomationTests/SliceSetingsTests.cs
Normal file
116
Tests/MatterControl.AutomationTests/SliceSetingsTests.cs
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.UI;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.GuiAutomation;
|
||||
using MatterHackers.Agg.PlatformAbstract;
|
||||
using System.IO;
|
||||
using MatterHackers.MatterControl.CreatorPlugins;
|
||||
using MatterHackers.Agg.UI.Tests;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MatterHackers.MatterControl.UI
|
||||
{
|
||||
[TestFixture, Category("MatterControl.UI"), RunInApplicationDomain]
|
||||
public class SliceSetingsTests
|
||||
{
|
||||
[Test, RequiresSTA, RunInApplicationDomain]
|
||||
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
|
||||
}
|
||||
|
||||
//Stress Test check & uncheck 1000x
|
||||
[Test, RequiresSTA, RunInApplicationDomain, Ignore("Not Finished")]
|
||||
public void HasHeatedBedCheckUncheck()
|
||||
{
|
||||
// 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("SettingsAndControls");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("User Level Dropdown");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Advanced Menu Item");
|
||||
testRunner.Wait(1);
|
||||
testRunner.ClickByName("Printer Tab");
|
||||
testRunner.Wait(1);
|
||||
|
||||
testRunner.ClickByName("Features Tab");
|
||||
testRunner.Wait(2);
|
||||
|
||||
for (int i = 0; i <= 1000; i++)
|
||||
{
|
||||
testRunner.ClickByName("Has Heated Bed Checkbox");
|
||||
testRunner.Wait(.5);
|
||||
}
|
||||
|
||||
MatterControlUtilities.CloseMatterControl(testRunner);
|
||||
}
|
||||
};
|
||||
|
||||
AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun);
|
||||
|
||||
Assert.IsTrue(testHarness.AllTestsPassed);
|
||||
Assert.IsTrue(testHarness.TestCount == 0); // make sure we ran all our tests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -114,6 +114,47 @@ namespace MatterHackers.MatterControl.UI
|
|||
}
|
||||
}
|
||||
|
||||
public static bool CompareExpectedSliceSettingValueWithActualVaue(string sliceSetting, string expectedValue)
|
||||
{
|
||||
string tempFolderPath = Path.Combine("..", "..", "..", "..", "Tests", "temp");
|
||||
string fullPath = Path.Combine(tempFolderPath, runName, "Test0", "data", "gcode");
|
||||
|
||||
string [] gcodeFiles = Directory.GetFiles(fullPath);
|
||||
|
||||
foreach (string file in gcodeFiles)
|
||||
{
|
||||
if(file.Contains(".ini"))
|
||||
{
|
||||
|
||||
FileInfo f = new FileInfo(file);
|
||||
string fullName = f.FullName;
|
||||
string[] lines = File.ReadAllLines(fullName);
|
||||
foreach (string line in lines)
|
||||
{
|
||||
|
||||
if (line.Contains(sliceSetting))
|
||||
{
|
||||
line.Trim(' ');
|
||||
string[] settingNameAndValue = line.Split('=');
|
||||
string settingName = settingNameAndValue[0].Trim();
|
||||
string settingValue = string.Empty;
|
||||
if (settingNameAndValue.Length == 2)
|
||||
{
|
||||
settingValue = settingNameAndValue[1].Trim();
|
||||
}
|
||||
|
||||
if(settingValue == expectedValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void SelectAndAddPrinter(AutomationRunner testRunner, string make, string model, bool firstAdd)
|
||||
{
|
||||
|
||||
|
|
@ -154,6 +195,7 @@ namespace MatterHackers.MatterControl.UI
|
|||
testRunner.Wait(1);
|
||||
}
|
||||
|
||||
|
||||
private static void OutputImage(ImageBuffer imageToOutput, string fileName)
|
||||
{
|
||||
if (saveImagesForDebug)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue