alielie
2026-09-10 9ec80cafc23f5ee3278cacce3c9f86f4087b435a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ name }}</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
 
        body {
            font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
            background-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
            padding: 20px;
        }
 
        .container {
            max-width: 1000px;
            margin: 0 auto;
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
            overflow: hidden;
        }
 
        /* 报告头部 */
        .report-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 30px 40px;
        }
 
        .report-header.Pass {
            background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
        }
 
        .report-header.Fail {
            background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
        }
 
        .report-header.Error {
            background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
        }
 
        .report-title-row {
            display: flex;
            align-items: center;
            gap: 15px;
            margin-bottom: 15px;
        }
 
        .report-title {
            font-size: 28px;
            font-weight: bold;
        }
 
        .report-status {
            font-size: 16px;
            font-weight: bold;
            padding: 6px 20px;
            border-radius: 20px;
            background: rgba(255, 255, 255, 0.25);
        }
 
        .report-meta {
            display: flex;
            gap: 40px;
            font-size: 14px;
            opacity: 0.9;
        }
 
        /* 筛选区域 */
        .filter-section {
            padding: 20px 40px;
            background: #f8f9fa;
            border-bottom: 1px solid #eee;
            display: flex;
            align-items: center;
            gap: 20px;
        }
 
        .filter-label {
            font-weight: bold;
            color: #333;
        }
 
        .filter-buttons {
            display: flex;
            gap: 10px;
        }
 
        .filter-btn {
            padding: 8px 20px;
            border: 2px solid #ddd;
            border-radius: 20px;
            background: #fff;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            gap: 8px;
        }
 
        .filter-btn:hover {
            border-color: #667eea;
            background: #f0f0ff;
        }
 
        .filter-btn.active {
            color: white;
            border-color: transparent;
        }
 
        .filter-btn.active.all {
            background: #667eea;
        }
 
        .filter-btn.active.Pass {
            background: #28a745;
        }
 
        .filter-btn.active.Fail {
            background: #dc3545;
        }
 
        .filter-btn.active.Error {
            background: #dc3545;
        }
 
        .filter-btn.active.skipped {
            background: #ffc107;
            color: #333;
        }
 
        .filter-count {
            padding: 2px 8px;
            border-radius: 10px;
            background: rgba(0, 0, 0, 0.1);
            font-size: 12px;
        }
 
        .filter-btn.active .filter-count {
            background: rgba(255, 255, 255, 0.3);
        }
 
        /* 测试步骤 */
        .steps-section {
            padding: 30px 40px;
        }
 
        .steps-title {
            font-size: 18px;
            font-weight: bold;
            color: #333;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 2px solid #667eea;
            display: inline-block;
        }
 
        .step-card {
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            margin-bottom: 20px;
            overflow: hidden;
            transition: all 0.3s ease;
        }
 
        .step-card.hidden {
            display: none;
        }
 
        .step-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px 20px;
            background: #f8f9fa;
            border-bottom: 1px solid #e0e0e0;
        }
 
        .step-header.NotSet {
            background: #e8e8e8;
        }
 
        .step-header.Pass {
            background: #d4edda;
        }
 
        .step-header.Fail {
            background: #f8d7da;
        }
 
        .step-header.Error {
            background: #f8d7da;
        }
 
        .step-header.Abort {
            background: #fff3cd;
        }
 
        .step-title {
            font-weight: bold;
            font-size: 16px;
            display: flex;
            align-items: center;
            gap: 10px;
        }
 
        .step-badge {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: normal;
        }
 
        .step-badge.NotSet {
            background: #b4b4b4;
        }
 
        .step-badge.Pass {
            background: #28a745;
            color: white;
        }
 
        .step-badge.Fail {
            background: #dc3545;
            color: white;
        }
 
        .step-badge.Error {
            background: #dc3545;
            color: white;
        }
 
        .step-badge.skipped {
            background: #ffc107;
            color: #333;
        }
 
        .step-info {
            display: flex;
            gap: 30px;
            font-size: 13px;
            color: #666;
        }
 
        .step-content {
            padding: 20px;
        }
 
        .step-params-title {
            font-weight: bold;
            font-size: 14px;
            color: #333;
            margin-bottom: 10px;
        }
 
        /* 参数表格 */
        .params-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 14px;
        }
 
        .params-table th,
        .params-table td {
            padding: 12px 15px;
            text-align: left;
            border-bottom: 1px solid #eee;
        }
 
        .params-table th {
            background: #f8f9fa;
            font-weight: bold;
            color: #333;
            width: 150px;
        }
 
        .params-table tr:last-child td,
        .params-table tr:last-child th {
            border-bottom: none;
        }
 
        .params-table tr:hover {
            background: #f8f9fa;
        }
 
        /* 空状态提示 */
        .no-results {
            text-align: center;
            padding: 40px;
            color: #999;
            font-size: 16px;
        }
 
        .no-results-icon {
            font-size: 48px;
            margin-bottom: 10px;
        }
 
        /* 报告底部 */
        .report-footer {
            padding: 20px 40px;
            background: #f8f9fa;
            text-align: center;
            font-size: 12px;
            color: #999;
        }
 
        /* 响应式 */
        @media (max-width: 768px) {
            .report-meta {
                flex-direction: column;
                gap: 10px;
            }
            
            .filter-section {
                flex-direction: column;
                align-items: flex-start;
            }
            
            .filter-buttons {
                flex-wrap: wrap;
            }
            
            .step-info {
                flex-direction: column;
                gap: 5px;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- 报告头部 - 通过状态 -->
        <div class="report-header {{ verdict }}">
            <div class="report-title-row">
                <h1 class="report-title">{{ name }}</h1>
                <span class="report-status">{{ verdict }}</span>
            </div>
            <div class="report-meta">
                <span>{{ start_time }}</span>
                <span>{{ end_time }}</span>
            </div>
        </div>
 
        <!-- 筛选区域 -->
        <div class="filter-section">
            <span class="filter-label">筛选:</span>
            <div class="filter-buttons">
                <button class="filter-btn active all" onclick="filterSteps('all')">
                    全部 <span class="filter-count" id="count-all"></span>
                </button>
                <button class="filter-btn Pass" onclick="filterSteps('Pass')">
                    通过 <span class="filter-count" id="count-passed"></span>
                </button>
                <button class="filter-btn Fail" onclick="filterSteps('Fail')">
                    失败 <span class="filter-count" id="count-failed"></span>
                </button>
                <button class="filter-btn Error" onclick="filterSteps('Error')">
                    错误 <span class="filter-count" id="count-error"></span>
                </button>
            </div>
        </div>
 
        <!-- 测试步骤详情 -->
        <div class="steps-section">
            <h2 class="steps-title">测试步骤详情</h2>
 
            {{ for step in steps }}
            <div class="step-card" data-status="{{ step.verdict }}">
                <div class="step-header {{ step.verdict }}">
                    <div class="step-title">
                        <span>{{ step.name }}</span>
                        <span class="step-badge {{ step.verdict }}">{{ step.verdict }}</span>
                    </div>
                    <div class="step-info">
                        <span>{{ step.start_time }}</span>
                        <span>{{ step.end_time }}</span>
                        <span>{{ step.consuming }}</span>
                    </div>
                </div>
                <div class="step-content">
                    <div class="step-params-title">测试参数</div>
                    <table class="params-table">
                        <tr>
                            <th>参数名称</th>
                            <th>参数类型</th>
                            <th>参数值</th>
                        </tr>
                        {{ for param in step.parameters }}
                            <tr>
                                <td>{{ param.name }}</td>
                                <td>{{ param.type }}</td>
                                <td>{{ param.value }}</td>
                            </tr>
                        {{ end }}
                    </table>
                </div>
            </div>
            {{ end }}
 
            <!-- 空状态提示(默认隐藏) -->
            <div class="no-results" id="no-results" style="display: none;">
                <div class="no-results-icon">🔍</div>
                <div>没有符合条件的测试步骤</div>
            </div>
        </div>
 
        <!-- 报告底部 -->
        <div class="report-footer">
            <p>本报告由自动化测试系统生成 | 生成时间:{{ create_time }}</p>
        </div>
    </div>
 
    <script>
        // 筛选测试步骤
        function filterSteps(status) {
            const cards = document.querySelectorAll('.step-card');
            const buttons = document.querySelectorAll('.filter-btn');
            const noResults = document.getElementById('no-results');
            let visibleCount = 0;
 
            // 更新按钮状态
            buttons.forEach(btn => {
                btn.classList.remove('active');
                if (btn.classList.contains(status)) {
                    btn.classList.add('active');
                }
            });
 
            // 筛选卡片
            cards.forEach(card => {
                const cardStatus = card.getAttribute('data-status');
                
                if (status === 'all' || cardStatus === status) {
                    card.classList.remove('hidden');
                    visibleCount++;
                } else {
                    card.classList.add('hidden');
                }
            });
 
            // 显示/隐藏空状态提示
            if (visibleCount === 0) {
                noResults.style.display = 'block';
            } else {
                noResults.style.display = 'none';
            }
        }
 
        // 页面加载时自动计算各状态数量
        document.addEventListener('DOMContentLoaded', function() {
            const cards = document.querySelectorAll('.step-card');
            let passed = 0, failed = 0, skipped = 0;error = 0;
 
            cards.forEach(card => {
                const status = card.getAttribute('data-status');
                if (status === 'Pass') passed++;
                else if (status === 'Fail') failed++;
                else if (status === 'skipped') skipped++;
                else if (status === 'Error') error++;
            });
 
            // 更新计数
            document.getElementById('count-all').textContent = cards.length;
            document.getElementById('count-passed').textContent = passed;
            document.getElementById('count-failed').textContent = failed;
            document.getElementById('count-error').textContent = error;
        });
    </script>
</body>
</html>