Exemplo n.º 1
0
 private void Start()
 {
     playerCam        = Camera.main;
     cameraPositions  = GetComponentsInChildren <RecordingMovieCamera>();
     clips            = GetComponentsInChildren <RecordingMovieClip>();
     recordingManager = Object.FindObjectOfType <RecordingManager>();
 }
Exemplo n.º 2
0
    private void Awake()
    {
        playerButton = GetComponent <Button>();
        rm           = GameObject.Find("GameManager").GetComponent <RecordingManager>();

        playerButton.onClick.AddListener(() => rm.ActivatePlayer(int.Parse(transform.name.Substring(10))));
    }
Exemplo n.º 3
0
        public void DoRecordingWithMultiplePageHandledTest()
        {
            List <ApplicationPOMModel> lstPOM     = new List <ApplicationPOMModel>();
            ApplicationPOMModel        currentPOM = new ApplicationPOMModel();

            lstPOM.Add(currentPOM);
            RecordingManager mngr = new RecordingManager(lstPOM, mBF, Context, mDriver, PlatformInfo);

            if (mngr != null)
            {
                mngr.StartRecording();
                Thread.Sleep(3000);
                mngr.StopRecording();
            }
            if (mngr.ListPOMObjectHelper != null && mngr.ListPOMObjectHelper.Count > 0)
            {
                ApplicationPOMModel cPOM = mngr.ListPOMObjectHelper[1].ApplicationPOM;
                Assert.IsTrue(cPOM.PageURL == "www.google.com");
                Assert.IsTrue(mngr.ListPOMObjectHelper.Count == 2);
            }
            else
            {
                Assert.IsTrue(false);
            }
        }
