public override IEnumerator Setup()
        {
            yield return(base.Setup());

            Screen.sleepTimeout = SleepTimeout.NeverSleep;
            ReportingManager.IsPlaybackStartedFromEditorWindow = false;
            ReportingManager.InitializeReport();

            if (AutomatedQARuntimeSettings.hostPlatform == HostPlatform.Cloud &&
                AutomatedQARuntimeSettings.buildType == BuildType.UnityTestRunner)
            {
                RecordedTesting.SetupCloudUTFTests(testName);
            }
            else
            {
                RecordedTesting.SetupRecordedTest(testName);
            }

            // Start playback
            CentralAutomationController.Instance.Reset();
            CentralAutomationController.Instance.AddAutomator <RecordedPlaybackAutomator>(new RecordedPlaybackAutomatorConfig
            {
                loadEntryScene = true,
            });
            CentralAutomationController.Instance.Run();

            // wait for playback to start
            while (!RecordedPlaybackController.Exists() || !RecordedPlaybackController.Instance.IsInitialized())
            {
                yield return(null);
            }
        }
Example #2
0
 public static IEnumerator TestPlayToEnd()
 {
     ReportingManager.IsAutomatorTest = false;
     while (!RecordedPlaybackController.IsPlaybackCompleted())
     {
         yield return(null);
     }
 }
        public IEnumerator VerifyAfterPlayback()
        {
            while (!RecordedPlaybackController.Exists() || !RecordedPlaybackController.IsPlaybackCompleted())
            {
                yield return(null);
            }

            var buttonCounter = GameObject.FindGameObjectWithTag("ButtonCount");
            var buttonClicks  = Convert.ToInt32(buttonCounter.GetComponent <Text>().text);

            Assert.AreEqual(10, buttonClicks);
        }
        public void CreateNewRecordingWithoutFiles()
        {
            string recordingPath = RecordedPlaybackPersistentData.GetRecordingDataFilePath();
            string configPath    = RecordedPlaybackPersistentData.GetConfigFilePath();

            if (File.Exists(recordingPath))
            {
                File.Delete(recordingPath);
            }

            if (File.Exists(configPath))
            {
                File.Delete(configPath);
            }

            RecordedPlaybackPersistentData.SetRecordingMode(RecordingMode.Record);
            RecordedPlaybackController.Instance.Begin();

            Assert.That(RecordedPlaybackController.Exists());
        }
Example #5
0
        public virtual IEnumerator UnityTearDown()
        {
            if (CentralAutomationController.Exists())
            {
                CentralAutomationController.Instance.Reset();
            }
            if (RecordedPlaybackController.Exists())
            {
                RecordedPlaybackController.Instance.Reset();
            }

            if (RecordedTesting.IsRecordedTest(testName))
            {
                ReportingManager.CreateMonitoringService();
            }

            int    sceneCount = 0;
            string sceneName  = string.Empty;

            while (true)
            {
                bool sceneExists = false;
                sceneName = "emptyscene" + sceneCount++;
                for (int x = 0; x < SceneManager.sceneCount; x++)
                {
                    if (SceneManager.GetSceneAt(x).name == sceneName)
                    {
                        sceneExists = true;
                    }
                }
                if (!sceneExists)
                {
                    break;
                }
            }

            var emptyScene = SceneManager.CreateScene(sceneName);

            SceneManager.SetActiveScene(emptyScene);
            yield return(UnloadScenesExcept(emptyScene.name));
        }
        private void UpdateStateRecordPlayControls()
        {
            if (playModeStartedFromHere &&
                EditorApplication.isPlaying &&
                RecordedPlaybackController.IsPlaybackCompleted() &&
                RecordedPlaybackPersistentData.GetRecordingMode() == RecordingMode.Playback)
            {
                EditorApplication.isPlaying = false;
            }

            // poll for state change
            if (EditorApplication.isPlaying && !isPlayMode)
            {
                isPlayMode = true;
                OnEnterPlaymode();
            }
            else if (!EditorApplication.isPlaying && isPlayMode)
            {
                isPlayMode = false;
                OnExitPlaymode();
            }
        }
Example #7
0
 private static bool IsPlaybackActive()
 {
     return(playbackActive || RecordedPlaybackController.IsPlaybackActive());
 }