Skip to content

Commit a7b7ed4

Browse files
committed
Updated to v5 and fixed tests
1 parent 38d3e54 commit a7b7ed4

27 files changed

Lines changed: 97 additions & 34 deletions

File tree

dotnet-maui/DittoMauiTasksApp/DittoMauiTasksApp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
</ItemGroup>
5353
<ItemGroup>
5454
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.1" />
55-
<PackageReference Include="Ditto" Version="5.0.0-preview.5" />
55+
<PackageReference Include="Ditto" Version="5.0.0" />
5656
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
5757
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
5858
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />

dotnet-maui/README.md

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@
22

33
## Prerequisites
44

5-
1. Install the .NET 9 SDK from <https://dotnet.microsoft.com/en-us/download/dotnet/9.0>
5+
1. Install the .NET 10 SDK from <https://dotnet.microsoft.com/en-us/download/dotnet/10.0>
66
2. Install the .NET MAUI workload by running `dotnet workload install maui`.
77
3. If you want to build and test the MAUI app for iOS, install Xcode from the Mac App Store.
88
4. If you want to build and test the MAUI app for Android, install Android Studio, or install the Android SDK, Java JDK, and Android emulator.
9-
5. 2. Create an application at <https://portal.ditto.live>. Make note of the app ID and online playground token
9+
5. Create an application at <https://portal.ditto.live>. Make note of the app ID and online playground token
1010
6. Copy the `.env.sample` file at the top level of the quickstart repo to `.env` and add your app ID and online playground token.
1111

12+
### Environment variables (Android builds and tests)
13+
14+
The .NET Android SDK requires `JAVA_HOME` and (for the UI tests / Appium) `ANDROID_HOME`.
1215

1316
## Documentation
1417

