Beispiel #1
0
        public void OpenResultsInBrowser()
        {
            var response = FullResults();
            var document = BatchResultsWriter.BuildResults(response);

            document.OpenInBrowser();
        }
Beispiel #2
0
        public HtmlDocument Index()
        {
            _document.Title = "Storyteller 3";

            writeInitialDataIntoPage(_document);

            _document.Add("div").Id("header-container");
            _document.Add("div").Id("body-pane").AddClass("container");
            _document.Add("div").Id("main");

            if (File.Exists(_files.RootPath.AppendPath("public", "stylesheets", "storyteller.css")))
            {
                var stylesheets = new[] { "bootstrap.min.css", "storyteller.css", "font-awesome.min.css" };
                var tags        = stylesheets.Select(file =>
                {
                    var path = $"/public/stylesheets/{file}";
                    return(new HtmlTag("link").Attr("rel", "stylesheet").Attr("href", path));
                });

                _document.Head.Append(tags);
            }
            else
            {
                BatchResultsWriter.WriteCSS(_document);
                _document.Head.Add("link")
                .Attr("rel", "stylesheet")
                .Attr("href", "//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css");
            }

            var scriptTag = new HtmlTag("script").Attr("type", "text/javascript").Attr("src", "/bundle.js");

            _document.Body.Append(scriptTag);

            return(_document);
        }
Beispiel #3
0
        public void WriteResultsDocument(string file)
        {
            var response = FullResults();
            var document = BatchResultsWriter.BuildResults(response);

            document.WriteToFile(file);
        }
Beispiel #4
0
        public HtmlDocument Index()
        {
            _document.Title = "Storyteller 3";

            writeInitialDataIntoPage(_document);

            _document.Add("div").Id("header-container");
            _document.Add("div").Id("body-pane").AddClass("container");

            if (File.Exists(_files.RootPath.AppendPath("public", "stylesheets", "storyteller.css")))
            {
                _tags.BuildStylesheetTags(new[] { "bootstrap.min.css", "storyteller.css", "font-awesome.min.css" });
            }
            else
            {
                BatchResultsWriter.WriteCSS(_document);
                _document.Head.Add("link")
                .Attr("rel", "stylesheet")
                .Attr("href", "//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css");
            }

            _document.Body.Append(_document.Script("bundle.js"));

            return(_document);
        }
        private static void writeResults(RunInput input, SystemRecycled systemRecycled, BatchRunResponse results)
        {
            results.suite  = input.WorkspaceFlag;
            results.system = systemRecycled.system_name;
            results.time   = DateTime.Now.ToString();

            results.fixtures = buildFixturesWithOverrides(input, systemRecycled);

            var document = BatchResultsWriter.BuildResults(results);

            Console.WriteLine("Writing results to " + input.ResultsPathFlag);
            document.WriteToFile(input.ResultsPathFlag);
        }
Beispiel #6
0
        private void writeClientSideAssetsFromEmbeds()
        {
            BatchResultsWriter.WriteCSS(_document);
            _document.Head.Add("link")
            .Attr("rel", "stylesheet")
            .Attr("href", "//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css");


            var bundleJS = typeof(HomeEndpoint).GetAssembly()
                           .GetManifestResourceStream("ST.bundle.js").ReadAllText();

            var scriptTag = new HtmlTag("script").Attr("type", "text/javascript").Text(bundleJS).Encoded(false);

            _document.Body.Append(scriptTag);
        }
Beispiel #7
0
        private static IEnumerable <HtmlTag> styleTags()
        {
#if DEBUG
            foreach (var file in Stylesheets)
            {
                var path = $"/public/stylesheets/{file}";
                yield return(new HtmlTag("link").Attr("rel", "stylesheet").Attr("href", path));
            }
#else
            yield return(BatchResultsWriter.StyleTag());
#endif

            yield return(new HtmlTag("link")
                         .Attr("rel", "stylesheet")
                         .Attr("href", "//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"));
        }
        public static HtmlDocument Build(Suite top, FixtureLibrary fixtures, string title)
        {
            var document = new HtmlDocument
            {
                Title = title
            };

            document.Head.Append(BatchResultsWriter.StyleTag());

            writeInitialData(document, top, fixtures, title);

#if DEBUG
            var scriptTag = HomeEndpoint.ScriptTag(false, "/preview.js");
            document.Body.Append(scriptTag);
#else
            writeEnbeddedJavascript(document);
#endif

            document.Body.Add("div").Id("main");

            return(document);
        }
Beispiel #9
0
        public override bool Execute(RunInput input)
        {
            try
            {
                var top   = HierarchyLoader.ReadHierarchy(input.SpecPath);
                var specs = input.GetBatchRunRequest().Filter(top);

                if (!specs.Any())
                {
                    ConsoleWriter.Write(ConsoleColor.Yellow, "Warning: No specs found!");
                }
            }
            catch (SuiteNotFoundException ex)
            {
                ConsoleWriter.Write(ConsoleColor.Red, ex.Message);
                return(false);
            }

            var controller = input.BuildRemoteController();
            var task       = controller.Start(EngineMode.Batch).ContinueWith(t =>
            {
                var systemRecycled = t.Result;
                if (!systemRecycled.success)
                {
                    systemRecycled.WriteSystemUsage();
                    return(false);
                }

                writeSystemUsage(systemRecycled);
                var execution = input.StartBatch(controller);

                // TODO -- put a command level timeout on this thing
                execution.Wait();

                var results = execution.Result;

                var regression = results.Summarize(Lifecycle.Regression);
                var acceptance = results.Summarize(Lifecycle.Acceptance);

                if (input.LifecycleFlag != Lifecycle.Regression)
                {
                    Console.WriteLine(acceptance);
                }

                if (input.LifecycleFlag != Lifecycle.Acceptance)
                {
                    Console.WriteLine(regression);
                }

                var success = regression.Failed == 0;

                results.suite    = input.WorkspaceFlag;
                results.system   = systemRecycled.system_name;
                results.time     = DateTime.Now.ToString();
                results.fixtures = systemRecycled.fixtures;

                var document = BatchResultsWriter.BuildResults(results);
                Console.WriteLine("Writing results to " + input.ResultsPathFlag);
                document.WriteToFile(input.ResultsPathFlag);

                if (input.DumpFlag.IsNotEmpty())
                {
                    dumpJson(input, results);
                }

                if (input.CsvFlag.IsNotEmpty())
                {
                    writePerformanceData(input, results);
                }

                if (input.JsonFlag.IsNotEmpty())
                {
                    Console.WriteLine("Writing the raw result information to " + input.JsonFlag);
                    PerformanceDataWriter.WriteJSON(results, input.JsonFlag);
                }

                if (input.OpenFlag)
                {
                    Process.Start(input.ResultsPathFlag);
                }

                if (success)
                {
                    ConsoleWriter.Write(ConsoleColor.Green, "Success!");
                }
                else
                {
                    ConsoleWriter.Write(ConsoleColor.Red, "Failed with Regression Failures!");
                }

                return(success);
            });

            task.Wait();

            controller.SafeDispose();

            return(task.Result);
        }