Exemplo n.º 4
0
        public void Second_pass_should_use_recorded_values_from_previous_pass()
        {
            var storage = new Storage();

            using (var recorder = new RecordingManager(storage))
            {
                var memoryStream = new MemoryStream();

                using (var stream = A.Fake <Stream>(x => x.Wrapping(memoryStream).RecordedBy(recorder)))
                    using (var writer = new StreamWriter(stream))
                    {
                        writer.Write("Hello world!");
                    }

                Assert.That(memoryStream.GetBuffer().Length, Is.Not.LessThanOrEqualTo(0));
            }

            using (var recorder = new RecordingManager(storage))
            {
                var memoryStream = new MemoryStream();
                using (var stream = A.Fake <Stream>(x => x.Wrapping(memoryStream).RecordedBy(recorder)))
                    using (var writer = new StreamWriter(stream))
                    {
                        writer.Write("Hello world!");
                    }

                Assert.That(memoryStream.Length, Is.EqualTo(0));
            }

            foreach (var call in storage.RecordedCalls)
            {
                Console.WriteLine(call.Method.ToString() + " returns: " + call.ReturnValue);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// The update method where the new color frame is retrieved.
        /// </summary>
        /// <param name="gameTime">The elapsed game time.</param>
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            // If the sensor is not found, not running, or not connected, stop now
            if (null == this.Chooser.Sensor ||
                false == this.Chooser.Sensor.IsRunning ||
                KinectStatus.Connected != this.Chooser.Sensor.Status)
            {
                return;
            }

            if (RecordingManager.Status == RecordingManagerStatus.Replaying)
            {
                return;
            }

            using (var frame = this.Chooser.Sensor.ColorStream.OpenNextFrame(0))
            {
                // Sometimes we get a null frame back if no data is ready
                if (frame == null)
                {
                    return;
                }

                if (RecordingManager.Status == RecordingManagerStatus.Recording)
                {
                    RecordingManager.Record(frame);
                }

                // Reallocate values if necessary
                if (this.colorData == null || this.colorData.Length != frame.PixelDataLength)
                {
                    this.colorData = new byte[frame.PixelDataLength];

                    this.colorTexture = new Texture2D(
                        this.Game.GraphicsDevice,
                        frame.Width,
                        frame.Height,
                        false,
                        SurfaceFormat.Color);

                    this.backBuffer = new RenderTarget2D(
                        this.Game.GraphicsDevice,
                        frame.Width,
                        frame.Height,
                        false,
                        SurfaceFormat.Color,
                        DepthFormat.None,
                        this.Game.GraphicsDevice.PresentationParameters.MultiSampleCount,
                        RenderTargetUsage.PreserveContents);
                }

                frame.CopyPixelDataTo(this.colorData);
                this.needToRedrawBackBuffer = true;
            }

            // Update the skeleton renderer
            this.skeletonStampStream.Update(gameTime);
        }
        public async Task GetRecordings_Including_Old_One_And_ResendAndUpdate_Works()
        {
            var folder = Path.Combine(Path.GetFullPath("../../../"), "files/recordings");

            var destinationFolder = folder.Replace("/recordings", "/recordings_temp");

            // we copy files from original folder to another one, because they will be updated, and we need to keep the original files for
            // repeatable unit testing
            CopyFolderAndFiles(folder, destinationFolder);

            var sut = new RecordingManager(destinationFolder);

            // act
            var recordings = sut.GetRecordings(destinationFolder);

            // asserts
            recordings.Count.Should().Be(3);

            recordings[0].File.Should().Be(@"happy/200_ContainsSomeFields_PacificChallenge");
            recordings[0].FileFullPath.Should().EndWith(@"recordings_temp\happy\200_ContainsSomeFields_PacificChallenge.txt");

            await AssertHappyRecording(recordings[1]);
            await AssertUnhappyRecording(recordings[2]);

            await recordings.ReSendRequestAndUpdateFile();

            recordings.Should().OnlyContain(c => c.DateTime >= DateTime.Now.AddSeconds(-1));

            Directory.Delete(destinationFolder, true); // clear folder as not needed anymore
        }
Exemplo n.º 7
0
 private void Awake()
 {
     recordingManager = FindObjectOfType <RecordingManager>();
     commandProcessor = GetComponent <CommandProcessor>();
     player           = GetComponent <Player>();
     ball             = FindObjectOfType <Ball>();
 }
Exemplo n.º 8
0
        public MainWindow()
        {
            InitializeComponent();
            SettingsModel          = new SettingsModel(this);
            txtRepeats.DataContext = SettingsModel;
            txtSpeed.DataContext   = SettingsModel;

            recManager = new RecordingManager();

            overlay = new Overlay();
            overlay.Show();

            //Task.Delay(0).ContinueWith((t) =>
            //{
            //    WindowsInput.IKeyboardSimulator ks = new WindowsInput.KeyboardSimulator(new WindowsInput.InputSimulator());

            //    while(true)
            //    {
            //        ks.KeyDown(WindowsInput.Native.VirtualKeyCode.VK_X);
            //        Thread.Sleep(1000);
            //    };
            //});

            Task.Delay(1000).ContinueWith((t) =>
            {
                Librarian l = Librarian.I;
                if (!l.IsPrefsExist())
                {
                    l.SavePrefs();
                    Dispatcher.Invoke(() => MessageBox.Show("Press Shift + Escape to end a recording.", "Info", MessageBoxButton.OK));
                }
            });

            Inst = this;
        }
Exemplo n.º 9
0
 void Awake()
 {
     if (photonView.isMine)
     {
         _recordingManager = FindObjectOfType <RecordingManager>();
     }
 }
Exemplo n.º 10
0
        public void DoRecordingWithPOMTest()
        {
            List <ApplicationPOMModel> lstPOM     = new List <ApplicationPOMModel>();
            ApplicationPOMModel        currentPOM = new ApplicationPOMModel();

            lstPOM.Add(currentPOM);
            RecordingManager mngr = new RecordingManager(lstPOM, mBF, Context, mDriver, PlatformInfo);

            if (mngr != null)
            {
                mngr.StartRecording();
                Thread.Sleep(3000);
                mngr.StopRecording();
            }
            if (mBF.Activities[0].Acts.Count > 0)
            {
                ApplicationPOMModel cPOM  = mngr.ListPOMObjectHelper[1].ApplicationPOM;
                TestAction          actUI = (TestAction)mBF.Activities[0].Acts[0];
                Assert.IsTrue(actUI.ElementLocateBy == eLocateBy.POMElement);
                Assert.IsTrue(actUI.ElementAction == "Click");
                Assert.IsTrue(actUI.ElementType == "Button");
                Assert.IsTrue(cPOM.MappedUIElements[0].ElementTypeEnum.ToString() == eElementType.Button.ToString());
                Assert.IsTrue(cPOM.MappedUIElements.Count == mBF.Activities[0].Acts.Count);
            }
            else
            {
                Assert.IsTrue(false);
            }
        }
Exemplo n.º 11
0
        public static void SelfInitializingOutAndRef(
            InMemoryStorage inMemoryStorage,
            ILibraryService realServiceWhileRecording,
            ILibraryService realServiceDuringPlayback,
            int @out,
            int @ref)
        {
            "Given a call storage object"
            .x(() => inMemoryStorage = new InMemoryStorage());

            "And a real service to wrap while recording"
            .x(() =>
            {
                realServiceWhileRecording = A.Fake <ILibraryService>();

                int localOut;
                int localRef = 0;
                A.CallTo(() => realServiceWhileRecording.TryToSetSomeOutAndRefParameters(out localOut, ref localRef))
                .WithAnyArguments()
                .Returns(true)
                .AssignsOutAndRefParameters(19, 8);
            });

            "And a real service to wrap while playing back"
            .x(() => realServiceDuringPlayback = A.Fake <ILibraryService>());

            "When I use a self-initialized fake in recording mode to try to set some out and ref parameters"
            .x(() =>
            {
                using (var recorder = new RecordingManager(inMemoryStorage))
                {
                    var fakeService = A.Fake <ILibraryService>(options => options
                                                               .Wrapping(realServiceWhileRecording).RecordedBy(recorder));

                    int localOut;
                    int localRef = 0;
                    fakeService.TryToSetSomeOutAndRefParameters(out localOut, ref localRef);
                }
            });

            "And I use a self-initialized fake in playback mode to try to set some out and ref parameters"
            .x(() =>
            {
                using (var recorder = new RecordingManager(inMemoryStorage))
                {
                    var playbackFakeService = A.Fake <ILibraryService>(options => options
                                                                       .Wrapping(realServiceDuringPlayback).RecordedBy(recorder));

                    playbackFakeService.TryToSetSomeOutAndRefParameters(out @out, ref @ref);
                }
            });

            "Then the playback fake sets the out parameter to the value seen in recording mode"
            .x(() => @out.Should().Be(19));

            "And it sets the ref parameter to the value seen in recording mode"
            .x(() => @ref.Should().Be(8));
        }
Exemplo n.º 12
0
    void Start()
    {
        tap = GetComponent <Tap>();
        recordingManager = GameObject.FindObjectOfType(typeof(RecordingManager)) as RecordingManager;

        initial       = GetComponent <Renderer>().material.color;
        transparent   = initial;
        transparent.a = 0;
    }
Exemplo n.º 13
0
    void Start()
    {
        tap = GetComponent<Tap>();
        recordingManager = GameObject.FindObjectOfType(typeof(RecordingManager)) as RecordingManager;

        initial = renderer.material.color;
        transparent = initial;
        transparent.a = 0;
    }
Exemplo n.º 14
0
    public void SwitchTo(PhysicsMenu menu)
    {
        _switchTimer = WaitAndSwitch(1.0f, menu);
        StartCoroutine(_switchTimer);

        RecordingManager.Log(string.Format(
                                 "EVENT: menu_transition from=<{0}> to=<{1}>",
                                 name, menu.name));
    }
Exemplo n.º 15
0
        public void UpdatePlayBackItems(bool orderByDescending = false)
        {
            PlayBackItems = new ObservableCollection <PlayBackItem>(RecordingManager.ParsePlaybackFile(PlaybackFile));

            if (orderByDescending)
            {
                PlayBackItems = new ObservableCollection <PlayBackItem>(PlayBackItems.OrderByDescending(x => x.Event));
            }
        }
Exemplo n.º 16
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         DestroyImmediate(this.gameObject);
     }
 }
