-
Notifications
You must be signed in to change notification settings - Fork 328
NEW: Added tests for Input Action Editor UI for managing action maps (ISX-2087) #1977
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks like a reasonable test.
Small naming query added, but happy to approve.
static readonly Vector2 k_MinWindowSize = new Vector2(650, 450); | ||
|
||
// For UI testing purpose | ||
internal InputActionAsset currentAssetInEdition => m_AssetObjectForEditing; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this name a typo?
currentAssetInEdition
Should it be ...
currentAssetInEditior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the name, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome to see some UI automation happening for tests, good job. Some minor comments.
|
||
#region Helper methods | ||
|
||
void Click(VisualElement ve) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome to see this being added but I wonder whether it would make sense to move these helper methods into a separate utility class to make it more accessible across any test classes that would utilise this kind of "UI automation" actions? Would also be great with a short comment on what each one does and maybe some preconditions asserts to check that the passed element is applicable to avoid mistakes?
Also would suggest renaming "ve" to "target" since it represents the target of the automated action to be carried out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Encapsulating it might further reduce visibility of some of these methods where SendXXX is likely internal while a utility class for testing might contain "actions" like, Click, EnterText etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks I will make some name adjustment.
Most of the methods are copied from https://internaldocs.unity.com/editor_and_runtime_development_guide/TestAutomation/TestFrameworks/UITestFramework/CodeSamples/code-samples/ and will be replaced by the helpers on neutron
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the ve => target is unfortunately not as simple. For clicking it may work because it took the positon and if the target it on top the click will be dispatched to it.
For all other command even if you call visualelement.sendevent it will be dispatched to the panel which will search for te focused element.
I make some change to make it clearer
ve.SendEvent(pue); | ||
} | ||
|
||
void SendText(VisualElement ve, string text, bool sendReturn = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, think it could be good with some docs on these utility functions, is sendReturn used to configure whether the pretended user is hitting Return/Enter key after entering the text?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes the sendReturn is used to define if we send return at the end of the text
//a bit hacky - e.StopImmediatePropagation() for events does not work like expected on ListViewItems or TreeViewItems because | ||
//the listView/treeView reclaims the focus - this is a workaround with less overhead than rewriting the events | ||
DelayCall(); | ||
schedule.Execute(() => renameTextfield.Q<TextField>().Focus()).StartingIn(120); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for getting rid of that unreliable DelayCall
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess its still suffers from not being fully deterministic though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes this delay could create some instabilities, it was hard to find somethings reliable 🤞
1acdc0a
to
c4c92de
Compare
Description
Added UI Toolkits test for the Input Action Editor. https://jira.unity3d.com/browse/ISX-2087
It tests list, creation, rename and delete.
Changes made
Fixed Action Maps name edition which could be inconsistent in Input Action Editor UI. The time used used was not the editor one and the UI was destroyed and recreated on each change.
Testing
local test on windows + CI
Risk
limited to Input Action Editor UI.
Checklist
Before review:
Changed
,Fixed
,Added
sections.Area_CanDoX
,Area_CanDoX_EvenIfYIsTheCase
,Area_WhenIDoX_AndYHappens_ThisIsTheResult
.During merge:
NEW: ___
.FIX: ___
.DOCS: ___
.CHANGE: ___
.RELEASE: 1.1.0-preview.3
.After merge: