Skip to content

Commit 0a67156

Browse files
committed
feat: Add unoapp-uitest template for Uno.UITest based testing
1 parent 8f69eb4 commit 0a67156

File tree

11 files changed

+474
-4
lines changed

11 files changed

+474
-4
lines changed

build/run-template-tests.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ dotnet new unoapp-winui -n UnoAppWinUI --winui-desktop=false
116116
& $msbuild $debug UnoAppWinUI\UnoAppWinUI.sln
117117
Assert-ExitCodeIsZero
118118

119+
# UI Tests template
120+
dotnet new unoapp-uitest -o UnoUITests01
121+
& $msbuild $debug UnoUITests01\UnoUITests01.csproj
122+
Assert-ExitCodeIsZero
123+
119124
# XF - Default
120125
7z x build\assets\xfapp-uwp-4.8.0.1451.zip -oXFApp
121126

doc/articles/get-started-dotnet-new.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,20 @@ A more advanced example which will not generate the android and macOS heads:
6666
dotnet new unoapp -o MyApp -android=false -macos=false
6767
```
6868

69+
## Uno Platform Uno.UITest library
70+
This templates creates a project for creating and running UI Tests based on [Uno.UITest](https://github.com/unoplatform/Uno.UITest).
71+
72+
Considering you've created an application as follows:
73+
- `dotnet new unoapp -o MyApp`
74+
75+
To create a UI Tests library:
76+
- Create a folder name `MyApp\MyApp.UITests`
77+
- In that folder, run `dotnet new unoapp-uitest`
78+
79+
This will automatically add the new project to the existing solution.
80+
81+
For additional information about UI Tests creation, visit the [Uno.UITest](https://github.com/unoplatform/Uno.UITest) documentation.
82+
6983
## Uno Platform WebAssembly support for Xamarin Forms
7084

7185
This template is built to enhance an existing Xamarin.Forms application with the [Uno Platform WebAssembly support](https://github.com/unoplatform/Uno.Xamarin.Forms.Platform).

src/SolutionTemplate/Uno.ProjectTemplates.Dotnet/Uno.ProjectTemplates.Dotnet.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
<Pack>true</Pack>
4141
<PackagePath>content/xamarinforms-wasm</PackagePath>
4242
</Content>
43+
<Content Include="content\unoapp-uitest\**\*">
44+
<PackagePath>content\unoapp-uitest</PackagePath>
45+
<Pack>true</Pack>
46+
</Content>
4347
<Content Include="content/xamarinforms-wasm/UnoXFQuickStart.Wasm/**/*.*">
4448
<Pack>true</Pack>
4549
<PackagePath>content/xamarinforms-wasm/UnoXFQuickStart.Wasm</PackagePath>
@@ -95,10 +99,6 @@
9599

96100
<_UnoLibTemplateFiles Include="..\UnoLibraryTemplate\**" Exclude="@(_UnoLibTemplateFilesExclude)" />
97101
</ItemGroup>
98-
99-
<ItemGroup>
100-
<UpToDateCheckInput Remove="content\unoapp-winui\UnoWinUIQuickStart.Windows.Package\Package.appxmanifest" />
101-
</ItemGroup>
102102

103103
<Target Name="CopyUnoAppTemplate" BeforeTargets="Build">
104104
<PropertyGroup>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "http://json.schemastore.org/dotnetcli.host",
3+
"symbolInfo": {
4+
}
5+
}
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
{
2+
"$schema": "http://json.schemastore.org/template",
3+
"author": "Uno Platform",
4+
"classifications": [
5+
"Web",
6+
"Uno Platform",
7+
"WebAssembly",
8+
"Android",
9+
"iOS",
10+
"Windows",
11+
"macOS",
12+
"Linux",
13+
"Tizen",
14+
"dotnet-new"
15+
],
16+
"name": "Cross-Platform UI Tests Library",
17+
"identity": "Uno.Platform.UITestLibrary",
18+
"groupIdentity": "Uno.Platform.BlankUITestLibrary",
19+
"description": "Project template for creating a cross-platform UI Tests with the Uno Platform.",
20+
"precedence": "6001",
21+
"tags": {
22+
"language": "C#",
23+
"type": "project"
24+
},
25+
"shortName": "unoapp-uitest",
26+
"sourceName": "UnoUITestsLibrary",
27+
"defaultName": "UnoApp.UITests",
28+
"placeholderFilename": "template-ignore",
29+
"preferNameDirectory": false,
30+
"guids": [
31+
"99E19497-29A6-4B77-B773-BEC55F9B55DC" // .NET Standard Library
32+
],
33+
"symbols": {
34+
"guid1": {
35+
"type": "generated",
36+
"generator": "guid",
37+
"replaces": "$guid1$",
38+
"parameters": {
39+
"format": "N"
40+
}
41+
},
42+
"guid2": {
43+
"type": "generated",
44+
"generator": "guid",
45+
"replaces": "$guid2$",
46+
"parameters": {
47+
"format": "N"
48+
}
49+
},
50+
"guid3": {
51+
"type": "generated",
52+
"generator": "guid",
53+
"replaces": "$guid3$",
54+
"parameters": {
55+
"format": "N"
56+
}
57+
},
58+
"guid4": {
59+
"type": "generated",
60+
"generator": "guid",
61+
"replaces": "$guid4$",
62+
"parameters": {
63+
"format": "N"
64+
}
65+
},
66+
"guid5": {
67+
"type": "generated",
68+
"generator": "guid",
69+
"replaces": "$guid5$",
70+
"parameters": {
71+
"format": "N"
72+
}
73+
},
74+
"windowsPublisherName": {
75+
"type": "parameter",
76+
"datatype": "text",
77+
"replaces": "$XmlEscapedPublisherDistinguishedName$",
78+
"description": "Provides the value to use for the Windows head publisher",
79+
"defaultValue": "O=MyCompany"
80+
},
81+
"WebAssembly": {
82+
"type": "parameter",
83+
"dataType": "bool",
84+
"defaultValue": "true",
85+
"description": "Enables the WebAssembly platform support project"
86+
},
87+
"UWP": {
88+
"type": "parameter",
89+
"dataType": "bool",
90+
"defaultValue": "true",
91+
"description": "Enables the Windows platform support project"
92+
},
93+
"iOS": {
94+
"type": "parameter",
95+
"dataType": "bool",
96+
"defaultValue": "true",
97+
"description": "Enables the iOS platform support project"
98+
},
99+
"Android": {
100+
"type": "parameter",
101+
"dataType": "bool",
102+
"defaultValue": "true",
103+
"description": "Enables the Android platform support project"
104+
},
105+
"macOS": {
106+
"type": "parameter",
107+
"dataType": "bool",
108+
"defaultValue": "true",
109+
"description": "Enables the macOS platform support project"
110+
},
111+
"skia-wpf": {
112+
"type": "parameter",
113+
"dataType": "bool",
114+
"defaultValue": "true",
115+
"description": "Enables the Skia/WPF platform support project"
116+
},
117+
"skia-gtk": {
118+
"type": "parameter",
119+
"dataType": "bool",
120+
"defaultValue": "true",
121+
"description": "Enables the Skia/GTK platform support project"
122+
},
123+
"skia-tizen": {
124+
"type": "parameter",
125+
"dataType": "bool",
126+
"defaultValue": "true",
127+
"description": "Enables the Skia/Tizen platform support project"
128+
},
129+
"vscodeWasm": {
130+
"type": "parameter",
131+
"dataType": "bool",
132+
"defaultValue": "false",
133+
"description": "Adds the Visual Studio Code Debugging support files for WebAssembly"
134+
}
135+
},
136+
"primaryOutputs": [
137+
{
138+
"path": "UnoUITestsLibrary.csproj"
139+
}
140+
],
141+
"postActions": [
142+
{
143+
"description": "Add projects to the existing solution",
144+
"manualInstructions": [],
145+
"primaryOutputIndexes": "0",
146+
"actionId": "D396686C-DE0E-4DE6-906D-291CD29FC5DE",
147+
"continueOnError": true
148+
}
149+
],
150+
"sources": [
151+
{
152+
"modifiers": [
153+
{
154+
"condition": "(!iOS)",
155+
"exclude": [
156+
"UnoQuickStart.iOS/**/*"
157+
]
158+
},
159+
{
160+
"condition": "(!Android)",
161+
"exclude": [
162+
"UnoQuickStart.Droid/**/*"
163+
]
164+
},
165+
{
166+
"condition": "(!WebAssembly)",
167+
"exclude": [
168+
"UnoQuickStart.Gtk/**/*"
169+
]
170+
},
171+
{
172+
"condition": "(!macOS)",
173+
"exclude": [
174+
"UnoQuickStart.macOS/**/*"
175+
]
176+
},
177+
{
178+
"condition": "(!UWP)",
179+
"exclude": [
180+
"UnoQuickStart.UWP/**/*"
181+
]
182+
},
183+
{
184+
"condition": "(!skia-gtk)",
185+
"exclude": [
186+
"UnoQuickStart.Skia.Gtk/**/*"
187+
]
188+
},
189+
{
190+
"condition": "(!skia-wpf)",
191+
"exclude": [
192+
"UnoQuickStart.Skia.WPF/**/*",
193+
"UnoQuickStart.Skia.WPF.Host/**/*"
194+
]
195+
},
196+
{
197+
"condition": "(!skia-tizen)",
198+
"exclude": [
199+
"UnoQuickStart.Skia.Tizen/**/*"
200+
]
201+
},
202+
{
203+
"condition": "(!vscodeWasm)",
204+
"exclude": [
205+
".vscode/**/*"
206+
]
207+
}
208+
]
209+
}
210+
]
211+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"$schema": "http://json.schemastore.org/vs-2017.3.host",
3+
"name": {
4+
"text": "Cross-Platform App",
5+
},
6+
"description": {
7+
"text": "Solution template for creating a cross-platform XAML app with the Uno Platform that targets UWP, Android, iOS, macOS, WebAssembly, Skia/WPF, and Skia/GTK for Linux.",
8+
},
9+
"order": 610,
10+
"icon": "uno-logo.png",
11+
"learnMoreLink": "https://github.com/unoplatform/uno",
12+
"uiFilters": [
13+
"oneaspnet"
14+
],
15+
"additionalWizardParameters": {
16+
"$isMultiProjectTemplate$": "true"
17+
},
18+
"symbolInfo": [
19+
{
20+
"id": "WebAssembly",
21+
"name": {
22+
"text": "Add support for WebAssembly"
23+
},
24+
"isVisible": "true"
25+
},
26+
{
27+
"id": "iOS",
28+
"name": {
29+
"text": "Add support for iOS"
30+
},
31+
"isVisible": "true"
32+
},
33+
{
34+
"id": "Android",
35+
"name": {
36+
"text": "Add support for Android"
37+
},
38+
"isVisible": "true"
39+
},
40+
{
41+
"id": "macOS",
42+
"name": {
43+
"text": "Add support for macOS"
44+
},
45+
"isVisible": "true"
46+
},
47+
{
48+
"id": "skia-gtk",
49+
"name": {
50+
"text": "Add support for Skia/GTK (Linux, macOS, Windows 7/10)"
51+
},
52+
"isVisible": "true"
53+
},
54+
{
55+
"id": "skia-wpf",
56+
"name": {
57+
"text": "Add support for Skia/WPF (Windows 7/10)"
58+
},
59+
"isVisible": "true"
60+
},
61+
{
62+
"id": "UWP",
63+
"name": {
64+
"text": "Add support for UWP"
65+
},
66+
"isVisible": "true"
67+
},
68+
{
69+
"id": "vscodeWasm",
70+
"name": {
71+
"text": "Adds the Visual Studio Code Debugging support files for WebAssembly"
72+
},
73+
"isVisible": "false"
74+
},
75+
{
76+
"id": "windowsPublisherName",
77+
"name": {
78+
"text": "Provides the value to use for the Windows head publisher"
79+
},
80+
"isVisible": "true"
81+
}
82+
]
83+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Uno.UITest.Helpers.Queries;
7+
8+
namespace UnoUITestsLibrary
9+
{
10+
public class Constants
11+
{
12+
public readonly static string WebAssemblyDefaultUri = "http://localhost:64555/";
13+
public readonly static string iOSAppName = "com.example.app";
14+
public readonly static string AndroidAppName = "com.example.app";
15+
public readonly static string iOSDeviceNameOrId = "iPad Pro (12.9-inch) (3rd generation)";
16+
17+
public readonly static Platform CurrentPlatform = Platform.Browser;
18+
}
19+
}

0 commit comments

Comments
 (0)