1518
- [Ditto C# .NET SDK Install Guide](https://docs.ditto.live/install-guides/c-sharp)
16-
- [Ditto C# .NET SDK API Reference](https://software.ditto.live/dotnet/Ditto/4.11.1/api-reference/)
19+
- [Ditto C# .NET SDK API Reference](https://software.ditto.live/dotnet/Ditto/5.0.0/api-reference/)
1720
### Restore Packages
1821

1922
```sh
@@ -29,6 +32,12 @@ These commands will build and run the app on the default iOS target:
2932
dotnet build -t:Run -f net10.0-ios
3033
```
3134

35+
If your installed Xcode is newer than the version the .NET iOS workload was published against, you'll see `error: This version of .NET for iOS (...) requires Xcode XX.X`. Bypass the check with:
36+
37+
```sh
38+
dotnet build -t:Run -f net10.0-ios -p:ValidateXcodeVersion=false
39+
```
40+
3241
### Building and Running the App on Android
3342

3443
These commands will build and run the app on the default Android target:
@@ -51,7 +60,54 @@ dotnet build -t:Run -f net10.0-windows10.0.19041.0
5160

5261
### Other MAUI Platforms
5362

54-
Other platforms not supported at this time.
63+
Other platforms not supported at this time.
64+
65+
## Running the UI Tests Locally
66+
67+
The `UITests.iOS` and `UITests.Android` projects are Appium-driven UI tests run via `dotnet run` (Program.cs is the entry point). They require:
68+
69+
1. **Appium 2 + drivers**:
70+
```sh
71+
npm install -g appium
72+
appium driver install xcuitest
73+
appium driver install uiautomator2
74+
```
75+
2. **Appium server** running with `ANDROID_HOME` and `JAVA_HOME` exported in *its* shell:
76+
```sh
77+
appium
78+
```
79+
3. **A booted simulator/emulator** (or a connected device).
80+
4. **The app installed on the target** before `dotnet run`.
81+
5. **`DITTO_CLOUD_TASK_TITLE`** set to a task title that exists in your Ditto cloud (the test asserts it can be found in the synced UI).
82+
83+
### iOS
84+
85+
```sh
86+
# Build & install to the booted simulator
87+
dotnet build DittoMauiTasksApp/DittoMauiTasksApp.csproj \
88+
-f net10.0-ios -p:ValidateXcodeVersion=false -t:Run
89+
90+
# Run the test
91+
cd UITests.iOS
92+
DITTO_CLOUD_TASK_TITLE="<seeded-title>" dotnet run
93+
```
94+
95+
### Android
96+
97+
The Debug APK uses Mono Fast Deployment by default, which only works when launched via `dotnet build -t:Run`. If you `adb install` the APK manually, build with assemblies embedded:
5598

99+
```sh
100+
dotnet build DittoMauiTasksApp/DittoMauiTasksApp.csproj \
101+
-f net10.0-android -p:EmbedAssembliesIntoApk=true
102+
103+
adb -s emulator-5554 install -r \
104+
DittoMauiTasksApp/bin/Debug/net10.0-android/live.ditto.quickstart.mauitasksapp-Signed.apk
105+
```
56106

107+
When multiple Android devices are connected (e.g., an emulator + an unauthorized physical device), point the test at a specific one with `APPIUM_UDID`:
57108

109+
```sh
110+
cd UITests.Android
111+
APPIUM_UDID="emulator-5554" \
112+
DITTO_CLOUD_TASK_TITLE="<seeded-title>" dotnet run
113+
```

dotnet-maui/UITests.Android/AndroidTaskSearchTests.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ protected override AppiumDriver CreateDriver()
5252
options.AddAdditionalAppiumOption("newCommandTimeout", 300);
5353
options.AddAdditionalAppiumOption("autoGrantPermissions", true);
5454

55+
// Optional: target a specific device when multiple are connected (e.g. APPIUM_UDID=emulator-5554)
56+
var explicitUdid = Environment.GetEnvironmentVariable("APPIUM_UDID");
57+
if (!string.IsNullOrEmpty(explicitUdid))
58+
{
59+
options.AddAdditionalAppiumOption("udid", explicitUdid);
60+
}
61+
5562
return new AndroidDriver(new Uri("http://127.0.0.1:4723"), options);
5663
}
5764
}
@@ -62,13 +69,13 @@ private string GetAppPath()
6269
var apkFileName = "live.ditto.quickstart.mauitasksapp-Signed.apk";
6370

6471
// Look for APK in release directory first (what we just built)
65-
var releasePath = Path.Combine(projectRoot, "DittoMauiTasksApp", "bin", "Release", "net9.0-android", apkFileName);
72+
var releasePath = Path.Combine(projectRoot, "DittoMauiTasksApp", "bin", "Release", "net10.0-android", apkFileName);
6673
if (File.Exists(releasePath))
6774
{
6875
return releasePath;
6976
}
7077

71-
var debugPath = Path.Combine(projectRoot, "DittoMauiTasksApp", "bin", "Debug", "net9.0-android", apkFileName);
78+
var debugPath = Path.Combine(projectRoot, "DittoMauiTasksApp", "bin", "Debug", "net10.0-android", apkFileName);
7279
if (File.Exists(debugPath))
7380
{
7481
return debugPath;

dotnet-maui/UITests.Android/UITests.Android.csproj

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<IsPackable>false</IsPackable>
@@ -11,11 +11,9 @@
1111
<!-- Using direct BrowserStack REST API approach like other apps in this repo -->
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0">
15-
<ExcludeAssets>runtime</ExcludeAssets>
16-
</PackageReference>
17-
<PackageReference Include="NUnit" Version="4.2.2" />
18-
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.5.1" />
15+
<PackageReference Include="NUnit" Version="4.6.0" />
16+
<PackageReference Include="NUnit3TestAdapter" Version="6.2.0" />
1917
<PackageReference Include="Appium.WebDriver" Version="5.2.0" />
2018
</ItemGroup>
2119

dotnet-maui/UITests.Shared/UITests.Shared.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
@@ -15,9 +15,9 @@
1515
</PropertyGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="NUnit" Version="4.2.2" />
19-
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
20-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0">
18+
<PackageReference Include="NUnit" Version="4.6.0" />
19+
<PackageReference Include="NUnit3TestAdapter" Version="6.2.0" />
20+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.5.1">
2121
<ExcludeAssets>runtime</ExcludeAssets>
2222
</PackageReference>
2323
<PackageReference Include="Appium.WebDriver" Version="5.2.0">

dotnet-maui/UITests.iOS/UITests.iOS.csproj

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<IsPackable>false</IsPackable>
@@ -10,11 +10,9 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0">
14-
<ExcludeAssets>runtime</ExcludeAssets>
15-
</PackageReference>
16-
<PackageReference Include="NUnit" Version="4.2.2" />
17-
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.5.1" />
14+
<PackageReference Include="NUnit" Version="4.6.0" />
15+
<PackageReference Include="NUnit3TestAdapter" Version="6.2.0" />
1816
<PackageReference Include="Appium.WebDriver" Version="5.2.0" />
1917
</ItemGroup>
2018

dotnet-maui/UITests.iOS/iOSTaskSearchTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ private string GetAppPath()
6565
{
6666
// Look for the .app in the MAUI project's build output
6767
var projectRoot = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "..", "..", ".."));
68-
var appPath = Path.Combine(projectRoot, "DittoMauiTasksApp", "bin", "Debug", "net9.0-ios", "iossimulator-arm64");
68+
var appPath = Path.Combine(projectRoot, "DittoMauiTasksApp", "bin", "Debug", "net10.0-ios", "iossimulator-arm64");
6969

7070
if (!Directory.Exists(appPath))
7171
{
7272
// Fallback to x64 simulator
73-
appPath = Path.Combine(projectRoot, "DittoMauiTasksApp", "bin", "Debug", "net9.0-ios", "iossimulator-x64");
73+
appPath = Path.Combine(projectRoot, "DittoMauiTasksApp", "bin", "Debug", "net10.0-ios", "iossimulator-x64");
7474
}
7575

7676
return appPath;

dotnet-tui/DittoDotNetTasksConsole.Tests/DittoDotNetTasksConsole.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<IsPackable>false</IsPackable>
@@ -12,7 +12,7 @@
1212
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
1313
<PackageReference Include="xunit" Version="2.9.2" />
1414
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
15-
<PackageReference Include="Ditto" Version="5.0.0-preview.4" />
15+
<PackageReference Include="Ditto" Version="5.0.0" />
1616
<PackageReference Include="Terminal.Gui" Version="1.17.1" />
1717
</ItemGroup>
1818

dotnet-tui/DittoDotNetTasksConsole/DittoDotNetTasksConsole.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Ditto" Version="5.0.0-preview.5" />
12+
<PackageReference Include="Ditto" Version="5.0.0" />
1313
<PackageReference Include="Terminal.Gui" Version="1.17.1" />
1414
</ItemGroup>
1515

dotnet-tui/DittoDotNetTasksConsole/ditto-f5e954d9-0092-47a0-9a79-2829e767ba7b/__ditto_lock_file

Whitespace-only changes.

0 commit comments

Comments
 (0)