Пример #1
0
        public void RemoteWorker_Validate_With_SimpleHttps()
        {
            var identifier = Guid.NewGuid().ToString();

            using (new ExclusiveBlock(identifier))
            {
                using (var localProcess = new LocalProcessHost(new TcpListenerPortProvider(), identifier))
                {
                    using (IWorker runnerHost = new RemoteWorker(localProcess))
                    {
                        var remoteTask = new RemoteTask()
                        {
                            BrowserSize = new Size(1366, 768),
                            Url         = "https://msdn.microsoft.com/fr-fr",
                            Timeout     = TimeSpan.FromSeconds(30)
                        };

                        remoteTask.SetTrigger(new WindowLoadTrigger(TimeSpan.FromSeconds(0)));
                        remoteTask.SetCaptureZone(new VisibleScreen());

                        var taskResult = runnerHost.PerformTask(remoteTask);

                        Assert.IsNotNull(taskResult.PayLoad);
                    }
                }
            }
        }
Пример #2
0
        public void RemoteWorker_Validate_With_MultipleTask()
        {
            var identifier = Guid.NewGuid().ToString();

            using (new ExclusiveBlock(identifier))
            {
                using (var localProcess = new LocalProcessHost(new TcpListenerPortProvider(), identifier))
                {
                    using (IWorker runnerHost = new RemoteWorker(localProcess))
                    {
                        string[] domains = { "https://google.fr/", "https://google.ca/", "https://google.com/" };

                        for (int index = 0; index < domains.Length; index++)
                        {
                            var domain = domains[index];

                            var remoteTask = new RemoteTask()
                            {
                                BrowserSize = new Size(1366, 768),
                                Url         = domain,
                                Timeout     = TimeSpan.FromSeconds(30)
                            };

                            remoteTask.SetTrigger(new WindowLoadTrigger(TimeSpan.FromSeconds(0)));
                            remoteTask.SetCaptureZone(new VisibleScreen());

                            var taskResult = runnerHost.PerformTask(remoteTask);

                            Assert.IsNotNull(taskResult.PayLoad);
                        }
                    }
                }
            }
        }
Пример #3
0
        public void RunnerEngine_Host_Check_Engine_Host_Simple_Task()
        {
            using (IWorker runnerHost = new RunnerEngineHost())
            {
                var remoteTask = new RemoteTask()
                {
                    BrowserSize = new Size(1366, 768),
                    Url         = "https://msdn.microsoft.com/fr-fr",
                    Timeout     = TimeSpan.FromSeconds(30)
                };

                remoteTask.SetTrigger(new WindowLoadTrigger(TimeSpan.FromSeconds(0)));
                remoteTask.SetCaptureZone(new VisibleScreen());

                var taskResult = runnerHost.PerformTask(remoteTask);
                Assert.IsNotNull(taskResult.PayLoad);
            }
        }
Пример #4
0
        //[TestMethod]
        public void TestRenderOnFreezerJsEventWithSingleWebPageHard()
        {
            var rootDirectoryPath = FreezerTestPathSolver.GetDirectory("WebPages");

            var hostname = "127.0.0.1";
            int port     = 25345; // This port is hardcoded. Can be changed if busy

            using (new ExclusiveBlock("TestRenderOnFreezerJsEventWithSingleWebPageHard"))
            {
                RunnerCore.SetupHostAsync(hostname, port, null, "TestRenderOnFreezerJsEventWithSingleWebPageHard");

                using (var httpListener = new StaticHttpServer(rootDirectoryPath))
                {
                    var url = $"{_httpServer.BoundURL}/Global/verylongpage.html";
                    //var url = "http://dragonball.wikia.com/wiki/Frieza";

                    var hostableLocalProcess = new CaptureHostMock()
                    {
                        Hostname = hostname,
                        Port     = port
                    };

                    var trigger = new WindowLoadTrigger(); // new FreezerJsEventTrigger();
                    var zone    = CaptureZone.FullPage;

                    using (IWorker runnerHost = new RemoteWorker(hostableLocalProcess))
                    {
                        var remoteTask = new RemoteTask()
                        {
                            BrowserSize = new Size(800, 600),
                            Url         = url,
                        };

                        remoteTask.SetTrigger(trigger);
                        remoteTask.SetCaptureZone(zone);

                        var taskResult = runnerHost.PerformTask(remoteTask);

                        File.WriteAllBytes($@"BmpResults/out-{nameof(TestRenderOnFreezerJsEventWithSingleWebPageHard)}.png", taskResult.PayLoad);
                    }
                }
            }
        }