diff --git a/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs b/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs index e50d4f82fe..03521103e9 100644 --- a/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs +++ b/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs @@ -45,7 +45,7 @@ public override IEnumerator UnitySetup() #region Helper methods - IEnumerator WaitForActionMapRename(int index, bool isActive, double timeoutSecs = 5.0) + IEnumerator WaitForActionMapRename(int index, bool isActive, double timeoutSecs = kDefaultTimeoutSecs) { return WaitUntil(() => { @@ -58,7 +58,7 @@ IEnumerator WaitForActionMapRename(int index, bool isActive, double timeoutSecs }, $"WaitForActionMapRename {index} {isActive}", timeoutSecs); } - IEnumerator WaitForActionRename(int index, bool isActive, double timeoutSecs = 5.0) + IEnumerator WaitForActionRename(int index, bool isActive, double timeoutSecs = kDefaultTimeoutSecs) { return WaitUntil(() => { @@ -208,10 +208,8 @@ public IEnumerator CanRenameAction() // Re-fetch the actions since the UI may have refreshed. actionItem = actionContainer.Query().ToList(); - // Click twice to start the rename SimulateClickOn(actionItem[1]); yield return WaitForNotDirty(); - // If the item is already focused, don't click again if (!actionItem[1].IsFocused) { diff --git a/Assets/Tests/InputSystem.Editor/UIToolkitBaseTestWindow.cs b/Assets/Tests/InputSystem.Editor/UIToolkitBaseTestWindow.cs index 172c310318..1b320ffeb2 100644 --- a/Assets/Tests/InputSystem.Editor/UIToolkitBaseTestWindow.cs +++ b/Assets/Tests/InputSystem.Editor/UIToolkitBaseTestWindow.cs @@ -15,6 +15,7 @@ public class UIToolkitBaseTestWindow where T : EditorWindow { protected T m_Window; + protected const double kDefaultTimeoutSecs = 10.0; #region setup and teardown [OneTimeSetUp] @@ -124,7 +125,7 @@ protected void SimulateDeleteCommand() /// Wait for UI toolkit scheduler to process the frame /// /// Maximum time to wait in seconds. - protected IEnumerator WaitForSchedulerLoop(double timeoutSecs = 5.0) + protected IEnumerator WaitForSchedulerLoop(double timeoutSecs = kDefaultTimeoutSecs) { bool done = false; m_Window.rootVisualElement.schedule.Execute(() => done = true); @@ -136,7 +137,7 @@ protected IEnumerator WaitForSchedulerLoop(double timeoutSecs = 5.0) /// /// VisualElement to be focused /// Maximum time to wait in seconds. - protected IEnumerator WaitForFocus(VisualElement ve, double timeoutSecs = 5.0) + protected IEnumerator WaitForFocus(VisualElement ve, double timeoutSecs = kDefaultTimeoutSecs) { return WaitUntil(() => ve.focusController.focusedElement == ve, "WaitForFocus", timeoutSecs); } @@ -145,7 +146,7 @@ protected IEnumerator WaitForFocus(VisualElement ve, double timeoutSecs = 5.0) /// Wait for the windows to be not dirty /// /// Maximum time to wait in seconds. - protected IEnumerator WaitForNotDirty(double timeoutSecs = 5.0) + protected IEnumerator WaitForNotDirty(double timeoutSecs = kDefaultTimeoutSecs) { return WaitUntil(() => m_Window.rootVisualElement.panel.isDirty == false, "WaitForNotDirty", timeoutSecs); } @@ -156,7 +157,7 @@ protected IEnumerator WaitForNotDirty(double timeoutSecs = 5.0) /// Lambda to call between frame /// Assert Message /// Maximum time to wait in seconds. - protected IEnumerator WaitUntil(Func action, string assertMessage, double timeoutSecs = 5.0) + protected IEnumerator WaitUntil(Func action, string assertMessage, double timeoutSecs = kDefaultTimeoutSecs) { var endTime = EditorApplication.timeSinceStartup + timeoutSecs; do