Exemplo n.º 17
0
    public void StartReviewing(RecordingManager sender, VideoPlayer videoPlayer, AudioSource recorder, AudioClip master, double startTime, int endPos, AudioSource player)
    {
        ReviewPanel.SetActive(true);
        Sender            = sender;
        vp                = videoPlayer;
        Recorder          = recorder;
        Player            = player;
        StartTime         = startTime;
        InitialStartTime  = startTime;
        Master            = master;
        EndPosInRecording = endPos;
        lastPlayedTime    = startTime;
        int samples = Recorder.clip.frequency;

        LengthTime       = (float)endPos / samples;
        EndTime          = StartTime + LengthTime;
        InitialEndTime   = EndTime;
        StartPosInMaster = Master.channels * Mathf.FloorToInt(Master.samples * ((float)startTime / Master.length));
        vp.time          = startTime;
        Player.time      = (float)startTime;
        Player.Pause();
        vp.Pause();
        Recorder.Pause();
        Player.volume = OverwriteToggle.isOn ? 0 : 1;
        if (isFirstTime)
        {
            ObservableEventTrigger et = SeekBar.gameObject.AddComponent <ObservableEventTrigger>();
            et.OnPointerDownAsObservable().Subscribe(x => { focusOnSeekBar = true; });
            et.OnPointerUpAsObservable().Subscribe(x => { focusOnSeekBar = false; });

            SeekBar.OnValueChangedAsObservable().Where(x => !seekingByPlaying && isRunning).Throttle(new System.TimeSpan(500)).Subscribe(x =>
            {
                double time    = StartTime + x * LengthTime;
                lastPlayedTime = time;
                vp.time        = time;
                Player.time    = (float)time;
                Recorder.time  = (float)(x * LengthTime);
                Player.Pause();
                vp.Pause();
                Recorder.Pause();
            });
            OverwriteToggle.OnValueChangedAsObservable().Subscribe(overwrite =>
            {
                if (isRunning)
                {
                    Player.volume = overwrite ? 0 : 1;
                }
            });
            vp.seekCompleted += OnSeekCompleted;
        }
        PlayingState = PlayingStareType.Playing;
        isFirstTime  = false;
        isRunning    = true;
    }
