Skip to content

Commit

Permalink
[net9.0] Merge main into net9.0 (#23328)
Browse files Browse the repository at this point in the history
* Simplify Development.md (#23142)

* Simplify Development.md

* Update .github/DEVELOPMENT.md

Co-authored-by: Eilon Lipton <Eilon@users.noreply.github.com>

* Update .github/DEVELOPMENT.md

Co-authored-by: Eilon Lipton <Eilon@users.noreply.github.com>

* Update .github/DEVELOPMENT.md

Co-authored-by: Eilon Lipton <Eilon@users.noreply.github.com>

* Update .github/DEVELOPMENT.md

Co-authored-by: Eilon Lipton <Eilon@users.noreply.github.com>

* Update DEVELOPMENT.md

* - modify and move advanced tips to different file

* Update DEVELOPMENT.md

* Update .github/DEVELOPMENT.md

Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>

* Update docs/DevelopmentTips.md

Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>

* Update docs/DevelopmentTips.md

Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>

* - updates based on review

---------

Co-authored-by: Eilon Lipton <Eilon@users.noreply.github.com>
Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>

* Wire RefreshView up to our xplat layout workflow (#23169) (#23218)

* Use better layout/measure path with refreshview

* - fix naming

* - set RefreshView content to maui compatible container

* - add test

* - fix null operator

* Update Issue23029.xaml.cs

* - fix content panel so it removes previous content

* - add additional check

* Remove adding to FutureAccessList as the app is running with runFullTrust capability (#23047)

* Call base.OnResume if Existing NavigationFragment Early (#23187)

* VSCode no longer uses MAUI to launch (#23222)

* [Android] Fix flyout behaviour switching exception (#22453)

* Fix flyout behaviour switching exception

* Tests added

* Flyout test page added

* Flyoutpage test fixes

* Flyout toggle test added

* Remove duplicate ] characters

* Flyout test pages added

* Check for platforms

* Fix title

* - fix tests

---------

Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
Co-authored-by: Shane Neuville <shneuvil@microsoft.com>

* Renamed the project because macOS uses .app (#23223)

* Renamed the project because macOS uses .app

* And the folder

* merge first

* ns

* Move tests to new location (#23251)

* Split SingleProject targets (#23269)

* Split SingleProject targets

* Update Microsoft.Maui.Controls.SingleProject.Before.targets

* Update bug-report.yml with 8.0.61 (#23273)

* Null terminate Page on TabbedRenderer (#23290)

Co-authored-by: Shane Neuville <shneuvil@microsoft.com>

* [Windows] Improve performance in accessibility extensions (#22698)

* AccessibilityExtensions: Add missing braces

* AccessibilityExtensions: Enable nullability and improve performance

* Update shipped & unshipped API

---------

Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com>

* [Android] Avoid double event subscribes in gesture manager (#23242)

* [Android] Avoid double event subscribes in gesture manager

* Fix typo in test text

* Bump Microsoft.Web.WebView2 from 1.0.2151.40 to 1.0.2592.51 (#23209)

* [tests] test a lot more things in `MemoryTests.cs` (#23324)

* [tests] test a lot more things in `MemoryTests.cs`

This expands the tests to cover more controls and areas.

* Add test cases for more controls:

  * `Ellipse`
  * `Grid`
  * `Path`
  * `Line`
  * `Path`
  * `RadioButton`
  * `Rectangle`
  * `RoundRectangle`

* Expand tests for a couple controls:

    * `Border` has a `StrokeShape`
    * Any `TemplatedView` gets a `ControlTemplate`

* Re-enable `ListView` for Android

This should work now after merging:

* dotnet/android#8900
* #23120

* Add a complicated test case for `BindableLayout`

Similar to the case at:

* #23199

* Skip `ListView` on API 23

* Bump Appium version to 2.11 (#23337)

* Bump Appium version to 2.11

* Update CarouselViewUITests.UpdateCurrentItem.cs

* Update appium-install.ps1

* Update CarouselViewUITests.UpdateCurrentItem.cs

* Simplify `NavigationRootManager.Connect` on the Windows platform. (#23345)

* Simplify `NavigationRootManager.Connect` on the Windows platform.

* Use ternary operator syntax

* Removed extra tabs

* Moved `_disconnected = false;` to `if (_disconnected)`

* Bump Appium Drivers (#23349)

* Fix Merge

---------

Co-authored-by: Eilon Lipton <Eilon@users.noreply.github.com>
Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>
Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Thomas Muller <imuller@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com>
Co-authored-by: Jonathan Dick <jodick@microsoft.com>
Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
Co-authored-by: Takym (たかやま) <15681312+Takym@users.noreply.github.com>
  • Loading branch information
11 people authored Jul 1, 2024
1 parent 763ddb4 commit a44823e
Show file tree
Hide file tree
Showing 565 changed files with 718 additions and 511 deletions.
340 changes: 22 additions & 318 deletions .github/DEVELOPMENT.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ body:
- 9.0.0-preview.3.10457
- 9.0.0-preview.2.10293
- 9.0.0-preview.1.9973
- 8.0.61 SR6.1
- 8.0.60 SR6
- 8.0.40 SR5
- 8.0.21 SR4.1
Expand Down Expand Up @@ -113,6 +114,7 @@ body:
- 8.0.21 SR4.1
- 8.0.40 SR5
- 8.0.60 SR6
- 8.0.61 SR6.1
- 9.0.0-preview.1.9973
- 9.0.0-preview.2.10293
- 9.0.0-preview.3.10457
Expand Down
6 changes: 0 additions & 6 deletions .vscode/launch.json → .vscode/.launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET MAUI",
"type": "maui",
"request": "launch",
"preLaunchTask": "maui: Build"
},
{
"name": "Attach to Process",
"type": "coreclr",
Expand Down
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
172 changes: 172 additions & 0 deletions docs/DevelopmentTips.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
### Reproducing an Issue/Debugging .NET MAUI Code
Open the .NET MAUI [workspace](https://code.visualstudio.com/docs/editor/workspaces) in VS Code by simply opening the root of your locally cloned .NET MAUI repository folder. VS Code will detect the workspace automatically and suggest that you open it.

In VS Code, select the device that you will be testing on. Using the Command Palette (<kbd>CTRL</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or on macOS <kbd>Command</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd>) type `pick device` and you will be presented with a set of choices for your target device (Android, iOS, etc). First select the option that describes the platform you want to run the project on, and then select the device that is available for that platform in the next menu.

![VS Code Command Palette to pick a target device](https://github.com/dotnet/maui/assets/939291/d008102f-0295-4034-a60a-8c2b58f86641)

There is a sample project in `src/Controls/samples/Controls.Sample.Sandbox`. This is an empty project, which directly references the .NET MAUI code. In this project you can add your code to reproduce an issue while allowing you to set breakpoints in .NET MAUI source code and debug through it easily.

To let VS Code know this is the project you want run, select the Sandbox project by going to the Command Palette (<kbd>CTRL</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or on macOS <kbd>Command</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd>) and start typing `pick startup` and select ".NET MAUI: Pick Startup Project" and then select the Sandbox project.

![VS Code Command Palette to pick the startup project](https://github.com/dotnet/maui/assets/939291/eae00559-4811-4034-95ae-b6fd1ea6d1b7)

Before using the Command Palette for the first time, you may have to wait a minute
for IntelliSense and other tasks to initialize. If the project hasn't 'settled' yet, you will see an error "Pick Startup Project has resulted in an error."

*Note:* When you are committing your PR, do not include your changes to the Sandbox project.


### Cake Commands

The below parameters can be used with the `dotnet cake` command in the root of your locally cloned .NET MAUI repository folder.

#### Clean
`--clean`
- Occasionally, when switching branches or syncing with the main branch, incremental builds may stop working. A common fix for this is to use git clean -xdf to delete all locally cached build information. However, the issue with git clean -xdf is that it will also wipe out any uncommitted changes. Using --clean to recursively delete the local obj/bin folders should hopefully resolve the issue while preserving your changes.

#### Target a specific platform
`--android`
`--ios`
`--windows`
`--catalyst`

```bash
dotnet cake --target=VS --workloads=global --android --ios
```

*Note* you will have to `git clean -xdf` your project if you change or add platforms.

### Blazor Hybrid

To build and run Blazor Desktop samples, check out the [Blazor Desktop](https://github.com/dotnet/maui/wiki/Blazor-Desktop) wiki topic.

# Advanced Scenarios

### Compile using a local `bin\dotnet` via `dotnet-local.*`

This method will use the .NET and workload versions that are specific to the branch you are on. There may be occasions when your global installation of .NET is not compatible with a particular branch. In such cases, this method will create a local folder containing all the .NET versions specific to that branch.

Use `dotnet-local.cmd` on Windows or `dotnet-local.sh` on Unix to ensure that `PATH` is set consistently.

#### Cake

You can run a `Cake` target to bootstrap .NET SDK in `bin\dotnet` and launch Visual Studio:

```dotnetcli
dotnet tool restore
dotnet cake --target=VS
```

There is also a `VSCode` target for launching Visual Studio Code.

```dotnetcli
dotnet tool restore
dotnet cake --target=VSCode
```

#### Testing branch against your project
`--sln=<Path to SLN>`
- This will pack .NET and then open a VS instance using the local pack. This is useful if you want to check to see if the changes in a branch will address your particular issues. Pack only runs the first time so you will need to explicitly add the `--pack` flag if you make changes and need to repack.

```dotnetcli
dotnet tool restore
dotnet cake --sln="<download_directory>\MauiApp2\MauiApp2.sln" --target=VS
```

#### Pack
`--pack`
- This creates .NET MAUI packs inside the local dotnet install. This lets you use the CLI commands with the local dotnet to create/deploy with any changes that have been made on that branch (including template changes).

```dotnetcli
dotnet tool restore
dotnet cake --target=VS --pack --sln="<download_directory>\MauiApp2\MauiApp2.sln"
```

Create new .NET MAUI app using your new packs
```dotnetcli
dotnet tool restore
dotnet cake --pack
mkdir MyMauiApp
cd MyMauiApp
..\bin\dotnet\dotnet new maui
..\bin\dotnet\dotnet build -t:Run -f net[current_sdk_version]-android
```

You can also run commands individually:
```dotnetcli
# install local tools required to build (cake, pwsh, etc..)
dotnet tool restore
# Provision .NET SDK in bin\dotnet
dotnet build src\DotNet\DotNet.csproj
# Builds Maui MSBuild tasks
.\bin\dotnet\dotnet build Microsoft.Maui.BuildTasks.slnf
# Builds the rest of Maui
.\bin\dotnet\dotnet build Microsoft.Maui.sln
# Launch Visual Studio
dotnet cake --target=VS
```

## Debugging MSBuild Tasks using VS/VSCode

One thing that is very useful is the ability to debug your Tasks while
they are being run on a build process. This is possible thanks to the
`MSBUILDDEBUGONSTART` environment variable. When set to `2` this will
force MSBuild to wait for a debugger connection before continuing.
You will see the following prompt.


```dotnetcli
Waiting for debugger to attach (dotnet PID 13001). Press enter to continue...
```

You can then use VS or VSCode to attach to this process and debug you tasks.
You can start your test app with the `dotnet-local` script (so it uses your maui build)

### [MacOS](#tab/macos)

```dotnetcli
MSBUILDDEBUGONSTART=2 ~/<some maui checkout>/dotnet-local.sh build -m:1
```

### [Linux](#tab/linux)

```dotnetcli
MSBUILDDEBUGONSTART=2 ~/<some maui checkout>/dotnet-local.sh build -m:1
```

### [Windows](#tab/windows)

```dotnetcli
set MSBUILDDEBUGONSTART=2
~/<some maui checkout>/dotnet-local.cmd build -m:1
```

---

Note: the `-m:1` is important as it restricts MSBuild to 1 node.

Once MSBuild starts it will print the following

```dotnetcli
Waiting for debugger to attach (dotnet PID xxxx). Press enter to continue...
```

You need to copy the PID value so we can use this in the IDE. For Visual Studio you can use the `Attach to Process` menu option, while you have the Microsoft.Maui.sln solution open. For VSCode open the workspace then use the `Attach to Process` Run and Debug option. You will be prompted for the PID and it will then connect.

Once connected go back to your command prompt and press ENTER so that the MSBuild process can continue.

You will be able to set breakpoints in Tasks (but not Targets) and step through code from this point on.

If you want to test in-tree in VSCode the `Build Platform Sample` command will ask you if you want to debug MSBuild tasks and fill in the `MSBUILDDEBUGONSTART` for you. The PID text will appear in the `Terminal` window in VSCode. You can then use the `Attach to Process` Run and Debug option to attach to the process.


### Integration Tests

The Integration test project under `src/TestUtils/src/Microsoft.Maui.IntegrationTests` contains tests which build and/or run MAUI templates or other projects.

These tests can be ran using the test explorer in VS, or from command line with `dotnet test`. Here's how to run an individual test with parameters from command line:

```bash
dotnet test src/TestUtils/src/Microsoft.Maui.IntegrationTests --logger "console;verbosity=diagnostic" --filter "Name=Build\(%22maui%22,%22net7.0%22,%22Debug%22,False\)"
```
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
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<SystemIOUnmanagedMemoryStreamPackageVersion>4.3.0</SystemIOUnmanagedMemoryStreamPackageVersion>
<SystemObjectModelPackageVersion>4.3.0</SystemObjectModelPackageVersion>
<SystemRuntimeCompilerServicesUnsafePackageVersion>6.0.0</SystemRuntimeCompilerServicesUnsafePackageVersion>
<_MicrosoftWebWebView2Version>1.0.2151.40</_MicrosoftWebWebView2Version>
<_MicrosoftWebWebView2Version>1.0.2592.51</_MicrosoftWebWebView2Version>
<!-- GLIDE - the android maven artifact in /src/Core/AndroidNative/maui/build.gradle -->
<!-- must be kept in sync with the binding library version to it here: -->
<_XamarinAndroidGlideVersion>4.15.1.2</_XamarinAndroidGlideVersion>
Expand Down
2 changes: 1 addition & 1 deletion eng/cake/dotnet.cake
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Task("dotnet-samples")
Error(errMsg);
throw new Exception(errMsg);
}
projectsToBuild = "./src/Controls/tests/TestCases/Controls.TestCases.App.csproj";
projectsToBuild = "./src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj";
properties["_UseNativeAot"] = "true";
}
else
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
Loading

0 comments on commit a44823e

Please sign in to comment.