Skip to content

Commit

Permalink
feat: Add UI Test template for VSIX
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 authored and jeromelaban committed May 24, 2022
1 parent 4d6bf88 commit 7ca050b
Show file tree
Hide file tree
Showing 22 changed files with 216 additions and 205 deletions.
2 changes: 1 addition & 1 deletion build/Uno.UI.Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
<_sdkProject Include="..\src\SolutionTemplate\UnoLibraryTemplate\CrossTargetedLibrary.csproj"/>
<_sdkProject Include="..\src\SolutionTemplate\UnoLibraryTemplate.net6\CrossTargetedLibrary.csproj"/>
<_sdkProject Include="..\src\SolutionTemplate\UnoLibraryTemplate.net6\CrossTargetedLibrary.csproj"/>

<_sdkProject Include="..\src\SolutionTemplate\UnoUITestTemplate\UnoUITestTemplate.csproj"/>
<_sdkProject Include="..\src\SolutionTemplate\Uno.ProjectTemplates.Dotnet\content\unolib-crossruntime\UnoCrossRuntimeLib\*.csproj"/>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
<PackagePath>content/xamarinforms-wasm</PackagePath>
</Content>
<Content Include="content\unoapp-uitest\**\*">
<PackagePath>content\unoapp-uitest</PackagePath>
<Pack>true</Pack>
<PackagePath>content\unoapp-uitest</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="content/xamarinforms-wasm/UnoXFQuickStart.Wasm/**/*.*">
<Pack>true</Pack>
Expand Down Expand Up @@ -118,6 +118,16 @@

<_UnoLibTemplateFiles Include="..\UnoLibraryTemplate\**" Exclude="@(_UnoLibTemplateFilesExclude)" />
</ItemGroup>

<ItemGroup>
<_UnoUITestTemplateFilesExclude Include="..\UnoUITestTemplate\*.vstemplate" />
<_UnoUITestTemplateFilesExclude Include="..\UnoUITestTemplate\__*.png" />
<_UnoUITestTemplateFilesExclude Include="..\UnoUITestTemplate\obj\**" />
<_UnoUITestTemplateFilesExclude Include="..\UnoUITestTemplate\bin\**" />
<_UnoUITestTemplateFilesExclude Include="..\UnoUITestTemplate\Properties\**" />

<_UnoUITestTemplateFiles Include="..\UnoUITestTemplate\**" Exclude="@(_UnoUITestTemplateFilesExclude)" />
</ItemGroup>

<ItemGroup>
<Content Update="content\unoapp\UnoQuickStart-vsmac.slnf">
Expand Down Expand Up @@ -191,6 +201,25 @@
</ItemGroup>
</Target>

<Target Name="CopyUnoUITestTemplate" BeforeTargets="Build">
<PropertyGroup>
<IntermediateTemplatePath>$(IntermediateOutputPath)\unoapp-uitest</IntermediateTemplatePath>
</PropertyGroup>

<RemoveDir Directories="$(IntermediateTemplatePath)" />

<Copy SourceFiles="@(_UnoUITestTemplateFiles)" DestinationFolder="$(IntermediateTemplatePath)\%(RecursiveDir)" />

<ReplaceContent SourcePath="$(IntermediateTemplatePath)" SafeProjectName="UnoUITestsLibrary" IsWinUI="False" />

<ItemGroup>
<Content Include="$(IntermediateTemplatePath)/**/*.*">
<Pack>true</Pack>
<PackagePath>content/unoapp-uitest</PackagePath>
</Content>
</ItemGroup>
</Target>