Exemplo n.º 18
0
        private void InitializeServices()
        {
            Config = AppConfiguration.Load();

            RecorderApi    = new RecorderApi(Config);
            AppPreferences = new AppPreferences();
            AppRepository  = new AppRepository(RecorderApi, AppPreferences);

            RecMan = new RecordingManager(Config);
            AnalyticsEventTracker = DependencyService.Get <IFirebaseAnalyticsEventTracker>();
        }
Exemplo n.º 19
0
        public static void SelfInitializingExceptionWhileRecording(
            InMemoryStorage inMemoryStorage,
            ILibraryService realServiceWhileRecording,
            ILibraryService realServiceDuringPlayback,
            Exception originalException,
            Exception exceptionWhileRecording,
            Exception exceptionWhilePlayingBack)
        {
            "Given a call storage object"
            .x(() => inMemoryStorage = new InMemoryStorage());

            "And a real service to wrap while recording"
            .x(() => realServiceWhileRecording = A.Fake <ILibraryService>());

            "And the real service throws an exception when getting the title for book 1"
            .x(() =>
            {
                A.CallTo(() => realServiceWhileRecording.GetTitle("1"))
                .Throws(originalException = new InvalidOperationException());
            });

            "And a real service to wrap while playing back"
            .x(() => realServiceDuringPlayback = A.Fake <ILibraryService>());

            "When I use a self-initialized fake in recording mode to get the title for book 1"
            .x(() =>
            {
                using (var recorder = new RecordingManager(inMemoryStorage))
                {
                    var fakeService = A.Fake <ILibraryService>(options => options
                                                               .Wrapping(realServiceWhileRecording).RecordedBy(recorder));

                    exceptionWhileRecording = Record.Exception(() => fakeService.GetTitle("1"));
                }
            });

            "And I use a self-initialized fake in playback mode to get the title for book 1"
            .x(() =>
            {
                using (var recorder = new RecordingManager(inMemoryStorage))
                {
                    var fakeService = A.Fake <ILibraryService>(options => options
                                                               .Wrapping(realServiceDuringPlayback).RecordedBy(recorder));

                    exceptionWhilePlayingBack = Record.Exception(() => fakeService.GetTitle("1"));
                }
            });

            "Then the recording fake throws the original exception"
            .x(() => exceptionWhileRecording.Should().BeSameAs(originalException));

            "But the playback fake throws a recording exception"
            .x(() => exceptionWhilePlayingBack.Should().BeAnExceptionOfType <RecordingException>());
        }
