### Commit and Pull Request Format Guide Source: https://github.com/unoplatform/uno.uitest/blob/master/CONTRIBUTING.md This format is used for commit messages and pull requests to ensure consistency and clarity. It includes a concise summary, detailed bullet points for changes, and a specific way to reference associated bug numbers. ```markdown ``` Summary of the changes (Less than 80 chars) - Detail 1 - Detail 2 Addresses #bugnumber (in this specific format) ``` ``` -------------------------------- ### Initialize Uno.UITest Environment Source: https://context7.com/unoplatform/uno.uitest/llms.txt Configures the test environment for Uno.UITest, setting application names, URIs, and platform-specific options for different targets like Android, WebAssembly, and iOS. It utilizes NUnit attributes for test setup and integrates with the IApp interface for test execution. ```csharp using NUnit.Framework; using Uno.UITest; using Uno.UITests.Helpers; using Uno.UITest.Helpers.Queries; public class TestBase { private IApp _app; static TestBase() { // Configure test environment AppInitializer.TestEnvironment.AndroidAppName = "uno.platform.uitestsample"; AppInitializer.TestEnvironment.WebAssemblyDefaultUri = "http://localhost:54490/"; AppInitializer.TestEnvironment.iOSAppName = "uno.platform.uitestsample"; AppInitializer.TestEnvironment.iOSDeviceNameOrId = "iPad Pro (12.9-inch) (5th generation)"; AppInitializer.TestEnvironment.CurrentPlatform = Platform.Browser; AppInitializer.TestEnvironment.WebAssemblyBrowser = Browser.Chrome; AppInitializer.TestEnvironment.WebAssemblyHeadless = true; // Cold start app once for all tests AppInitializer.ColdStartApp(); } protected IApp App { get => _app; private set { _app = value; Uno.UITest.Helpers.Queries.Helpers.App = value; } } [SetUp] public void StartApp() { // Attach to already running app for each test App = AppInitializer.AttachToApp(); } } ``` -------------------------------- ### iOS UI Testing Script (Shell) Source: https://github.com/unoplatform/uno.uitest/blob/master/doc/using-uno-uitest.md Shell script for running iOS UI tests in a simulator within a CI environment using macOS agents. This script automates the setup and execution of UI tests for iOS applications. ```shell #!/bin/bash # Example script for iOS UI Testing in a simulator using macOS # Full script available at: https://github.com/unoplatform/Uno.UITest/blob/master/build/ios-uitest-run.sh ``` -------------------------------- ### Create Uno Platform UI Test Project (Shell) Source: https://github.com/unoplatform/uno.uitest/blob/master/doc/using-uno-uitest.md Demonstrates the command-line steps to create a new Uno Platform UI test project using the `dotnet new` command. This involves navigating to the solution directory and executing the template command. ```shell dotnet new -i Uno.ProjectTemplates.Dotnet cd YourAppName.UITests dotnet new unoapp-uitest ``` -------------------------------- ### Element Selection with Uno.UITest Queries Source: https://context7.com/unoplatform/uno.uitest/llms.txt Demonstrates various strategies for selecting UI elements within Uno.UITest using a fluent query API. Supported methods include selection by mark (AutomationId/x:Name), CSS class, text content, hierarchical relationships (descendants), index, and raw Calabash queries. It also shows how to wait for elements and query their properties. ```csharp using Query = System.Func; // Select by mark (AutomationId or x:Name) Query button = q => q.Marked("submitButton"); Query textBox = q => q.Marked("usernameInput"); // Select by class Query allButtons = q => q.Class("Button"); // Select by text content Query labelWithText = q => q.Text("Welcome"); // Select descendant elements Query innerElement = q => q.Marked("parentContainer").Descendant().Marked("childElement"); // Select by index Query secondButton = q => q.Class("Button").Index(1); // Raw Calabash query Query customQuery = q => q.Raw("* marked:'elementName'"); // Combine multiple selectors Query complexQuery = q => q.Marked("container").Descendant().Class("TextBlock").Text("Click me"); // Wait and query App.WaitForElement(button); var results = App.Query(button); Console.WriteLine($"Found {results.Length} elements"); ``` -------------------------------- ### Configure WebAssembly Testing with Selenium Source: https://context7.com/unoplatform/uno.uitest/llms.txt Sets up Selenium-based testing for WebAssembly applications. This configuration allows specifying the target URI, browser (Chrome or Edge), headless mode, window size, and driver/browser paths. Advanced options include screenshot paths, custom Selenium arguments, and Docker environment detection. ```csharp using Uno.UITest.Selenium; using System; // Basic configuration var app = Uno.UITest.Selenium.ConfigureApp .WebAssembly .Uri(new Uri("http://localhost:54490/")) .UsingBrowser("Chrome") .Headless(true) .WindowSize(1024, 768) .StartApp(); // Advanced configuration with custom driver path var configurator = Uno.UITest.Selenium.ConfigureApp .WebAssembly .Uri(new Uri("http://localhost:8080/")) .UsingBrowser("Edge") .Headless(false) .DriverPath("/path/to/chromedriver") .BrowserPath("/path/to/chrome") .WindowSize(1920, 1080) .ScreenShotsPath("./screenshots") .SeleniumArgument("--remote-debugging-port=9222") .DetectDockerEnvironment(true); var app = configurator.StartApp(); // Environment variable overrides // UNO_UITEST_TARGETURI - Override target URI // UNO_UITEST_BROWSER - Override browser (CHROME or EDGE) // UNO_UITEST_DRIVER_PATH - Override driver path // UNO_UITEST_SCREENSHOT_PATH - Override screenshot path ``` -------------------------------- ### Configure WebAssembly Test Constants (C#) Source: https://github.com/unoplatform/uno.uitest/blob/master/doc/using-uno-uitest.md Shows how to configure constants within the `Constants.cs` file for running UI tests on the WebAssembly platform. This involves setting the default URI for the deployed application and specifying the current platform as the browser. ```csharp // Update the Constants.WebAssemblyDefaultUri property in Constants.cs // Change the Constants.CurrentPlatform to Platform.Browser ``` -------------------------------- ### Complete Login Workflow Test in C# Source: https://context7.com/unoplatform/uno.uitest/llms.txt Demonstrates a full end-to-end login workflow using Uno.UITest. This includes navigating to the login page, entering credentials, submitting the form, and asserting successful login. It utilizes query definitions, element interactions (Tap, EnterText), assertions (Assert.IsFalse, Assert.IsTrue), and screenshots for visual verification. Dependencies include NUnit, Uno.UITest, and Uno.UITests helpers. ```csharp using System; using System.Linq; using NUnit.Framework; using Uno.UITest; using Uno.UITest.Helpers.Queries; using Uno.UITests.Helpers; using Query = System.Func; namespace Sample.UITests { [TestFixture] public class LoginTests : TestBase { [Test] public void CompleteLoginWorkflow() { // Define queries Query loginPageButton = q => q.Marked("Login Page"); Query emailField = q => q.Marked("emailInput"); Query passwordField = q => q.Marked("passwordInput"); Query loginButton = q => q.Marked("loginButton"); Query errorMessage = q => q.Marked("errorMessage"); Query welcomeMessage = q => q.Marked("welcomeMessage"); // Navigate to login page App.WaitForElement(loginPageButton); App.Screenshot("00-home-screen"); App.Tap(loginPageButton); // Verify login page loaded App.WaitForElement(emailField); App.WaitForElement(passwordField); App.Screenshot("01-login-page"); // Verify initial state App.WaitForDependencyPropertyValue(emailField, "Text", ""); App.WaitForDependencyPropertyValue(passwordField, "Text", ""); var isButtonEnabled = App.Query(q => loginButton(q).GetDependencyPropertyValue("IsEnabled").Value() ).First(); Assert.IsFalse(isButtonEnabled); // Enter credentials App.Tap(emailField); App.EnterText("testuser@example.com"); App.Screenshot("02-email-entered"); App.Tap(passwordField); App.EnterText("SecurePassword123!"); App.DismissKeyboard(); App.Screenshot("03-password-entered"); // Verify form state App.WaitForDependencyPropertyValue(emailField, "Text", "testuser@example.com"); App.WaitForDependencyPropertyValue(passwordField, "Text", "SecurePassword123!"); // Submit login App.Tap(loginButton); App.Screenshot("04-login-submitted"); // Wait for and verify success App.WaitForElement(welcomeMessage, timeoutMessage: "Login did not complete", timeout: TimeSpan.FromSeconds(10) ); var welcomeText = App.Query(q => welcomeMessage(q).GetDependencyPropertyValue("Text").Value() ).First(); Assert.IsTrue(welcomeText.Contains("testuser")); App.Screenshot("05-login-success"); } [Test] public void LoginWithInvalidCredentials() { Query loginPageButton = q => q.Marked("Login Page"); Query emailField = q => q.Marked("emailInput"); Query passwordField = q => q.Marked("passwordInput"); Query loginButton = q => q.Marked("loginButton"); Query errorMessage = q => q.Marked("errorMessage"); App.Tap(loginPageButton); App.WaitForElement(emailField); // Enter invalid credentials App.EnterText(emailField, "invalid@example.com"); App.EnterText(passwordField, "wrongpassword"); App.Tap(loginButton); // Verify error appears App.WaitForElement(errorMessage); var errorText = App.Query(q => errorMessage(q).GetDependencyPropertyValue("Text").Value() ).First(); Assert.AreEqual("Invalid email or password", errorText); // Verify fields are cleared App.WaitForDependencyPropertyValue(emailField, "Text", ""); App.WaitForDependencyPropertyValue(passwordField, "Text", ""); App.Screenshot("error-state"); } } } ``` -------------------------------- ### Configure Uno Platform Project for UI Tests (XML) Source: https://github.com/unoplatform/uno.uitest/blob/master/doc/using-uno-uitest.md Adds necessary configurations to the .csproj file for enabling UI testing, particularly for debug builds or when UI automation mapping is enabled. This ensures the `USE_UITESTS` define is set. ```xml True $(DefineConstants);USE_UITESTS ``` -------------------------------- ### WebAssembly UI Testing Script (Shell) Source: https://github.com/unoplatform/uno.uitest/blob/master/doc/using-uno-uitest.md Shell script for running WebAssembly UI tests in a CI environment using Linux agents. This script facilitates the automation of UI tests for WebAssembly applications. ```shell #!/bin/bash # Example script for WebAssembly UI Testing using Linux # Full script available at: https://github.com/unoplatform/Uno.UITest/blob/master/build/wasm-uitest-run.sh ``` -------------------------------- ### Loading Fonts from Android Assets in C# (Uno Platform) Source: https://github.com/unoplatform/uno.uitest/blob/master/src/Sample/Sample.Droid/Assets/AboutAssets.txt Shows how to load a font file from the Android assets directory using C#. This is useful for custom fonts required by the application. The `Typeface.CreateFromAsset` method takes the asset path as a string argument. ```csharp Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); ``` -------------------------------- ### Screenshot and Debugging Operations in Uno UI Test (C#) Source: https://context7.com/unoplatform/uno.uitest/llms.txt Illustrates how to capture screenshots at different stages of a test for debugging and documentation. Supports basic screenshots, capturing during execution, and retrieving file information. Requires Uno.UITest. ```csharp using System.IO; // Take basic screenshot App.Screenshot("test-initial-state"); // Screenshot during test execution App.Tap("submitButton"); App.Screenshot("after-submit-click"); App.WaitForElement("successMessage"); App.Screenshot("success-message-displayed"); // Get screenshot file info FileInfo screenshotFile = App.Screenshot("error-state"); Console.WriteLine($"Screenshot saved to: {screenshotFile.FullName}"); // Comprehensive test with screenshots Query loginButton = q => q.Marked("loginButton"); Query errorMessage = q => q.Marked("errorMessage"); App.Screenshot("01-login-screen"); App.EnterText("emailField", "invalid@email"); App.Screenshot("02-email-entered"); App.EnterText("passwordField", "wrongpass"); App.Screenshot("03-password-entered"); App.Tap(loginButton); App.Screenshot("04-after-login-attempt"); App.WaitForElement(errorMessage); App.Screenshot("05-error-displayed"); ``` -------------------------------- ### Sample UI Test for CheckBox Interaction (C#) Source: https://github.com/unoplatform/uno.uitest/blob/master/doc/using-uno-uitest.md A C# NUnit test class demonstrating how to interact with a CheckBox UI element using Uno.UITest APIs. It includes steps for finding the element, verifying its initial state, tapping it, and verifying the state change. ```csharp using NUnit.Framework; using Uno.UITest.Helpers.Queries; using System.Linq; // Alias to simplify the creation of element queries using Query = System.Func; public class CheckBox_Tests : TestBase { [Test] public void CheckBox01() { Query checkBoxSelector = q => q.Marked("cb1"); App.WaitForElement(checkBoxSelector); Query cb1 = q => q.Marked("cb1"); App.WaitForElement(cb1); var value1 = App.Query(q => cb1(q).GetDependencyPropertyValue("IsChecked").Value()).First(); Assert.IsFalse(value1); App.Tap(cb1); var value2 = App.Query(q => cb1(q).GetDependencyPropertyValue("IsChecked").Value()).First(); Assert.IsTrue(value2); } } ``` -------------------------------- ### Accessing Android Assets in C# (Uno Platform) Source: https://github.com/unoplatform/uno.uitest/blob/master/src/Sample/Sample.Droid/Assets/AboutAssets.txt Demonstrates how to open and read a raw asset file deployed with an Android application using C#. This method requires the file to be placed in the appropriate directory and assigned the 'AndroidAsset' build action. It returns an InputStream for reading the asset's content. ```csharp public class ReadAsset : Activity { protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); InputStream input = Assets.Open ("my_asset.txt"); } } ``` -------------------------------- ### Initialize Xamarin Test Cloud Agent in App.xaml.cs (C#) Source: https://github.com/unoplatform/uno.uitest/blob/master/doc/using-uno-uitest.md Initializes the Xamarin Test Cloud Agent within the `OnLaunched` method of the `App.xaml.cs` file for iOS projects when UI tests are enabled. This is a prerequisite for running UI tests on iOS. ```csharp #if __IOS__ && USE_UITESTS // Launches Xamarin Test Cloud Agent Xamarin.Calabash.Start(); #endif ``` -------------------------------- ### Access and Filter System Logs in C# Source: https://context7.com/unoplatform/uno.uitest/llms.txt This C# code demonstrates how to access system logs, filter them by timestamp, and output specific log entries. It's designed for use within a test framework, capturing logs before and after a test run. Dependencies include the Uno Platform testing framework and its `IApp` interface. ```csharp using System; using System.Linq; public class TestBase { private IApp _app; private DateTime? _logsLastDate; [SetUp] public void StartApp() { App = AppInitializer.AttachToApp(); // Store timestamp for log filtering _logsLastDate = App?.GetSystemLogs().LastOrDefault()?.Timestamp; } [TearDown] public void CloseApp() { // Output logs from this test Console.WriteLine("=== Browser Logs ==="); foreach (var log in App.GetSystemLogs(_logsLastDate)) { Console.WriteLine($"[{log.Timestamp}][{log.Level}] {log.Message}"); } } } // Query logs programmatically var allLogs = App.GetSystemLogs(); var errorLogs = allLogs.Where(log => log.Level == "ERROR"); var recentLogs = App.GetSystemLogs(DateTime.Now.AddMinutes(-5)); foreach (var log in errorLogs) { Console.WriteLine($"Error: {log.Message}"); } ``` -------------------------------- ### Android UI Testing Script (Shell) Source: https://github.com/unoplatform/uno.uitest/blob/master/doc/using-uno-uitest.md Shell script for running Android UI tests in a simulator within a CI environment using Linux agents. This script automates the build, deployment, and test execution process. ```shell #!/bin/bash # Example script for Android UI Testing in a Simulator using Linux # Full script available at: https://github.com/unoplatform/Uno.UITest/blob/master/build/android-uitest-run.sh ``` -------------------------------- ### Perform Tap and Touch Gestures in Uno UI Tests Source: https://context7.com/unoplatform/uno.uitest/llms.txt Execute tap, double-tap, and touch-and-hold gestures on UI elements or at specific coordinates. This functionality is essential for simulating user interactions within the application. It supports tapping by element mark, using queries, and directly at coordinates, as well as multi-touch gestures like double-tap and touch-and-hold. The position of an element can be queried to tap its center. ```csharp using Query = System.Func; // Tap by mark App.Tap("loginButton"); // Tap using query Query submitButton = q => q.Marked("submitButton"); App.Tap(submitButton); // Tap at specific coordinates App.TapCoordinates(100f, 200f); // Double tap App.DoubleTap("imageElement"); App.DoubleTap(q => q.Marked("zoomableImage")); App.DoubleTapCoordinates(150f, 250f); // Touch and hold App.TouchAndHold("menuItem"); App.TouchAndHold(q => q.Marked("contextMenu")); App.TouchAndHoldCoordinates(300f, 400f); // Get element position and tap center Query element = q => q.Marked("myElement"); var rect = App.Query(element).First().Rect; App.TapCoordinates(rect.CenterX, rect.CenterY); ``` -------------------------------- ### Implement Waits for Elements and Conditions in Uno UI Tests Source: https://context7.com/unoplatform/uno.uitest/llms.txt Synchronize test execution by waiting for UI elements to appear or disappear, or for custom conditions to be met. This includes setting timeouts and retry frequencies for robust testing, especially in asynchronous scenarios. The snippets demonstrate waiting for elements, waiting for their absence, and executing custom predicates with configurable timeouts and messages. ```csharp using System; using Query = System.Func; // Wait for element to appear Query loadingIndicator = q => q.Marked("loadingSpinner"); Query content = q => q.Marked("mainContent"); App.Tap("refreshButton"); App.WaitForElement(loadingIndicator); App.WaitForNoElement(loadingIndicator, timeout: TimeSpan.FromSeconds(30)); App.WaitForElement(content); // Wait with custom timeout and message App.WaitForElement( q => q.Marked("slowElement"), timeoutMessage: "Element failed to appear within timeout", timeout: TimeSpan.FromSeconds(60), retryFrequency: TimeSpan.FromMilliseconds(500) ); // Wait for custom condition App.Tap("processButton"); App.WaitFor( predicate: () => { var statusText = App.Query(q => q.Marked("status") .GetDependencyPropertyValue("Text") .Value()) .FirstOrDefault(); return statusText == "Complete"; }, timeoutMessage: "Process did not complete", timeout: TimeSpan.FromMinutes(2), retryFrequency: TimeSpan.FromMilliseconds(200) ); // Wait for element to disappear Query errorDialog = q => q.Marked("errorDialog"); App.Tap("dismissError"); App.WaitForNoElement(errorDialog, timeout: TimeSpan.FromSeconds(5)); ``` -------------------------------- ### Platform-Specific Testing in Uno UI Test (C#) Source: https://context7.com/unoplatform/uno.uitest/llms.txt Shows how to detect the current platform (Browser, iOS, Android) and execute platform-specific test logic or conditionally skip tests. Utilizes Uno.UITest.Helpers. ```csharp using Uno.UITests.Helpers; using Uno.UITest.Helpers.Queries; // Get current platform var platform = AppInitializer.GetLocalPlatform(); if (platform == Platform.Browser) { // WebAssembly-specific test logic Console.WriteLine("Running on WebAssembly"); } else if (platform == Platform.iOS) { // iOS-specific test logic Console.WriteLine("Running on iOS"); } else if (platform == Platform.Android) { // Android-specific test logic Console.WriteLine("Running on Android"); } // Conditional execution helper PlatformHelpers.On( iOS: () => { // iOS-specific code App.SetOrientationLandscape(); }, Android: () => { // Android-specific code App.Back(); }, Browser: () => { // Browser-specific code App.Screenshot("browser-state"); } ); // Skip test on specific platforms if (platform == Platform.Android || platform == Platform.iOS) { // Skip due to platform limitations Assert.Ignore("PointerEvents don't fire properly on mobile platforms"); return; } ``` -------------------------------- ### Handle Text Input and Keyboard Operations in Uno UI Tests Source: https://context7.com/unoplatform/uno.uitest/llms.txt Manage text entry into input fields, clear existing text, and control the keyboard during UI tests. This includes typing directly into focused elements, specifying the element for text entry, and clearing text from input fields. Keyboard dismissal and simulating the 'Enter' key press are also supported, enabling comprehensive testing of forms and input-driven workflows. ```csharp using Query = System.Func; Query textBox = q => q.Marked("usernameField"); // Enter text in focused element App.Tap(textBox); App.EnterText("john.doe@example.com"); // Enter text in specific element App.EnterText(textBox, "Hello World"); App.EnterText("passwordField", "SecurePass123"); // Clear text App.ClearText(textBox); App.ClearText("emailField"); App.ClearText(); // Clear currently focused element // Press Enter key App.EnterText(q => q.Marked("searchBox"), "test query"); App.PressEnter(); // Dismiss keyboard App.DismissKeyboard(); // Complete text entry workflow Query emailInput = q => q.Marked("emailInput"); Query passwordInput = q => q.Marked("passwordInput"); Query loginButton = q => q.Marked("loginButton"); App.Tap(emailInput); App.EnterText("user@example.com"); App.Tap(passwordInput); App.EnterText("password123"); App.DismissKeyboard(); App.Tap(loginButton); ``` -------------------------------- ### Drag and Gesture Operations in Uno UI Test (C#) Source: https://context7.com/unoplatform/uno.uitest/llms.txt Explains how to perform drag operations using coordinates or element queries for drag-and-drop interactions, including verifying position changes and swipe gestures. Requires Uno.UITest. ```csharp using Query = System.Func; Query myBorder = q => q.Marked("draggableBorder"); Query topValue = q => q.Marked("positionTop"); Query leftValue = q => q.Marked("positionLeft"); // Get element position var rect = App.Query(myBorder).First().Rect; Console.WriteLine($"Element at: {rect.X}, {rect.Y}"); Console.WriteLine($"Element size: {rect.Width}x{rect.Height}"); // Drag by coordinates App.DragCoordinates( fromX: rect.CenterX, fromY: rect.CenterY, toX: rect.CenterX + 50, toY: rect.CenterY + 50 ); // Verify position changed App.WaitForDependencyPropertyValue(topValue, "Text", "50"); App.WaitForDependencyPropertyValue(leftValue, "Text", "50"); // Drag and drop between elements Query sourceElement = q => q.Marked("sourceItem"); Query targetElement = q => q.Marked("targetDropZone"); App.DragAndDrop(sourceElement, targetElement); App.DragAndDrop("sourceItem", "targetDropZone"); // Swipe gestures App.SwipeLeftToRight(swipePercentage: 0.67, swipeSpeed: 500); App.SwipeRightToLeft(swipePercentage: 0.67, swipeSpeed: 500); // Swipe on specific element Query carousel = q => q.Marked("imageCarousel"); App.SwipeLeftToRight(carousel, swipePercentage: 0.8); App.SwipeRightToLeft(carousel, swipePercentage: 0.8); ``` -------------------------------- ### Scrolling Operations in Uno UI Test (C#) Source: https://context7.com/unoplatform/uno.uitest/llms.txt Demonstrates how to scroll through scrollable containers to find elements. Supports scrolling by mark, up, down, within specific containers, and manual scrolling with custom parameters. Requires Uno.UITest. ```csharp using System; using Query = System.Func; // Scroll to element by mark App.ScrollTo("Data_Item_67"); App.WaitForElement("Data_Item_67"); // Scroll down to element App.ScrollDownTo( "Data_Item_20", timeout: TimeSpan.FromSeconds(60) ); App.WaitForElement("Data_Item_20"); // Scroll up to element App.ScrollTo("Data_Item_100"); App.ScrollUpTo("Data_Item_70", timeout: TimeSpan.FromSeconds(60)); App.WaitForElement("Data_Item_70"); // Scroll within specific container Query scrollView = q => q.Marked("mainScrollView"); Query targetElement = q => q.Marked("targetElement"); App.ScrollDownTo( targetElement, withinQuery: scrollView, strategy: ScrollStrategy.Auto, swipePercentage: 0.67, swipeSpeed: 500, withInertia: true, timeout: TimeSpan.FromSeconds(30) ); // Manual scroll operations App.ScrollDown(scrollView); App.ScrollUp(scrollView); // Scroll with custom parameters App.ScrollDown( withinQuery: scrollView, strategy: ScrollStrategy.Gesture, swipePercentage: 0.8, swipeSpeed: 300 ); ``` -------------------------------- ### Validate Current Platform for UI Tests (C#) Source: https://github.com/unoplatform/uno.uitest/blob/master/doc/using-uno-uitest.md This C# code snippet checks the current platform using `AppInitializer.GetLocalPlatform()`. If the platform is Android, it ignores the test using `Assert.Ignore()`. This is useful for skipping tests that are not relevant to the current environment. ```csharp if(AppInitializer.GetLocalPlatform() == Platform.Android) { Assert.Ignore(); } ``` -------------------------------- ### Query and Assert DependencyProperty Values in Uno UI Tests Source: https://context7.com/unoplatform/uno.uitest/llms.txt Access and assert XAML DependencyProperty values directly from UI elements during automated tests. This allows for precise validation of UI state, such as checking text content, boolean states (like checkboxes), visibility, and opacity. The `WaitForDependencyPropertyValue` method is also provided to synchronize tests based on property changes. ```csharp using System.Linq; using NUnit.Framework; using Query = System.Func; using StringQuery = System.Func>; // Query DependencyProperty value Query textBox = q => q.Marked("tb01"); var textValue = App.Query(q => textBox(q).GetDependencyPropertyValue("Text").Value() ).First(); Assert.AreEqual("Expected text", textValue); // Query boolean property Query checkBox = q => q.Marked("cb1"); var isChecked = App.Query(q => checkBox(q).GetDependencyPropertyValue("IsChecked").Value() ).First(); Assert.IsFalse(isChecked); App.Tap(checkBox); var isCheckedAfterTap = App.Query(q => checkBox(q).GetDependencyPropertyValue("IsChecked").Value() ).First(); Assert.IsTrue(isCheckedAfterTap); // Wait for specific property value Query statusLabel = q => q.Marked("statusLabel"); App.Tap("startProcess"); App.WaitForDependencyPropertyValue(statusLabel, "Text", "Processing"); App.WaitForDependencyPropertyValue(statusLabel, "Text", "Complete"); // Verify multiple properties Query element = q => q.Marked("myElement"); var visibility = App.Query(q => element(q).GetDependencyPropertyValue("Visibility").Value() ).First(); var opacity = App.Query(q => element(q).GetDependencyPropertyValue("Opacity").Value() ).First(); Assert.AreEqual("Visible", visibility); Assert.AreEqual(1.0, opacity); ``` -------------------------------- ### Generated R Class for Android Resources Source: https://github.com/unoplatform/uno.uitest/blob/master/src/Sample/Sample.Droid/Resources/AboutResources.txt The 'R' class is automatically generated by the Android build system to provide constants for accessing application resources. It contains nested classes for different resource types (e.g., drawable, layout, string), allowing developers to reference resources using simple integer IDs instead of filenames. ```csharp public class R { public class drawable { public const int icon = 0x123; } public class layout { public const int main = 0x456; } public class strings { public const int first_string = 0xabc; public const int second_string = 0xbcd; } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.