diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-04-18 14:02:16 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-04-18 14:02:16 +0300 |
| commit | 30dbc28131a53925dd8cb17f3ca3e84922f0cb3d (patch) | |
| tree | abca85e201dd9a90a824dd243d5bd32be12de4c8 /Software/Visual_Studio | |
| parent | 1356c4682507fe3c7bdfebc7316fcad1b67594a1 (diff) | |
| download | Tango-30dbc28131a53925dd8cb17f3ca3e84922f0cb3d.tar.gz Tango-30dbc28131a53925dd8cb17f3ca3e84922f0cb3d.zip | |
Started working on UI automation testing!
Diffstat (limited to 'Software/Visual_Studio')
6 files changed, 105 insertions, 1 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index 030e26898..a841a72cb 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -365,7 +365,7 @@ </Grid.RowDefinitions> <Image Source="{Binding Image,Mode=OneWay}" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" /> <Rectangle VerticalAlignment="Bottom" Stroke="Silver"></Rectangle> - <Button Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.StartModuleCommand}" CommandParameter="{Binding}" Grid.Row="0" Margin="0,0,20,-35" HorizontalAlignment="Right" Width="70" Height="70" VerticalAlignment="Bottom" Style="{StaticResource MaterialDesignFloatingActionMiniButton}" ToolTip="Start This Module"> + <Button AutomationProperties.AutomationId="{Binding Name}" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.StartModuleCommand}" CommandParameter="{Binding}" Grid.Row="0" Margin="0,0,20,-35" HorizontalAlignment="Right" Width="70" Height="70" VerticalAlignment="Bottom" Style="{StaticResource MaterialDesignFloatingActionMiniButton}" ToolTip="Start This Module"> <materialDesign:PackIcon Kind="Play" Width="30" Height="30" /> </Button> <StackPanel Grid.Row="1" Margin="8,24,8,0"> diff --git a/Software/Visual_Studio/Tango.UnitTesting/App.config b/Software/Visual_Studio/Tango.UnitTesting/App.config index 80fd5e3fa..516b46de6 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/App.config +++ b/Software/Visual_Studio/Tango.UnitTesting/App.config @@ -23,6 +23,46 @@ <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + </dependentAssembly> </assemblyBinding> </runtime> </configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.UnitTesting/Helper.cs b/Software/Visual_Studio/Tango.UnitTesting/Helper.cs index 7c0e639c5..8a4cd57e8 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Helper.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/Helper.cs @@ -35,6 +35,15 @@ namespace Tango.UnitTesting } /// <summary> + /// Gets the machine studio exe path. + /// </summary> + /// <returns></returns> + public static String GetMachineStudioPath() + { + return Path.GetFullPath(@"..\..\Build\Debug\Tango.MachineStudio.UI.exe"); + } + + /// <summary> /// Gets the SQLite database file path in DB folder. /// </summary> /// <returns></returns> diff --git a/Software/Visual_Studio/Tango.UnitTesting/MachineStudio_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/MachineStudio_TST.cs new file mode 100644 index 000000000..c56a177f8 --- /dev/null +++ b/Software/Visual_Studio/Tango.UnitTesting/MachineStudio_TST.cs @@ -0,0 +1,46 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using TestStack.White; +using TestStack.White.Factory; +using TestStack.White.UIItems; +using TestStack.White.UIItems.Finders; +using TestStack.White.UIItems.WindowItems; + +namespace Tango.UnitTesting +{ + [TestClass] + [TestCategory("Machine Studio")] + public class MachineStudio_TST + { + [TestMethod] + public void Login() + { + var app = Application.Launch(Helper.GetMachineStudioPath()); + + var window = app.GetWindow("Tango", InitializeOption.NoCache); + + window.WaitTill(() => window.Get<Button>(SearchCriteria.ByText("LOGIN")) != null); + + var btnLogin = window.Get<Button>(SearchCriteria.ByText("LOGIN")); + + Thread.Sleep(1000); + + btnLogin.Click(); + + window.WaitTill(() => window.Get<Button>(SearchCriteria.ByAutomationId("Developer")) != null); + + var btnDeveloper = window.Get<Button>(SearchCriteria.ByAutomationId("Developer")); + + btnDeveloper.Click(); + + Thread.Sleep(5000); + + app.Kill(); + } + } +} diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj index 6d4fb984d..1378ed1d4 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj +++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj @@ -41,6 +41,9 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> + <HintPath>..\packages\Castle.Core.3.3.0\lib\net45\Castle.Core.dll</HintPath> + </Reference> <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> <HintPath>..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath> </Reference> @@ -74,12 +77,16 @@ <HintPath>..\packages\System.Data.SQLite.Linq.1.0.106.0\lib\net46\System.Data.SQLite.Linq.dll</HintPath> <Private>True</Private> </Reference> + <Reference Include="TestStack.White, Version=0.13.0.0, Culture=neutral, PublicKeyToken=2672efbf3e161801, processorArchitecture=MSIL"> + <HintPath>..\packages\TestStack.White.0.13.3\lib\net40\TestStack.White.dll</HintPath> + </Reference> </ItemGroup> <ItemGroup> <Compile Include="..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> <Compile Include="Logging_TST.cs" /> + <Compile Include="MachineStudio_TST.cs" /> <Compile Include="Scripting_TST.cs" /> <Compile Include="Embroidery_TST.cs" /> <Compile Include="Helper.cs" /> diff --git a/Software/Visual_Studio/Tango.UnitTesting/packages.config b/Software/Visual_Studio/Tango.UnitTesting/packages.config index f12b118a3..7df5dedbd 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/packages.config +++ b/Software/Visual_Studio/Tango.UnitTesting/packages.config @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <packages> + <package id="Castle.Core" version="3.3.0" targetFramework="net46" /> <package id="EntityFramework" version="6.0.0" targetFramework="net46" /> <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> <package id="MSTest.TestAdapter" version="1.1.11" targetFramework="net45" /> @@ -9,4 +10,5 @@ <package id="System.Data.SQLite.Core" version="1.0.106.0" targetFramework="net46" /> <package id="System.Data.SQLite.EF6" version="1.0.106.0" targetFramework="net46" /> <package id="System.Data.SQLite.Linq" version="1.0.106.0" targetFramework="net46" /> + <package id="TestStack.White" version="0.13.3" targetFramework="net46" /> </packages>
\ No newline at end of file |