<Target Name="CopyUnoAppWinUITemplate" BeforeTargets="Build">
<PropertyGroup>
<IntermediateTemplatePath>$(IntermediateOutputPath)\unoapp-winui</IntermediateTemplatePath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,107 +28,6 @@
"99E19497-29A6-4B77-B773-BEC55F9B55DC" // .NET Standard Library
],
"symbols": {
"guid1": {
"type": "generated",
"generator": "guid",
"replaces": "$guid1$",
"parameters": {
"format": "N"
}
},
"guid2": {
"type": "generated",
"generator": "guid",
"replaces": "$guid2$",
"parameters": {
"format": "N"
}
},
"guid3": {
"type": "generated",
"generator": "guid",
"replaces": "$guid3$",
"parameters": {
"format": "N"
}
},
"guid4": {
"type": "generated",
"generator": "guid",
"replaces": "$guid4$",
"parameters": {
"format": "N"
}
},
"guid5": {
"type": "generated",
"generator": "guid",
"replaces": "$guid5$",
"parameters": {
"format": "N"
}
},
"windowsPublisherName": {
"type": "parameter",
"datatype": "text",
"replaces": "$XmlEscapedPublisherDistinguishedName$",
"description": "Provides the value to use for the Windows head publisher",
"defaultValue": "O=MyCompany"
},
"WebAssembly": {
"type": "parameter",
"dataType": "bool",
"defaultValue": "true",
"description": "Enables the WebAssembly platform support project"
},
"UWP": {
"type": "parameter",
"dataType": "bool",
"defaultValue": "true",
"description": "Enables the Windows platform support project"
},
"iOS": {
"type": "parameter",
"dataType": "bool",
"defaultValue": "true",
"description": "Enables the iOS platform support project"
},
"Android": {
"type": "parameter",
"dataType": "bool",
"defaultValue": "true",
"description": "Enables the Android platform support project"
},
"macOS": {
"type": "parameter",
"dataType": "bool",
"defaultValue": "true",
"description": "Enables the macOS platform support project"
},
"skia-wpf": {
"type": "parameter",
"dataType": "bool",
"defaultValue": "true",
"description": "Enables the Skia/WPF platform support project"
},
"skia-gtk": {
"type": "parameter",
"dataType": "bool",
"defaultValue": "true",
"description": "Enables the Skia/GTK platform support project"
},
"skia-tizen": {
"type": "parameter",
"dataType": "bool",
"defaultValue": "true",
"description": "Enables the Skia/Tizen platform support project"
},
"vscodeWasm": {
"type": "parameter",
"dataType": "bool",
"defaultValue": "false",
"description": "Adds the Visual Studio Code Debugging support files for WebAssembly"
}
},
"primaryOutputs": [
{
Expand All @@ -147,61 +46,6 @@
"sources": [
{
"modifiers": [
{
"condition": "(!iOS)",
"exclude": [
"UnoQuickStart.iOS/**/*"
]
},
{
"condition": "(!Android)",
"exclude": [
"UnoQuickStart.Droid/**/*"
]
},
{
"condition": "(!WebAssembly)",
"exclude": [
"UnoQuickStart.Gtk/**/*"
]
},
{
"condition": "(!macOS)",
"exclude": [
"UnoQuickStart.macOS/**/*"
]
},
{
"condition": "(!UWP)",
"exclude": [
"UnoQuickStart.UWP/**/*"
]
},
{
"condition": "(!skia-gtk)",
"exclude": [
"UnoQuickStart.Skia.Gtk/**/*"
]
},
{
"condition": "(!skia-wpf)",
"exclude": [
"UnoQuickStart.Skia.WPF/**/*",
"UnoQuickStart.Skia.WPF.Host/**/*"
]
},
{
"condition": "(!skia-tizen)",
"exclude": [
"UnoQuickStart.Skia.Tizen/**/*"
]
},
{
"condition": "(!vscodeWasm)",
"exclude": [
".vscode/**/*"
]
}
]
}
]
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@
<IncludeOutputGroupsInVSIX>TemplateProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\UnoUITestTemplate\UnoUITestTemplate.csproj">
<Project>{228f24b6-b5c0-43bc-9b1a-b03e7b6dca27}</Project>
<Name>UnoUITestsLibrary</Name>
<VSIXSubPath>ItemTemplates</VSIXSubPath>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<IncludeOutputGroupsInVSIX>TemplateProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Icon>logo.png</Icon>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0,17.0)"/>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0,17.0)"/>
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
Expand All @@ -24,6 +24,7 @@
<Asset Type="Microsoft.VisualStudio.ItemTemplate" d:Source="Project" d:ProjectName="UnoItemTemplate" d:TargetPath="|UnoItemTemplate;TemplateProjectOutputGroup|" Path="ItemTemplates" d:VsixSubPath="ItemTemplates" />
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%|" />
<Asset Type="Microsoft.VisualStudio.ProjectTemplate" d:Source="Project" d:ProjectName="UnoUITestsLibrary" d:TargetPath="|UnoUITestsLibrary;TemplateProjectOutputGroup|" Path="ProjectTemplates" d:VsixSubPath="ProjectTemplates" />
</Assets>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[16.1.28811.260,17.0)" DisplayName="Visual Studio core editor" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<IncludeOutputGroupsInVSIX>TemplateProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
</ProjectReference>
<ProjectReference Include="..\UnoUITestTemplate\UnoUITestTemplate.csproj">
<Project>{228f24b6-b5c0-43bc-9b1a-b03e7b6dca27}</Project>
<Name>UnoUITestsLibrary</Name>
<VSIXSubPath>ProjectTemplates</VSIXSubPath>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<IncludeOutputGroupsInVSIX>TemplateProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="logo.png">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
<Asset Type="Microsoft.VisualStudio.ProjectTemplate" d:Source="Project" d:ProjectName="UnoSolutionTemplate" d:TargetPath="|UnoSolutionTemplate;TemplateProjectOutputGroup|" Path="ProjectTemplates" d:VsixSubPath="ProjectTemplates" />
<Asset Type="Microsoft.VisualStudio.Assembly" d:Source="Project" d:ProjectName="UnoSolutionTemplate.Wizard.2022" Path="|UnoSolutionTemplate.Wizard.2022|" AssemblyName="|UnoSolutionTemplate.Wizard.2022;AssemblyName|" />
<Asset Type="Microsoft.VisualStudio.Assembly" d:Source="Project" d:ProjectName="UnoSolutionTemplate.Wizard.2019" Path="|UnoSolutionTemplate.Wizard.2019|" AssemblyName="|UnoSolutionTemplate.Wizard.2019;AssemblyName|" />
<Asset Type="Microsoft.VisualStudio.ProjectTemplate" d:Source="Project" d:ProjectName="UnoUITestsLibrary" d:TargetPath="|UnoUITestsLibrary;TemplateProjectOutputGroup|" Path="ProjectTemplates" d:VsixSubPath="ProjectTemplates" />
</Assets>
</PackageManifest>
28 changes: 28 additions & 0 deletions src/SolutionTemplate/UnoUITestTemplate/Given_MainPage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using Uno.UITest.Helpers.Queries;
using Query = System.Func<Uno.UITest.IAppQuery, Uno.UITest.IAppQuery>;

namespace UnoUITestsLibrary
{
public class Given_MainPage : TestBase
{
[Test]
public void When_SmokeTest()
{
// Create a button with the `AutomationProperties.AutomationId="MyButton"`
// then use the following code to search and tap the button
//
// Query MyButton = q => q.All().Marked("MyButton");
// App.WaitForElement(MyButton);
// App.Tap(MyButton);

// Take a screenshot and add it to the test results
TakeScreenshot("After tapped");
}
}
}
Loading

0 comments on commit 7ca050b

Please sign in to comment.