Exemplo n.º 20
0
    // Use this for initialization
    void Start()
    {
        anim = gameObject.GetComponent <Animator>();
        anim.SetBool("isMale", isMale);


        feed   = feedMan.GetComponent <FeedbackManager>();
        record = recordMan.GetComponent <RecordingManager>();

        //system.timers.timer timer;

        feed.FeedbackArrivedEvent += Feed_FeedbackArrivedEvent;
    }
Exemplo n.º 21
0
        /// <summary>
        /// Load relevant resources
        /// </summary>
        /// <param name="game">Provide access to the game.</param>
        /// <param name="contentManager">Provide access to the screen's content manager.</param>
        /// <param name="spriteBatch">Provide access to the screen's sprite batch.</param>
        public override void LoadContent(Game game, ContentManager contentManager, SpriteBatch spriteBatch)
        {
            if (contentManager == null)
            {
                return;
            }

            Texture2D = contentManager.Load <Texture2D>(@"UI\ReplayTile");
            contentManager.Load <Texture2D>(@"blank");
            _titleTexture     = CreateTitleTexture(game, contentManager, spriteBatch);
            _titleDestination = new Rectangle(
                (int)Position.X + MARGIN,
                (int)Position.Y + MARGIN,
                _titleTexture.Width,
                _titleTexture.Height
                );

            /** Grab the data off of the recording manager now because we don't have a reference to the game forever */
            RecordingManager recorder = (RecordingManager)game.Services.GetService(typeof(RecordingManager));

            _skeletons = recorder.ReadProcessedData(FileId);

            string[] axesNames  = { "Time (ms)", "Avg. Deviation\n\r(per 100ms)" };
            string   chartType  = "Time";
            bool     chartLines = true;
            bool     tickMarks  = false;
            float    repetitionDuration;

            float[] dataPoints = CalculateSkeletonChartLine(_skeletons, out repetitionDuration);
            float   timeSpan;

            timeSpan = dataPoints.Length;

            GuiChartOptions chartOptions = new GuiChartOptions(axesNames, chartType, chartLines, tickMarks, dataPoints, timeSpan, repetitionDuration);

            _chartTexture = new GuiChart(
                "Text",
                Size - new Vector2(MARGIN * 2, MARGIN + 40),
                Position + new Vector2(MARGIN - 7, _titleTexture.Height + 15),
                chartOptions
                );

            _chartTexture.LoadContent(game, contentManager, spriteBatch);

            _titleSource = new Rectangle(
                0,
                0,
                _titleTexture.Width,
                _titleTexture.Height
                );
        }
Exemplo n.º 22
0
        /// <summary>
        /// This method retrieves a new skeleton frame if necessary.
        /// </summary>
        /// <param name="gameTime">The elapsed game time.</param>
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            // If the sensor is not found, not running, or not connected, stop now
            if (null == this.Chooser.Sensor ||
                false == this.Chooser.Sensor.IsRunning ||
                KinectStatus.Connected != this.Chooser.Sensor.Status)
            {
                return;
            }

            if (this.RecordingManager.Status == RecordingManagerStatus.Replaying)
            {
                return;
            }

            // If we have already drawn this skeleton, then we should retrieve a new frame
            // This prevents us from calling the next frame more than once per update
            if (skeletonDrawn)
            {
                using (var skeletonFrame = this.Chooser.Sensor.SkeletonStream.OpenNextFrame(0))
                {
                    // Sometimes we get a null frame back if no data is ready
                    if (null == skeletonFrame)
                    {
                        return;
                    }

                    if (RecordingManager.Status == RecordingManagerStatus.Recording)
                    {
                        SkeletonStamp stamp = SkeletonPool.GetOldestProcessedSkeleton();
                        RecordingManager.Record(stamp.PercentBad, stamp.TimeStamp);
                        ++_counter;
                        RecordingManager.Record(skeletonFrame);
                    }

                    // Reallocate if necessary
                    if (null == skeletonData || skeletonData.Length != skeletonFrame.SkeletonArrayLength)
                    {
                        skeletonData = new Skeleton[skeletonFrame.SkeletonArrayLength];
                    }

                    skeletonFrame.CopySkeletonDataTo(skeletonData);
                    SkeletonPool.Add(skeletonData, skeletonFrame.Timestamp);

                    skeletonDrawn = false;
                }
            }
        }
    private void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
            instance = this;
        }

        backendManager = FindObjectOfType <BackendManager>();
    }
