Simulate UI interactions
By using the test fixtures, you can simulate user interactions like mouse clicks, mouse movements, keyboard input, scrolling, or interacting with context or popup menus. See Introduction to test fixtures for more information about the test fixtures and how to use them.
The UI Test Framework sends UI Toolkit events directly to the panel, bypassing the input from physical devices or the operating system that produces them. The panel then dispatches those events to its visual elements.
Because events go directly to the panel, simulated interactions don't propagate to Unity's input system. For example, simulating a click doesn't update Input.GetMouseButtonDown or Input.touchCount.
| Topics | Description |
|---|---|
| Click on a visual element | Simulate a click on a visual element. |
| Double-click on a visual element | Simulate a double-click on a visual element. |
| Type into a text field | Simulate typing text into a text field. |
| Move mouse to a visual element | Simulate moving the mouse to a visual element. |
| Drag an element from one place to another | Simulate dragging an element from one place to another. |
| Press keys | Simulate pressing keys. |
| Press Tab or Return keys | Simulate pressing Tab or Return keys. |
| Scroll in a ScrollView | Simulate scrolling in a ScrollView. |
| Simulate context menu actions | Validate and simulate a context menu's actions. |
| Simulate popup menu actions | Validate and simulate a popup menu's actions. |