Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

calculate status over all steps

  • Loading branch information...
commit f145d53597c660e5cc3228e975cd9a9872aee824 1 parent 9acf00f
@laribee authored
View
23 lib/dopecukes/formatter.coffee
@@ -3,6 +3,7 @@ util = require("util")
_ = require("underscore")
output = ""
+backgroundSteps = 0
formatFeature = (feature) =>
@output += "<article class='feature'>"
@@ -11,10 +12,11 @@ formatFeature = (feature) =>
@output += "<section class='description'>#{md(feature.description)}</section>"
formatFeatureElement(element) for element in feature.elements
@output += "</article>"
+ @backgroundSteps = 0
-formatFeatureElement = (element) =>
+formatFeatureElement = (element) =>
elementType = element.type
- @output += "<section class='#{elementType}'>"
+ @output += "<section class='#{elementType} #{figureOutStatus(element)}'>"
formatBackground(element) if elementType == "background"
formatScenario(element) if elementType == "scenario"
formatScenarioOutline(element) if elementType == "scenario_outline"
@@ -24,14 +26,21 @@ formatBackground = (background) =>
@output += "<h2>Background</h2>"
formatTags(background.tags) if background.tags?
@output += "<ul class='steps'>"
- formatStep(step) for step in background.steps
+ formatBackgroundStep(step) for step in background.steps
@output += "</ul>"
+figureOutStatus = (scenario) ->
+ statuses = _.map(scenario.steps, (step) -> step?.result?.status)
+ reduction = (memo, status) ->
+ return memo if memo != 'passed'
+ memo = status
+ status = _.reduce(statuses, reduction, 'passed')
+
formatScenario = (scenario) =>
@output += "<h2>#{scenario.name}</h2>"
formatTags(scenario.tags) if scenario.tags?
@output += "<ul class='steps'>"
- formatStep(step) for step in scenario.steps
+ formatStep(step) for step in scenario.steps[(@backgroundSteps)..scenario.length]
@output += "</ul>"
formatScenarioOutline = (scenario_outline) =>
@@ -41,13 +50,17 @@ formatScenarioOutline = (scenario_outline) =>
formatStep(step) for step in scenario_outline.steps
@output += "</ul>"
+formatBackgroundStep = (step) =>
+ formatStep(step)
+ @backgroundSteps += 1
+
formatStep = (step) =>
@output += "<li class='step #{step?.result?.status}'>#{step?.keyword + step?.name}</li>"
formatTable(step.rows) if step.rows?
formatTable = (rows) =>
@output += "<li class='step'>"
- @output += "<table class='step-data'>"
+ @output += "<table class='step-data' cellpadding='0' cellspacing='0'>"
formatTableRow(row) for row in rows
@output += "</table>"
@output += "<li>"
View
BIN  lib/dopecukes/public/fail.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  lib/dopecukes/public/hourglass.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  lib/dopecukes/public/question.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
23 lib/dopecukes/public/screen.css
@@ -70,7 +70,30 @@ li.step {
}
+li.step { }
+
+
+
section.description, section.background, section.scenario, section.scenario_outline {
border-left: 4px #E6E6E6 solid;
padding-left: 4px;
}
+
+table.step-data {
+ border-bottom: 1px #E6E6E6 solid;
+ border-left: 1px #E6E6E6 solid;
+ margin: 4px 0;
+ padding: 0;
+}
+
+table.step-data td {
+ min-width: 50px;
+ padding: 4px 35px 4px 4px;
+ border-top: 1px #E6E6E6 solid;
+ border-right: 1px #E6E6E6 solid;
+}
+
+table.step-data tr:first-child td {
+ background-color: #F2F2F2;
+ padding: 2px;
+}
View
BIN  lib/dopecukes/public/tick.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
3  todo
@@ -0,0 +1,3 @@
+roll status up into sections
+roll status up into sections
+use a th for headers of tables
Please sign in to comment.
Something went wrong with that request. Please try again.