Skip to content

Commit bc3494a

Browse files
committed
display DataTables in the report
1 parent 396eac2 commit bc3494a

File tree

3 files changed

+96
-1
lines changed

3 files changed

+96
-1
lines changed

lib/html_formatter.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ module.exports = (function () {
6262
return compiled({
6363
status: step.result ? step.result.status : '',
6464
errorDetails: step.result ? toHtmlEntities(step.result.error_message) : '',
65-
name: step.keyword + step.name
65+
name: step.keyword + step.name,
66+
dataTable: step.rows ? step.rows : ''
6667
});
6768
}
6869

templates/step_template.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
<div class="step <%= status %>">
22
<%= name %>
3+
<% if (dataTable) { %>
4+
<table class="table">
5+
<% for(var row in dataTable) { %>
6+
<tr>
7+
<% for(var cell in dataTable[row].cells) { %>
8+
<% if (Number(row) === 0) { %>
9+
<th><%= dataTable[row].cells[cell] %></th>
10+
<% } else { %>
11+
<td><%= dataTable[row].cells[cell] %></td>
12+
<% } %>
13+
<% } %>
14+
</tr>
15+
<% } %>
16+
</table>
17+
<% } %>
318
<% if (errorDetails) { %>
419
<div class="error-details">
520
<blockquote>

test/data/expected_report.html

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,17 @@ <h2><i class="fa fa-magic"></i> Feature:</h2>
6060
</div><div class="step passed">
6161
Given I login as teacher
6262

63+
6364
</div><div class="step passed">
6465
Then I log out
6566

67+
6668
</div></div><div class="scenario-container"><div class="scenario failed">
6769
Scenario: Log in as a student
6870
</div><div class="step failed">
6971
Given I login as student
7072

73+
7174
<div class="error-details">
7275
<blockquote>
7376
<pre>
@@ -127,17 +130,93 @@ <h2><i class="fa fa-magic"></i> Feature:</h2>
127130
</div><div class="step skipped">
128131
Then I log out
129132

133+
130134
</div></div><div class="scenario-container"><div class="scenario passed">
131135
Scenario: Set and verify bookmark tool
132136
</div><div class="step passed">
133137
Given I login as teacher
134138

139+
135140
</div><div class="step passed">
136141
When I set bookmark tool for student 1 on:
137142

143+
<table class="table">
144+
145+
<tr>
146+
147+
148+
<th>level</th>
149+
150+
151+
152+
<th>unit</th>
153+
154+
155+
156+
<th>lesson</th>
157+
158+
159+
</tr>
160+
161+
<tr>
162+
163+
164+
<td>2</td>
165+
166+
167+
168+
<td>5</td>
169+
170+
171+
172+
<td>2</td>
173+
174+
175+
</tr>
176+
177+
</table>
178+
179+
138180
</div><div class="step passed">
139181
Then I should see bookmark set on:
140182

183+
<table class="table">
184+
185+
<tr>
186+
187+
188+
<th>level</th>
189+
190+
191+
192+
<th>unit</th>
193+
194+
195+
196+
<th>lesson</th>
197+
198+
199+
</tr>
200+
201+
<tr>
202+
203+
204+
<td>2</td>
205+
206+
207+
208+
<td>5</td>
209+
210+
211+
212+
<td>2</td>
213+
214+
215+
</tr>
216+
217+
</table>
218+
219+
141220
</div></div>
142221

143222
<div class="scenario-chart">

0 commit comments

Comments
 (0)