diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Layout/GridSplitter/GridSplitter.xaml b/Microsoft.Toolkit.Uwp.UI.Controls.Layout/GridSplitter/GridSplitter.xaml
index 2b98ce6be8d..451e054d16f 100644
--- a/Microsoft.Toolkit.Uwp.UI.Controls.Layout/GridSplitter/GridSplitter.xaml
+++ b/Microsoft.Toolkit.Uwp.UI.Controls.Layout/GridSplitter/GridSplitter.xaml
@@ -4,29 +4,37 @@
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/UITests/UITests.Tests.Shared/Controls/GridSplitterTestPage.xaml.cs b/UITests/UITests.Tests.Shared/Controls/GridSplitterTestPage.xaml.cs
new file mode 100644
index 00000000000..39c39b82dfd
--- /dev/null
+++ b/UITests/UITests.Tests.Shared/Controls/GridSplitterTestPage.xaml.cs
@@ -0,0 +1,20 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+
+namespace UITests.App.Pages
+{
+ ///
+ /// An empty page that can be used on its own or navigated to within a Frame.
+ ///
+ public sealed partial class GridSplitterTestPage : Page
+ {
+ public GridSplitterTestPage()
+ {
+ this.InitializeComponent();
+ }
+ }
+}
diff --git a/UITests/UITests.Tests.Shared/TestAssembly.cs b/UITests/UITests.Tests.Shared/TestAssembly.cs
index 1992c2b94e1..47d45afbcdd 100644
--- a/UITests/UITests.Tests.Shared/TestAssembly.cs
+++ b/UITests/UITests.Tests.Shared/TestAssembly.cs
@@ -44,6 +44,7 @@ private static async Task InitalizeComService()
CommunicationService = new AppServiceConnection();
CommunicationService.RequestReceived += CommunicationService_RequestReceived;
+ CommunicationService.ServiceClosed += CommunicationService_ServiceClosed;
// Here, we use the app service name defined in the app service
// provider's Package.appxmanifest file in the section.
@@ -63,6 +64,11 @@ private static async Task InitalizeComService()
}
}
+ private static void CommunicationService_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
+ {
+ Log.Warning("[Harness] Communication Service Closed! AppServiceClosedStatus: {0}", args.Status.ToString());
+ }
+
internal static Task OpenPage(string pageName)
{
Log.Comment("[Harness] Sending Host Page Request: {0}", pageName);
@@ -74,6 +80,16 @@ internal static Task OpenPage(string pageName)
});
}
+ internal static async Task SendCustomMessageToApp(ValueSet message)
+ {
+ if (CommunicationService is null)
+ {
+ await InitalizeComService();
+ }
+
+ return await CommunicationService.SendMessageAsync(message);
+ }
+
private static async Task SendMessageToApp(ValueSet message)
{
if (CommunicationService is null)
@@ -83,10 +99,20 @@ private static async Task SendMessageToApp(ValueSet message)
var response = await CommunicationService.SendMessageAsync(message);
+ return CheckResponseStatusOK(response);
+ }
+
+ internal static bool CheckResponseStatusOK(AppServiceResponse response)
+ {
+ object message = null;
+ var hasMessage = response?.Message?.TryGetValue("Status", out message) is true;
+
+ Log.Comment("[Harness] Checking Response AppServiceResponseStatus({0}), Message Status: {1}", response.Status.ToString(), message?.ToString());
+
return response.Status == AppServiceResponseStatus.Success
- && response.Message.TryGetValue("Status", out var s)
- && s is string status
- && status == "OK";
+ && hasMessage
+ && message is string status
+ && status == "OK";
}
private static void CommunicationService_RequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
diff --git a/UITests/UITests.Tests.Shared/UITests.Tests.Shared.projitems b/UITests/UITests.Tests.Shared/UITests.Tests.Shared.projitems
index 192c7eb36a2..136a1a627ca 100644
--- a/UITests/UITests.Tests.Shared/UITests.Tests.Shared.projitems
+++ b/UITests/UITests.Tests.Shared/UITests.Tests.Shared.projitems
@@ -1,4 +1,4 @@
-
+
$(MSBuildAllProjects);$(MSBuildThisFileFullPath)
true
@@ -7,20 +7,19 @@
UITests.Tests.Shared
-
-
+
+
-
@@ -30,15 +29,15 @@
-
-
+
+
\ No newline at end of file
diff --git a/UITests/UITests.Tests.Shared/VisualTreeHelper.cs b/UITests/UITests.Tests.Shared/VisualTreeHelper.cs
new file mode 100644
index 00000000000..f558d12dfbb
--- /dev/null
+++ b/UITests/UITests.Tests.Shared/VisualTreeHelper.cs
@@ -0,0 +1,67 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using System.Threading.Tasks;
+
+#if USING_TAEF
+using WEX.Logging.Interop;
+#endif
+
+namespace UITests.Tests
+{
+ ///
+ /// Helper class to access some VisualTree info through our communication pipeline to the host app
+ /// using TestAssembly.SendMessageToApp.
+ ///
+ internal static class VisualTreeHelper
+ {
+ private static JsonSerializerOptions SerializerOptions { get; } = new JsonSerializerOptions(JsonSerializerDefaults.General)
+ {
+ NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals,
+ };
+
+ ///
+ /// Looks for the specified element by name and retrieves the specified property path.
+ ///
+ /// Name of element to search for.
+ /// Name of property to retrieve from element.
+ /// Type of data to serialize result back as.
+ /// Retrieved value or default.
+ public static async Task FindElementPropertyAsync(string name, string property)
+ {
+ var response = await TestAssembly.SendCustomMessageToApp(new()
+ {
+ { "Command", "Custom" },
+ { "Id", "VisualTreeHelper.FindElementProperty" },
+ { "ElementName", name },
+ { "Property", property },
+ });
+
+ if (!TestAssembly.CheckResponseStatusOK(response))
+ {
+ Log.Error("[Harness] VisualTreeHelper: Error trying to retrieve property {0} from element named {1}.", property, name);
+
+ return default(T);
+ }
+
+ if (response.Message.TryGetValue("Result", out object value) && value is string str)
+ {
+ Log.Comment("[Harness] VisualTreeHelper.FindElementPropertyAsync - Received: {0}", str);
+
+ try
+ {
+ return JsonSerializer.Deserialize(str, SerializerOptions);
+ }
+ catch
+ {
+ Log.Error("[Harness] VisualTreeHelper.FindElementPropertyAsync - Couldn't deserialize result as {0}", typeof(T));
+ }
+ }
+
+ return default(T);
+ }
+ }
+}
diff --git a/UITests/UITests.Tests.TAEF/UITests.Tests.TAEF.csproj b/UITests/UITests.Tests.TAEF/UITests.Tests.TAEF.csproj
index da8d60bfd20..18dc3731d9a 100644
--- a/UITests/UITests.Tests.TAEF/UITests.Tests.TAEF.csproj
+++ b/UITests/UITests.Tests.TAEF/UITests.Tests.TAEF.csproj
@@ -44,6 +44,8 @@
Version="10.0.19041.0" />
+
+
@@ -52,7 +54,7 @@
-
+