public void Begin()
        {
            if (Initialized)
            {
                return;
            }

            Initialized = true;

            if (!ReportingManager.IsTestWithoutRecordingFile && RecordedPlaybackPersistentData.GetRecordingMode() == RecordingMode.Playback && !File.Exists(RecordedPlaybackPersistentData.GetRecordingDataFilePath()))
            {
                logger.LogError($"Recorded Playback file does not exist.");
                return;
            }

            if (inputModule == null)
            {
                inputModule = gameObject.AddComponent <RecordingInputModule>();
            }
            if (RecordedPlaybackPersistentData.GetRecordingMode() == RecordingMode.Record)
            {
                gameObject.AddComponent <GameListenerHandler>();
            }
            SetEventSystem();
            VisualFxManager.SetUp(Instance.transform);
        }
        public static void SetRecordingDataFromFile(string sourcePath)
        {
            AQALogger logger = new AQALogger();

            RecordedPlaybackPersistentData.CleanRecordingData();
            string destPath = Path.Combine(AutomatedQARuntimeSettings.PersistentDataPath, kRecordedPlaybackFilename);

            if (!string.IsNullOrEmpty(sourcePath))
            {
                CopyRecordingFile(sourcePath, destPath);
            }
            else
            {
                logger.LogError($"Failed to copy recording file from {sourcePath} to {destPath}");
            }
        }
        public override void BeginAutomation()
        {
            base.BeginAutomation();

            string recordingFileName = "";

            if (config.recordingFile != null)
            {
                logger.Log($"Using recording asset - recordingFile: {config.recordingFile.name}");
                RecordedPlaybackPersistentData.SetRecordingData(config.recordingFile.text);
                recordingFileName = config.recordingFile.name;
            }
            else
            {
                logger.Log($"Using RecordedPlaybackPersistentData - kRecordedPlaybackFilename: {RecordedPlaybackPersistentData.kRecordedPlaybackFilename}");
            }

            StartCoroutine(PlayRecording(recordingFileName));
        }
        private IEnumerator PlayRecording(string recordingFileName)
        {
            // Load scene
            var recordingData = RecordedPlaybackPersistentData.GetRecordingData <RecordingInputModule.InputModuleRecordingData>();

            RecordedPlaybackPersistentData.RecordedResolution  = recordingData.recordedResolution;
            RecordedPlaybackPersistentData.RecordedAspectRatio = recordingData.recordedAspectRatio;
            yield return(LoadEntryScene(recordingData));

            if (RecordedPlaybackController.Exists())
            {
                // Reset controller if a previous recording just finished playing
                RecordedPlaybackController.Instance.Reset();
            }
            RecordedPlaybackPersistentData.SetRecordingMode(RecordingMode.Playback, recordingFileName);
            RecordedPlaybackController.Instance.Begin();

            while (!RecordedPlaybackController.IsPlaybackCompleted())
            {
                yield return(null);
            }

            EndAutomation();
        }
 public static void SetRecordingData(string rawData)
 {
     RecordedPlaybackPersistentData.CleanRecordingData();
     File.WriteAllText(GetRecordingDataFilePath(), rawData);
 }