Exemplo n.º 24
0
        public static void SelfInitializingThrowsIfTooManyCallsEncountered(
            InMemoryStorage inMemoryStorage,
            ILibraryService realServiceWhileRecording,
            ILibraryService realServiceDuringPlayback,
            Exception exception)
        {
            "Given a call storage object"
            .x(() => inMemoryStorage = new InMemoryStorage());

            "And a real service to wrap while recording"
            .x(() => realServiceWhileRecording = A.Fake <ILibraryService>());

            "And a real service to wrap while playing back"
            .x(() => realServiceDuringPlayback = A.Fake <ILibraryService>());

            "When I use a self-initialized fake in recording mode to get the count and title for book 1"
            .x(() =>
            {
                using (var recorder = new RecordingManager(inMemoryStorage))
                {
                    var fakeService = A.Fake <ILibraryService>(options => options
                                                               .Wrapping(realServiceWhileRecording).RecordedBy(recorder));

                    fakeService.GetCount("1");
                    fakeService.GetTitle("1");
                }
            });

            "And I use a self-initialized fake in playback mode to get the count and title and count for book 1"
            .x(() =>
            {
                using (var recorder = new RecordingManager(inMemoryStorage))
                {
                    var playbackFakeService = A.Fake <ILibraryService>(options => options
                                                                       .Wrapping(realServiceDuringPlayback).RecordedBy(recorder));

                    playbackFakeService.GetCount("1");
                    playbackFakeService.GetTitle("1");
                    exception = Record.Exception(() => playbackFakeService.GetCount("1"));
                }
            });

            // This result demonstrates that the self-initialized fake relies on a script
            // defined by which methods are called, and is completely inflexible with
            // regard to the number of repetitions of the calls.
            "Then the playback fake throws a recording exception"
            .x(() => exception.Should().BeAnExceptionOfType <RecordingException>());
        }
        public void When_Files_Dont_Exist_Create_First_File()
        {
            var tempFolder = Path.GetTempPath();
            var fileSystem = Substitute.For <IFileSystemFacade>();

            fileSystem.GetTextFileNames(Path.Combine(tempFolder, "temp"), "bla").Returns(new List <string>());
            var sut = new RecordingManager(tempFolder);

            sut._fileSystem = fileSystem;

            // act
            var fileName = sut.Save(CreateLog(), "temp", "bla");

            // asserts
            fileName.Should().Be("bla_0001");
        }
Exemplo n.º 26
0
        private void StartRecording()
        {
            IRecord       record       = (IRecord)mDriver;
            IPlatformInfo platformInfo = PlatformInfoBase.GetPlatformImpl(mContext.Platform);

            if (xIntegratePOM.IsChecked == true)
            {
                mRecordingMngr = new RecordingManager(mPomModels, mContext.BusinessFlow, mContext, record, platformInfo);
            }
            else
            {
                mRecordingMngr = new RecordingManager(null, mContext.BusinessFlow, mContext, record, platformInfo);
            }

            mRecordingMngr.StartRecording();
        }
        public void DoRecordingWithoutPOMTest()
        {
            //Arrange
            ObservableList <ApplicationPOMModel> currentPOM = null;
            RecordingManager mngr = new RecordingManager(currentPOM, mBF, Context, mDriver, PlatformInfo);

            //Act
            mngr.StartRecording();
            mngr.StopRecording();
            TestAction actUI = (TestAction)mBF.Activities[0].Acts[1];

            //Assert
            Assert.AreEqual(actUI.ElementLocateBy, eLocateBy.ByID);
            Assert.AreEqual(actUI.ElementAction, "Click");
            Assert.AreEqual(actUI.ElementType, "Button");
        }
Exemplo n.º 28
0
        private bool StartRecording()
        {
            IRecord       record       = (IRecord)mDriver;
            IPlatformInfo platformInfo = PlatformInfoBase.GetPlatformImpl(mContext.Platform);

            if (xIntegratePOM.IsChecked == true)
            {
                mRecordingMngr = new RecordingManager(mPomModels, mContext.BusinessFlow, mContext, record, platformInfo);
            }
            else
            {
                mRecordingMngr = new RecordingManager(null, mContext.BusinessFlow, mContext, record, platformInfo);
            }

            mRecordingMngr.RecordingNotificationEvent += RecordingMngr_RecordingNotificationEvent;
            return(mRecordingMngr.StartRecording());
        }
Exemplo n.º 29
0
        /// <summary>
        /// Clears and Re-Populates the recordings from {GameFolder}/recordings
        /// </summary>
        private void PopulateRecordings()
        {
            PlaybackItemViewModels.Clear();

            var recordingDir = _skeletonGameProvider.GameFolder + @"\recordings";

            Log($"Loading recordings from.. {recordingDir}");
            RecordingManager.GetPlaybackFiles(recordingDir);

            Log($"Populating recordings.");
            foreach (var playbackFile in RecordingManager.PlayBackFiles)
            {
                var vm = new PlaybackItemViewModel(playbackFile);
                vm.UpdatePlayBackItems(true);
                PlaybackItemViewModels.Add(vm);
            }
        }
