Browse Source

Don't use a tuple for window chrome buttons.

Return a record so that we can add extra elements more easily.
Steven Kirk 2 years ago
parent
commit
d46eb22f4e

+ 7 - 2
tests/Avalonia.IntegrationTests.Appium/ElementExtensions.cs

@@ -11,19 +11,24 @@ using Xunit;
 
 namespace Avalonia.IntegrationTests.Appium
 {
+    public record class WindowChrome(
+        AppiumWebElement Close,
+        AppiumWebElement Minimize,
+        AppiumWebElement Maximize);
+
     internal static class ElementExtensions
     {
         public static IReadOnlyList<AppiumWebElement> GetChildren(this AppiumWebElement element) =>
             element.FindElementsByXPath("*/*");
 
-        public static (AppiumWebElement close, AppiumWebElement minimize, AppiumWebElement maximize) GetChromeButtons(this AppiumWebElement window)
+        public static WindowChrome GetChromeButtons(this AppiumWebElement window)
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
             {
                 var closeButton = window.FindElementByXPath("//XCUIElementTypeButton[1]");
                 var fullscreenButton = window.FindElementByXPath("//XCUIElementTypeButton[2]");
                 var minimizeButton = window.FindElementByXPath("//XCUIElementTypeButton[3]");
-                return (closeButton, minimizeButton, fullscreenButton);
+                return new(closeButton, minimizeButton, fullscreenButton);
             }
 
             throw new NotSupportedException("GetChromeButtons not supported on this platform.");

+ 2 - 2
tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs

@@ -85,7 +85,7 @@ namespace Avalonia.IntegrationTests.Appium
             var mainWindow = GetWindow("MainWindow");
             var buttons = mainWindow.GetChromeButtons();
 
-            buttons.maximize.Click();
+            buttons.Maximize.Click();
 
             Thread.Sleep(500);
 
@@ -332,7 +332,7 @@ namespace Avalonia.IntegrationTests.Appium
 
             // Close the window manually.
             secondaryWindow = GetWindow("SecondaryWindow");
-            secondaryWindow.GetChromeButtons().close.Click();
+            secondaryWindow.GetChromeButtons().Close.Click();
         }
 
         [PlatformTheory(TestPlatforms.MacOS)]