コード例 #1
0
ファイル: JasmineRunner.cs プロジェクト: jemacom/fubumvc
        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;
        }
コード例 #2
0
ファイル: JasmineRunner.cs プロジェクト: GaryLCoxJr/Serenity
        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;
        }