-
Notifications
You must be signed in to change notification settings - Fork 1.8k
UITests
Tim Miller edited this page Aug 8, 2023
·
46 revisions
To run the tests on iOS or Catalyst, you'll need a Mac. To run the tests on Windows, you'll need a Windows machine. Android tests can be run from either platform.
- make sure a
dotnet tool restore
on the repo home - Make sure DeveloperMode is turned on
- Install nodejs https://nodejs.org/dist/v18.13.0/node-v18.13.0-x64.msi
- Install Windows App Driver from https://github.com/microsoft/WinAppDriver/releases/tag/v1.2.1
- Validate you have on your path %USERPROFILE%\AppData\Roaming\npm
- Note: you may need to restart your machine for this to take effect
- To install Appium run the following as Administrator https://github.com/dotnet/maui/tree/main/eng/scripts/appium-install.ps1
- make sure a
dotnet tool restore
on the repo home - Install nodejs https://nodejs.org/dist/v18.16.0/node-v18.16.0.pkg
- To install Appium run the following as sudo https://github.com/dotnet/maui/tree/main/eng/scripts/appium-install.ps1
sudo pwsh /path/to/scripts/appium-install.ps1
Ensure that you have the Android API 30 SDK installed, with the emulator image for Play store on x86/x64. By default, the tests use that. See screenshot below. If you want to use another image you can specify the --device
argument, with something like --device="android-emulator-64_33"
where the 64 means image x86_x64 and 33 indicates the API level.
./build.ps1 --target=dotnet-buildtasks --configuration="Release" --workloads=global
Android
./build.ps1 --target=dotnet-samples --configuration="Release" --workloads=global --android --usenuget=false
./build.ps1 -Script eng/devices/android.cake --target=uitest --project="/Users/ruimarinho/dotnet/maui/src/Controls/tests/UITests/Controls.AppiumTests.csproj" --appproject="/Users/ruimarinho/dotnet/maui/src/Controls/samples/Controls.Sample.UITests/Controls.Sample.UITests.csproj" --configuration="Release"
Windows
./build.ps1 --target=dotnet-samples --configuration="Release" --windows --verbosity=diagnostic --workloads=global --usenuget=false
./build.ps1 -Script eng/devices/windows.cake --target=uitest --project="/Users/ruimarinho/dotnet/maui/src/Controls/tests/UITests/Controls.AppiumTests.csproj" --appproject="/Users/ruimarinho/dotnet/maui/src/Controls/samples/Controls.Sample.UITests/Controls.Sample.UITests.csproj" --device="windows10" --apiversion="10.0.20348" --configuration="Release"
iOS
./build.ps1 --target=dotnet-samples --configuration="Release" --workloads=global --ios --usenuget=false
./build.ps1 -Script eng/devices/ios.cake --target=uitest --project="/Users/ruimarinho/dotnet/maui/src/Controls/tests/UITests/Controls.AppiumTests.csproj" --appproject="/Users/ruimarinho/dotnet/maui/src/Controls/samples/Controls.Sample.UITests/Controls.Sample.UITests.csproj" --device=ios-simulator-64 --apiversion="16.2" --configuration="Release"
Catalyst
./build.ps1 --target=dotnet-samples --configuration="Release" --catalyst --verbosity=diagnostic --workloads=global --usenuget=false
./build.ps1 -Script eng/devices/catalyst.cake --target=uitest --project="/Users/ruimarinho/dotnet/maui/src/Controls/tests/UITests/Controls.AppiumTests.csproj" --appproject="/Users/ruimarinho/dotnet/maui/src/Controls/samples/Controls.Sample.UITests/Controls.Sample.UITests.csproj" --apiversion="10.13" --configuration="Release" --device=mac
- Deploy the app Control.Sample.UITests to your simulator, device or on your desktop.
- Build the Controls.AppiumTests.csproj so the tests show up on the Test Explorer
- Run the tests
Android
./build.ps1 --target=dotnet-legacy-controlgallery --configuration="Release" --android --verbosity=diagnostic --workloads=global
./build.ps1 -Script eng/devices/android.cake --target=cg-uitest --project="/Users/ruimarinho/dotnet/maui/src/Compatibility/ControlGallery/test/Android.UITests/Compatibility.ControlGallery.Android.UITests.csproj" --appproject="/Users/ruimarinho/dotnet/maui/src/Compatibility/ControlGallery/src/Android/Compatibility.ControlGallery.Android.csproj" --configuration="Release"