public static IEnumerator AnimationCompleted(string path, string animationName, float timeout = 10, bool ignoreTimeScale = false) { float currentTime = Time.time; yield return(AsyncWait.StartWaitingForUnityAnimation(path, animationName, timeout)); float restTime = timeout - (Time.time - currentTime); yield return(WaitFor(() => { var go = UITestUtils.FindEnabledGameObjectByPath(path); if (go == null) { return new WaitFailed("WaitingForUnityAnimationCompleted: Object not found"); } var animation = go.GetComponent <Animation>(); if (animation != null) { if (animation.IsPlaying(animationName)) { return new WaitFailed("WaitingForUnityAnimationCompleted: Animation is played"); } else { return new WaitSuccess(); } } else { return new WaitFailed("WaitingForUnityAnimationCompleted: Animator not found"); } }, restTime, ignoreTimeScale: ignoreTimeScale)); }
public IEnumerator TestMakeScreenshotDontFail() { string expectedWarning = "Screenshot comparing fail was ignored: " + "can't find reference screen shot with path: ReferenceScreenshots/resolution_750_1334/TestMakeScreenshotDontFail/reference to compare it with screen shot: test"; var waiter = AsyncWait.StartWaitingForLog(expectedWarning, LogType.Warning); yield return(Interact.MakeScreenshotAndCompare("test", "reference", 0.9f, true)); yield return(waiter); string expectedError = "Screenshot equals failed: \n" + "can't find reference screen shot with path: ReferenceScreenshots/resolution_750_1334/TestMakeScreenshotDontFail/reference to compare it with screen shot: test"; PermittedErrors.Add(expectedError); waiter = AsyncWait.StartWaitingForLog(expectedError, LogType.Error); Interact.FailIfScreenShotsNotEquals(); yield return(waiter); }