-
Notifications
You must be signed in to change notification settings - Fork 66
[Testing] Unify Test App infrastructure + VisualUITestBase #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Figured out my Have the shared infrastructure setup, so going to test with bringing in |
Built off of #156 and tested some of the Input Injector API stuff, looks really promising. Few issues though.
Have a branch on top of 156 at llama/input-injection, will rebase once that PR is merged. |
Happy to help brainstorm a fluent API surface if we get to that point, of course! Ping me any time 😄 |
Thanks @Sergio0694, yeah I was roughly thinking something like: await SimulateInput.StartTouch()
.MouseDown(coord)
.MouseMove(cx, cy, seconds: 0.5, points: 10)
.MouseUp()
.Execute(); As we need to preface and end the operation with initializing/uninitializing the touch injector code, as well as generate/use a unique pointer id across the instructions (and if we want to use relative positioning between operations keep track of the initial point). Anyway, bit more investigation to do, as not sure if this is going to run in the CI yet (though even then may have value). |
Opened #176 to track remaining work, rest of this has been done for now. |
Problem
We want our unit tests to not just be able to test .NET code, but also be able to exercise the UI to the extent possible in the UWP/WinUI test app scenarios.
Existing Solution
In the toolkit, we have a helper class called
VisualUITestBase
which allows a developer writing a unit test withUITestMethod
to set the content of the test app temporarily in order to exercise a component, check its layout, and test other parts which may be required for the control to be visualized.New Solutions
XamlReader
to load XAML from code-behind to create their scenarios. This is a bit cumbersome, especially without the upcoming raw C# string literals. I'd like to investigate using an attribute style solution like we did for the Toolkit UI tests, so loose XAML files can be used to load test scenarios directly within the application.Proposal Breakdown
CommunityToolkit.Labs.Shared
project toCommunityToolkit.Labs.SampleApp.Shared
common\Communitytoolkit.Labs.UnitTests.Shared
shared project (to appear under theShared
Solution folder)App.xaml
/UnitTestApp.xaml
andMainWindow.xaml
files from unit test headsCommunityToolkit.Labs.UnitTests
namespaceApp.xaml
file to include WinUI 2 and WinUI 3 for all the test heads (just like the individual platform heads do)App.xaml.cs
file)WINAPPSDK
conditional works the same for unit test projectsVisualUITestBase
class from Toolkit versionVisualUITestBase
improvements - handled by Added [LabsUITestMethod] attribute and source generator #156 nowTestInitialize
in base classInvestigate helper methods for more 'ui testing' scenariosSince we own the apps and their deployment can we use more restricted capabilities like the InputInjection rescap? And does that work in WinUI 3 as well?Does this work in the CI?UseGridSplitter
as a test case and see if we can:Test a mouse drag (if we get injector working) replicate the UI Test we had for GridSplitterThe text was updated successfully, but these errors were encountered: