@@ -110,6 +110,50 @@ dotnet cake --target=dotnet-pack
110110 - ` src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj `
111111 - ` src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj `
112112
113+ #### UI Testing Guidelines
114+
115+ When adding UI tests to validate visual behavior and user interactions, follow this two-part pattern:
116+
117+ ** CRITICAL: UITests require code in TWO separate projects that must BOTH be implemented:**
118+
119+ 1 . ** HostApp UI Test Page** (` src/Controls/tests/TestCases.HostApp/Issues/ ` )
120+ - Create the actual UI page that demonstrates the feature or reproduces the issue
121+ - Use XAML with proper ` AutomationId ` attributes on interactive controls for test automation
122+ - Follow naming convention: ` IssueXXXXX.xaml ` and ` IssueXXXXX.xaml.cs `
123+ - Ensure the UI provides clear visual feedback for the behavior being tested
124+
125+ 2 . ** NUnit Test Implementation** (` src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ ` )
126+ - Create corresponding Appium-based NUnit tests that inherit from ` _IssuesUITest `
127+ - Use the ` AutomationId ` values to locate and interact with UI elements
128+ - Follow naming convention: ` IssueXXXXX.cs ` (matches the HostApp file)
129+ - Include appropriate ` [Category(UITestCategories.XYZ)] ` attributes
130+ - Test should validate expected behavior through UI interactions and assertions
131+
132+ ** UI Test Pattern Example:**
133+ ``` csharp
134+ // In TestCases.Shared.Tests/Tests/Issues/IssueXXXXX.cs
135+ public class IssueXXXXX : _IssuesUITest
136+ {
137+ public override string Issue => " Description of the issue being tested" ;
138+
139+ public IssueXXXXX (TestDevice device ) : base (device ) { }
140+
141+ [Test ]
142+ [Category (UITestCategories .Layout )] // or appropriate category
143+ public void TestMethodName ()
144+ {
145+ App .WaitForElement (" AutomationId" );
146+ App .Tap (" AutomationId" );
147+ // Add assertions to verify expected behavior
148+ }
149+ }
150+ ```
151+
152+ ** Before committing UI tests:**
153+ - Compile both the HostApp project and TestCases.Shared.Tests project to ensure no build errors
154+ - Verify AutomationId references match between XAML and test code
155+ - Ensure tests follow the established naming and inheritance patterns
156+
113157### Code Formatting
114158
115159Before committing any changes, format the codebase using the following command to ensure consistent code style:
@@ -184,6 +228,17 @@ Since coding agents function as both CI and pair programmers, they need to handl
184228- ** Always reset changes to ` cgmanifest.json ` files** - These are generated during CI builds and should not be committed by coding agents
185229- ** Always reset changes to ` templatestrings.json ` files** - These localization files are auto-generated and should not be committed by coding agents
186230
231+ ### PublicAPI.Unshipped.txt File Management
232+ When working with public API changes, proper handling of PublicAPI.Unshipped.txt files is critical:
233+
234+ - ** Never turn off analyzers or set no warn** to fix PublicAPI.Unshipped.txt file issues
235+ - ** Always work to fix the PublicAPI.Unshipped.txt files properly** by adding the correct API entries
236+ - ** Use ` dotnet format analyzers ` ** if having trouble fixing PublicAPI.Unshipped.txt file issues
237+ - ** Revert and re-add approach when files are incorrect:**
238+ 1 . First, revert all changes to PublicAPI.Unshipped.txt files to their original state
239+ 2 . Then, make only the necessary additions required for your new public APIs
240+ 3 . This ensures clean, minimal changes that accurately reflect the new APIs being introduced
241+
187242### Branching
188243- ` main ` - For bug fixes without API changes
189244- ` net10.0 ` - For new features and API changes
0 commit comments