Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Microsoft.Maui-dev.sln
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.Xaml.UnitTests.Int
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.Xaml.UnitTests.InternalsHiddenAssembly", "src\Controls\tests\Xaml.UnitTests.InternalsHiddenAssembly\Controls.Xaml.UnitTests.InternalsHiddenAssembly.csproj", "{FB39FACE-BAF2-4F97-A249-E45BA63D77FE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.TestCases.App", "src\Controls\tests\TestCases\Controls.TestCases.App.csproj", "{07C26A25-08C2-4C52-9574-1C33EC8E7919}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.TestCases.HostApp", "src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj", "{07C26A25-08C2-4C52-9574-1C33EC8E7919}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Maui.IntegrationTests", "src\TestUtils\src\Microsoft.Maui.IntegrationTests\Microsoft.Maui.IntegrationTests.csproj", "{A6976D43-B3A4-47AF-89D9-FA388B56B52B}"
EndProject
Expand Down
2 changes: 1 addition & 1 deletion Microsoft.Maui-mac.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"src\\Controls\\samples\\Controls.Sample.Profiling\\Maui.Controls.Sample.Profiling.csproj",
"src\\Controls\\samples\\Controls.Sample.Sandbox\\Maui.Controls.Sample.Sandbox.csproj",
"src\\Controls\\samples\\Controls.Sample\\Maui.Controls.Sample.csproj",
"src\\Controls\\tests\\TestCases\\Controls.TestCases.App.csproj",
"src\\Controls\\tests\\TestCases.HostApp\\Controls.TestCases.HostApp.csproj",
"src\\Controls\\src\\Build.Tasks\\Controls.Build.Tasks.csproj",
"src\\Controls\\src\\Core.Design\\Controls.Core.Design.csproj",
"src\\Controls\\src\\Core\\Controls.Core.csproj",
Expand Down
2 changes: 1 addition & 1 deletion Microsoft.Maui-vscode.sln
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.Xaml.UnitTests.Int
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.Xaml.UnitTests.InternalsHiddenAssembly", "src\Controls\tests\Xaml.UnitTests.InternalsHiddenAssembly\Controls.Xaml.UnitTests.InternalsHiddenAssembly.csproj", "{FB39FACE-BAF2-4F97-A249-E45BA63D77FE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.TestCases.App", "src\Controls\tests\TestCases\Controls.TestCases.App.csproj", "{07C26A25-08C2-4C52-9574-1C33EC8E7919}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.TestCases.HostApp", "src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj", "{07C26A25-08C2-4C52-9574-1C33EC8E7919}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Maui.IntegrationTests", "src\TestUtils\src\Microsoft.Maui.IntegrationTests\Microsoft.Maui.IntegrationTests.csproj", "{A6976D43-B3A4-47AF-89D9-FA388B56B52B}"
EndProject
Expand Down
2 changes: 1 addition & 1 deletion Microsoft.Maui-windows.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"src\\Controls\\Maps\\src\\Controls.Maps.csproj",
"src\\Controls\\samples\\Controls.Sample.Profiling\\Maui.Controls.Sample.Profiling.csproj",
"src\\Controls\\samples\\Controls.Sample.Sandbox\\Maui.Controls.Sample.Sandbox.csproj",
"src\\Controls\\tests\\TestCases\\Controls.TestCases.App.csproj",
"src\\Controls\\tests\\TestCases.HostApp\\Controls.TestCases.HostApp.csproj",
"src\\Controls\\samples\\Controls.Sample\\Maui.Controls.Sample.csproj",
"src\\Controls\\src\\Build.Tasks\\Controls.Build.Tasks.csproj",
"src\\Controls\\src\\Core.Design\\Controls.Core.Design.csproj",
Expand Down
2 changes: 1 addition & 1 deletion Microsoft.Maui.LegacyControlGallery.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"src\\Controls\\Maps\\src\\Controls.Maps.csproj",
"src\\Controls\\samples\\Controls.Sample.Profiling\\Maui.Controls.Sample.Profiling.csproj",
"src\\Controls\\samples\\Controls.Sample.Sandbox\\Maui.Controls.Sample.Sandbox.csproj",
"src\\Controls\\tests\\TestCases\\Controls.TestCases.App.csproj",
"src\\Controls\\tests\\TestCases.HostApp\\Controls.TestCases.HostApp.csproj",
"src\\Controls\\samples\\Controls.Sample\\Maui.Controls.Sample.csproj",
"src\\Controls\\src\\Build.Tasks\\Controls.Build.Tasks.csproj",
"src\\Controls\\src\\Core.Design\\Controls.Core.Design.csproj",
Expand Down
2 changes: 1 addition & 1 deletion Microsoft.Maui.Samples.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"projects": [
"src\\BlazorWebView\\samples\\MauiRazorClassLibrarySample\\MauiRazorClassLibrarySample.csproj",
"src\\Controls\\samples\\Controls.Sample.Sandbox\\Maui.Controls.Sample.Sandbox.csproj",
"src\\Controls\\tests\\TestCases\\Controls.TestCases.App.csproj",
"src\\Controls\\tests\\TestCases.HostApp\\Controls.TestCases.HostApp.csproj",
"src\\Controls\\samples\\Controls.Sample\\Maui.Controls.Sample.csproj"
]
}
Expand Down
2 changes: 1 addition & 1 deletion Microsoft.Maui.sln
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Maui.IntegrationT
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.Xaml.UnitTests.InternalsHiddenAssembly", "src\Controls\tests\Xaml.UnitTests.InternalsHiddenAssembly\Controls.Xaml.UnitTests.InternalsHiddenAssembly.csproj", "{FB39FACE-BAF2-4F97-A249-E45BA63D77FE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.TestCases.App", "src\Controls\tests\TestCases\Controls.TestCases.App.csproj", "{F39F75DC-671B-4649-8005-1929797B3217}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.TestCases.HostApp", "src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj", "{F39F75DC-671B-4649-8005-1929797B3217}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UITest.Core", "src\TestUtils\src\UITest.Core\UITest.Core.csproj", "{352C2381-1DEC-4487-819D-340D1EA98FBE}"
EndProject
Expand Down
8 changes: 4 additions & 4 deletions docs/design/UITesting.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Appium relies on different implementations called `drivers` for each platform th

### The sample project

The project that is used for UI Tests is located here: `src\Controls\tests\TestCases\Controls.TestCases.App.csproj`
The project that is used for UI Tests is located here: `src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj`

There are two types of tests you can add, Issue and Gallery.

Expand All @@ -26,17 +26,17 @@ You will need to create some kind of UI to test against, which will go in the Co

Then in the Controls.AppiumTests project add a new class that derives from `_IssuesUITest` and add your test.

You can use the example for the sample project [here](https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases/Issues/RefreshViewPage.cs) and the example for the corresponding test [here](https://github.com/dotnet/maui/tree/main/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/RefreshViewTests.cs).
You can use the example for the sample project [here](https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases.HostApp/Issues/RefreshViewPage.cs) and the example for the corresponding test [here](https://github.com/dotnet/maui/tree/main/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/RefreshViewTests.cs).

### Adding a GalleryPage

Gallery tests are to make it easier to run the same set of tests on controls, if you are creating a new control you would want to add a new gallery page.

We have some base classes you can derive from to make setting this up easier: [CoreGalleryPage](https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases/CoreViews/CoreGalleryPage.cs) and [ContentViewGalleryPage](https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases/Elements/ContentViewGalleryPage.cs)
We have some base classes you can derive from to make setting this up easier: [CoreGalleryPage](https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases.HostApp/CoreViews/CoreGalleryPage.cs) and [ContentViewGalleryPage](https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases.HostApp/Elements/ContentViewGalleryPage.cs)

All controls you intend to interact with need to set the 'AutomationId' property as this will be what you use to query for the element.

Once you have created your GalleryPage, add it to [CorePageView](https://github.com/dotnet/maui/blob/5419846b1f20bdab1b5ce1dff40287edc5c38f12/src/Controls/tests/TestCases/CoreViews/CorePageView.cs#L45C41-L45C41) so that it will show up on the main page at launch.
Once you have created your GalleryPage, add it to [CorePageView](https://github.com/dotnet/maui/blob/5419846b1f20bdab1b5ce1dff40287edc5c38f12/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs#L45C41-L45C41) so that it will show up on the main page at launch.

### Adding the test

Expand Down
6 changes: 3 additions & 3 deletions eng/devices/devices-shared.cake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var projectMappings = new Dictionary<string, string>
["Graphics.DeviceTests"] = "Graphics.DeviceTests",
["MauiBlazorWebView.DeviceTests"] = "MauiBlazorWebView.DeviceTests",
["Essentials.DeviceTests"] = "Essentials.DeviceTests",
["Controls.TestCases.App"] = "Controls.TestCases.App",
["Controls.TestCases.HostApp"] = "Controls.TestCases.HostApp",
["Compatibility.ControlGallery.iOS"] = "Compatibility.ControlGallery.iOS",
["Compatibility.ControlGallery.Android"] = "Compatibility.ControlGallery.Android",
};
Expand All @@ -24,13 +24,13 @@ string DEFAULT_APP_PROJECT = "";
if (string.Equals(TARGET, "uitest", StringComparison.OrdinalIgnoreCase))
{
DEFAULT_PROJECT = "../../src/Controls/tests/TestCases.Shared.Tests/Controls.TestCases.Shared.Tests.csproj";
DEFAULT_APP_PROJECT = "../../src/Controls/tests/TestCases/Controls.TestCases.App.csproj";
DEFAULT_APP_PROJECT = "../../src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj";
}

if (string.Equals(TARGET, "uitest-build", StringComparison.OrdinalIgnoreCase))
{
DEFAULT_PROJECT = "../../src/Controls/tests/TestCases.Shared.Tests/Controls.TestCases.Shared.Tests.csproj";
DEFAULT_APP_PROJECT = "../../src/Controls/tests/TestCases/Controls.TestCases.App.csproj";
DEFAULT_APP_PROJECT = "../../src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj";
}

if (string.Equals(TARGET, "cg-uitest", StringComparison.OrdinalIgnoreCase))
Expand Down
4 changes: 2 additions & 2 deletions eng/devices/windows.cake
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,9 @@ Task("SetupTestPaths")
if (apps.Count() == 0)
{
var arcadeBin = new DirectoryPath("../../artifacts/bin/");
if(TEST_APP_PROJECT.FullPath.Contains("Controls.TestCases.App"))
if(TEST_APP_PROJECT.FullPath.Contains("Controls.TestCases.HostApp"))
{
binDir = MakeAbsolute(new DirectoryPath(arcadeBin + "/Controls.TestCases.App/" + CONFIGURATION + "/" + winVersion).Combine(DOTNET_PLATFORM));
binDir = MakeAbsolute(new DirectoryPath(arcadeBin + "/Controls.TestCases.HostApp/" + CONFIGURATION + "/" + winVersion).Combine(DOTNET_PLATFORM));
}

if(PROJECT.FullPath.Contains("Controls.DeviceTests"))
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ stages:
desc: Controls
androidApiLevelsExclude: [25] # Ignore for now API25 since the runs's are not stable
android: $(System.DefaultWorkingDirectory)/src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj
app: $(System.DefaultWorkingDirectory)/src/Controls/tests/TestCases/Controls.TestCases.App.csproj
app: $(System.DefaultWorkingDirectory)/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj
iosVersionsExclude: [ '12.4'] # Ignore iOS 12.4 while we can't make it work on CI
ios: $(System.DefaultWorkingDirectory)/src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj
winui: $(System.DefaultWorkingDirectory)/src/Controls/tests/TestCases.WinUI.Tests/Controls.TestCases.WinUI.Tests.csproj
Expand Down
Loading