Exemplo n.º 30
0
        public void DoRecordingWithoutPOMTest()
        {
            List <ApplicationPOMModel> currentPOM = null;
            RecordingManager           mngr       = new RecordingManager(currentPOM, mBF, Context, mDriver, PlatformInfo);

            if (mngr != null)
            {
                mngr.StartRecording();
                Thread.Sleep(2000);
                mngr.StopRecording();
            }
            TestAction actUI = (TestAction)mBF.Activities[0].Acts[0];

            Assert.IsTrue(actUI.ElementLocateBy == eLocateBy.ByID);
            Assert.IsTrue(actUI.ElementAction == "Click");
            Assert.IsTrue(actUI.ElementType == "Button");
        }
        public async Task When_FilesAlreadyExistInFolder_And_ValidRequestResponse_Then_CreateTextFileInRightFormat_And_CanLoadFile()
        {
            // this test relies on usage of the FileSystem, it's unusual, but considered best balance
            // of efficient + realist testing vs potential downsides, using the temporary folder of the machine
            // should be ok

            // arrange
            if (Directory.Exists(folder))
            {
                Directory.Delete(folder, true);                          // if folder exists, it was the result of previous tests
            }
            // create folder and some files in it, so we make sure our code creates the next file correctly
            Directory.CreateDirectory(folder);
            File.CreateText(Path.Combine(folder, "OK_00001.txt"));
            File.CreateText(Path.Combine(folder, "Forbidden.txt"));
            File.CreateText(Path.Combine(folder, "Whatever.txt"));
            File.CreateText(Path.Combine(folder, "some_random_file.txt"));

            var sut = new RecordingManager(folder);

            var input = CreateLog();

            // act
            var fileName = sut.Save(input);

            // asserts
            fileName.Should().Be("OK_0002");
            var createdFile = Path.Combine(folder, "OK_0002.txt");

            File.Exists(createdFile).Should().BeTrue();

            var content = File.ReadAllText(createdFile);

            content.Should().Be(expectedFileContent);

            var deserializedResponse = ResponseFactory.FromRecordedFile(createdFile);

            deserializedResponse.StatusCode.Should().Be(input.Response.Status);
            (await deserializedResponse.Content.ReadAsStringAsync()).Should().Be(input.Response.Body);

            foreach (var item in input.Response.Headers)
            {
                deserializedResponse.Headers.ShouldContainHeader(item.Key, item.Value);
            }
        }
        public void getRecInfoTest()
        {
            string rec = ConnectionManager.getRecInfo("f25987a2ca6a6f2ffce8a4f402c3a853fa4a0855110a49f709b10e934848f8e5");
            RecordingManager recording = new RecordingManager(rec);
            Assert.IsNotNull(recording.Author);
            Assert.IsNotNull(recording.Description);
            Assert.IsNotNull(recording.Id);
            Assert.IsNotNull(recording.Title);

            try
            {
            string rec2 = ConnectionManager.getRecInfo("123456abcdef");
            Assert.Fail("No exception thrown");
            }
            catch (WebException ex)
            {
            Assert.IsTrue(ex is WebException);
            }
        }
        public void RecordingManagerTest_String()
        {
            // Assert that a valid JSON string will instantiate the recManager variable successfully
            fullJson = "{\"3464\":{\"LWin\":{\"value\":256}},\"3543\":{\"LWin\":{\"value\":257}},\"3906\":{\"N\":{\"value\":256}},\"4001\":{\"N\":{\"value\":257}},\"4048\":{\"O\":{\"value\":256}},\"4159\":{\"O\":{\"value\":257}},\"4188\":{\"T\":{\"value\":256}},\"4243\":{\"E\":{\"value\":256}},\"4322\":{\"T\":{\"value\":257}},\"4368\":{\"E\":{\"value\":257}},\"4449\":{\"P\":{\"value\":256}},\"4541\":{\"A\":{\"value\":256}},\"4559\":{\"P\":{\"value\":257}},\"4667\":{\"D\":{\"value\":256}},\"4705\":{\"A\":{\"value\":257}},\"4769\":{\"D\":{\"value\":257}},\"5090\":{\"Return\":{\"value\":256},\"Open windows\":{\"788720\":\"Easy Automator\",\"787150\":\"EasyAutomator (Running) - Microsoft Visual Studio\",\"4653890\":\"Recordings\",\"2949282\":\"Final Report_formatted_v2.docx - Word\",\"2427250\":\"Interim Report\",\"1704526\":\"Tools\",\"1638498\":\"History\",\"4523202\":\"Layers\",\"3016774\":\"Colors\",\"3933764\":\"Use_Case.PNG - paint.net 4.0.9\",\"4327206\":\"Snipping Tool\",\"5048204\":\"\u2022 Use case diagram_v10.mdj \u2014 StarUML (UNREGISTERED)\",\"1114226\":\"Violet UML Editor\",\"3736688\":\"Sequence_Download+Play.PNG - Windows Photo Viewer\",\"5244472\":\"Settings\",\"2034060\":\"Sequence_Create+Upload.PNG - Windows Photo Viewer\",\"5834602\":\"Calculator\",\"22481286\":\"Calculator\",\"5571430\":\"Settings\",\"131226\":\"Windows Shell Experience Host\",\"2491466\":\"Google Play Music Desktop Player\"}},\"5193\":{\"Return\":{\"value\":257}},\"5610\":{\"A\":{\"value\":256}},\"5721\":{\"A\":{\"value\":257}},\"5921\":{\"B\":{\"value\":256}},\"6015\":{\"B\":{\"value\":257}},\"6165\":{\"C\":{\"value\":256}},\"6252\":{\"C\":{\"value\":257}},\"6657\":{\"Capital\":{\"value\":256}},\"6744\":{\"Capital\":{\"value\":257}}," +
                            "\"Name\":\"ABC\",\"Desc\":\"Opens the notepad, types ABC\",\"recId\":\"a47dddeffff233327a431186217c2c66d1c05bbb875f4c0324148b9a344a05cd\",\"AuthorFirstname\":\"Brian\",\"AuthorSurname\":\"Briscoe\",\"UserId\":\"b2ccb37d78e78182f80397edbc456f085778896427791cd4840bfc315f418451\"}";
            rec = new RecordingManager(fullJson);
            Assert.IsNotNull(rec.Title);
            Assert.IsNotNull(rec.Id);
            Assert.IsNotNull(rec.Description);
            Assert.IsNotNull(rec.Author);

            // Assert that an invalid JSON string will raise an exception
            try
            {
                fullJson = "{\"menu\": {\"id\": \"file\",\"value\": \"File\",\"popup\": {\"menuitem\": [{\"value\": \"New\", \"onclick\": \"CreateNewDoc()\"},{\"value\": \"Open\", \"onclick\": \"OpenDoc()\"},{\"value\": \"Close\", \"onclick\": \"CloseDoc}}}";
                rec = new RecordingManager(fullJson);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex is JsonReaderException);
            }
        }