public static Harness Run(Action<FubuRegistry> configure)
        {
            var applicationDirectory = GetApplicationDirectory();
            FubuMvcPackageFacility.PhysicalRootPath = applicationDirectory;

            var application = new FubuKayakApplication(new SimpleSource(configure));
            var port = PortFinder.FindPort(_port++);

            var reset = new ManualResetEvent(false);
            FubuRuntime runtime = null;

            ThreadPool.QueueUserWorkItem(o =>
            {
                // Need to make this capture the package registry failures cleanly
                application.RunApplication(port, r =>
                {
                    runtime = r;
                    reset.Set();
                });
            });

            reset.WaitOne();

            var root = "http://localhost:" + port;

            return new Harness(runtime, application, root);

            // Need to get the runtime
        }
Esempio n. 2
0
        private void run()
        {
            _kayak = new FubuKayakApplication(_application);
            _kayak.RunApplication(_input.PortFlag, watchAssetFiles);

            _reset.Set();
        }
Esempio n. 3
0
        public virtual void StartApplication(IApplicationSource source, ApplicationSettings settings, ManualResetEvent reset)
        {
            FubuMvcPackageFacility.PhysicalRootPath = settings.GetApplicationFolder();
            _kayakApplication = new FubuKayakApplication(source);
            // Put a thread here

            ThreadPool.QueueUserWorkItem(o =>
            {
                // Need to make this capture the package registry failures cleanly
                _kayakApplication.RunApplication(settings.Port, r => reset.Set());
            });
        }
Esempio n. 4
0
        public bool RunAllSpecs()
        {
            var title = "Running Jasmine specs for project at " + _input.SerenityFile;
            Console.WriteLine(title);
            var line = "".PadRight(title.Length, '-');

            Console.WriteLine(line);

            buildApplication();
            var returnValue = true;

            _kayak = new FubuKayakApplication(_application);
            _kayak.RunApplication(_input.PortFlag, runtime =>
            {
                _driver.NavigateTo<JasminePages>(x => x.AllSpecs());

                var browser = _applicationUnderTest.Driver;
                Wait.Until(() => browser.FindElement(By.ClassName("finished-at")).Text.IsNotEmpty());
                var failures = browser.FindElements(By.CssSelector("div.suite.failed"));

                if (failures.Any())
                {
                    returnValue = false;

                    Console.WriteLine(line);
                    writeFailures(failures);
                }

                Console.WriteLine();
                Console.WriteLine(line);
                writeTotals(browser);

                browser.Quit();
                browser.SafeDispose();
                _kayak.Stop();
            });

            return returnValue;
        }
Esempio n. 5
0
        public bool RunAllSpecs()
        {
            var title = "Running Jasmine specs for project at " + _input.SerenityFile;
            Console.WriteLine(title);
            var line = "".PadRight(title.Length, '-');

            Console.WriteLine(line);

            buildApplication();
            var returnValue = true;

            _kayak = new FubuKayakApplication(_application);
            _kayak.RunApplication(_input.PortFlag, runtime =>
            {
                _driver.NavigateTo<JasminePages>(x => x.AllSpecs());

                var browser = _applicationUnderTest.Driver;
                Wait.Until(() => browser.FindElement(By.ClassName("finished-at")).Text.IsNotEmpty(), timeoutInMilliseconds: _input.TimeoutFlag * 1000);
                var failures = browser.FindElements(By.CssSelector("div.suite.failed"));

                if (_input.Mode == JasmineMode.run && _input.VerboseFlag)
                {
                    ((IJavaScriptExecutor) browser).ExecuteScript("$('#jasmine-reporter').show();");
                    var logs = browser.FindElements(By.ClassName("jasmine-reporter-item"));
                    logs.Each(message => Console.WriteLine(message.Text));
                    ((IJavaScriptExecutor) browser).ExecuteScript("$('#jasmine-reporter').hide();");
                }

                if (failures.Any())
                {
                    returnValue = false;

                    Console.WriteLine(line);
                    writeFailures(failures);
                }

                Console.WriteLine();
                Console.WriteLine(line);
                writeTotals(browser);

                browser.Quit();
                browser.SafeDispose();
                _kayak.Stop();
            });

            return returnValue;
        }