apipost-cli 1.0.14 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,750 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Document</title>
7
+ <style>
8
+ body {
9
+ padding: 30px 20%;
10
+ }
11
+ .apipost-logo {
12
+ width: 121px;
13
+ display: flex;
14
+ align-items: center;
15
+ height: 35px;
16
+ }
17
+ .apipost-report-wrap .apipost-report-wrap-tpl .report-info {
18
+ padding-top: 30px;
19
+ }
20
+
21
+ .apipost-report-wrap .apipost-report-wrap-tpl .report-info .report-item {
22
+ padding-bottom: 10px;
23
+ color: #666666;
24
+ font-weight: 400;
25
+ font-size: 14px;
26
+ }
27
+
28
+ .apipost-report-wrap-tpl .report-info .report-item .label {
29
+ display: inline-block;
30
+ width: 135px;
31
+ text-align: right;
32
+ }
33
+
34
+ .apipost-report-wrap-tpl .report-info .report-item .value {
35
+ }
36
+
37
+ .apipost-report-wrap-tpl .report-info .report-item .value a {
38
+ color: #ff6907;
39
+ }
40
+
41
+ .apipost-report-wrap .dashed {
42
+ height: 1px;
43
+ width: 100%;
44
+ border: 1px dashed #d8d8d8;
45
+ }
46
+
47
+ .report-title {
48
+ padding-top: 15px;
49
+ display: flex;
50
+ align-items: center;
51
+ }
52
+ .report-title img {
53
+ width: 15px;
54
+ height: 17px;
55
+ }
56
+ .report-title .title {
57
+ padding-left: 10px;
58
+ font-weight: 400;
59
+ font-size: 18px;
60
+ color: #fa7600;
61
+ }
62
+ .report-table {
63
+ margin-top: 30px;
64
+ }
65
+ .report-table table {
66
+ width: 100%;
67
+ border: 1px solid #e9e9e9;
68
+ border-collapse: collapse;
69
+ }
70
+
71
+ .report-table table th {
72
+ font-weight: 400;
73
+ font-size: 12px;
74
+ color: #666666;
75
+ background: #f4f4f4;
76
+ height: 32px;
77
+ border: 1px solid #e9e9e9;
78
+ text-align: center;
79
+ }
80
+ .report-table table td {
81
+ background: #ffffff;
82
+ height: 32px;
83
+ color: #666666;
84
+ font-weight: 400;
85
+ font-size: 12px;
86
+ border: 1px solid #e9e9e9;
87
+ text-align: center;
88
+ }
89
+
90
+ .report-info-list {
91
+ width: 100%;
92
+ display: flex;
93
+ align-items: center;
94
+ flex-wrap: wrap;
95
+ padding-top: 15px;
96
+ }
97
+
98
+ .report-info-list .report-info-item {
99
+ display: inline-flex;
100
+ align-items: center;
101
+ width: 25%;
102
+ padding-bottom: 15px;
103
+ }
104
+
105
+ .report-info-list .report-info-item img {
106
+ width: 13px;
107
+ height: 13px;
108
+ }
109
+ .report-info-list .report-info-item span {
110
+ padding-left: 10px;
111
+ font-weight: 400;
112
+ font-size: 12px;
113
+ color: #666666;
114
+ }
115
+ .test-detail {
116
+ padding-top: 15px;
117
+ padding-bottom: 15px;
118
+ }
119
+ .test-detail .toggle-arrow {
120
+ display: flex;
121
+ align-items: center;
122
+ }
123
+ .test-detail .icon-bg {
124
+ display: inline-flex;
125
+ justify-content: center;
126
+ align-items: center;
127
+ width: 16px;
128
+ height: 16px;
129
+ background: #f2f2f2;
130
+ border-radius: 3px;
131
+ }
132
+ .test-detail img {
133
+ width: 8px;
134
+ height: 4px;
135
+ }
136
+ .test-detail span.title {
137
+ font-weight: 400;
138
+ font-size: 16px;
139
+ padding-left: 10px;
140
+ color: #2b2b2b;
141
+ }
142
+
143
+ .test-detail .test-event-list {
144
+ width: 100%;
145
+ }
146
+ .test-detail .test-event-list .test-event-item {
147
+ }
148
+ .test-detail .test-event-list .test-event-item .loop {
149
+ padding: 10px 0;
150
+ font-weight: 400;
151
+ font-size: 12px;
152
+ color: #666666;
153
+ }
154
+ .test-detail .test-event-list .test-event-item .panel {
155
+ display: flex;
156
+ align-items: center;
157
+ height: 36px;
158
+ font-weight: 400;
159
+ font-size: 12px;
160
+ background: #f8f8f8;
161
+ border-radius: 5px;
162
+ }
163
+ .test-event-list .test-event-item .panel .status {
164
+ width: 16px;
165
+ height: 16px;
166
+ margin-left: 25px;
167
+ margin-right: 30px;
168
+ }
169
+ .test-event-list .test-event-item .panel .index {
170
+ padding-right: 30px;
171
+ color: #666666;
172
+ }
173
+
174
+ .test-event-list .test-event-item .panel .method {
175
+ padding-right: 30px;
176
+ color: #26cea4;
177
+ }
178
+ .test-event-list .test-event-item .panel .name {
179
+ padding-right: 30px;
180
+ color: #666666;
181
+ }
182
+ .test-event-list .test-event-item .panel .link a {
183
+ text-decoration: none;
184
+ }
185
+
186
+ .test-event-list .test-event-item .item-info {
187
+ width: 100%;
188
+ display: flex;
189
+ align-items: center;
190
+ padding: 10px;
191
+ font-weight: 400;
192
+ font-size: 12px;
193
+ color: #666666;
194
+ }
195
+ .test-event-list .test-event-item .item-info span {
196
+ display: inline-block;
197
+ width: 25%;
198
+ }
199
+
200
+ .test-event-list .test-event-item .assert-info {
201
+ display: flex;
202
+ width: 100%;
203
+ font-weight: 400;
204
+ font-size: 12px;
205
+ }
206
+ .test-event-list .test-event-item .assert-info .assert-label {
207
+ min-width: 60px;
208
+ }
209
+ .test-event-item .assert-info .response-panel {
210
+ width: 100%;
211
+ }
212
+ .test-event-item .assert-info .response-panel img {
213
+ width: 12px;
214
+ height: 12px;
215
+ margin: 0 10px;
216
+ }
217
+ .test-event-item .assert-info .response-panel .success,
218
+ .test-event-item .assert-info .response-panel .error {
219
+ display: flex;
220
+ align-items: center;
221
+ width: 100%;
222
+ height: 34px;
223
+ }
224
+ .test-event-item .assert-info .response-panel .success {
225
+ background: #f1faf3;
226
+ color: #2ba58f;
227
+ }
228
+
229
+ .test-event-item .assert-info .response-panel .error {
230
+ background: #ffedee;
231
+ color: #ff4c4c;
232
+ }
233
+ .show {
234
+ display: block;
235
+ }
236
+ .hide {
237
+ display: none;
238
+ }
239
+ .chart-wrap {
240
+ display: flex;
241
+ align-items: center;
242
+ padding-top: 15px;
243
+ }
244
+
245
+ .chart-wrap .api {
246
+ display: flex;
247
+ align-items: center;
248
+ width: 50%;
249
+ }
250
+ .chart-wrap .api .api-des {
251
+ display: flex;
252
+ flex-direction: column;
253
+ padding-left: 50px;
254
+ }
255
+
256
+ .chart-wrap .api .api-des .api-title {
257
+ padding-bottom: 15px;
258
+ font-weight: 600;
259
+ font-size: 16px;
260
+ color: #666666;
261
+ }
262
+
263
+ .chart-wrap .api .api-des .api-label {
264
+ padding-bottom: 10px;
265
+ font-weight: 400;
266
+ font-size: 12px;
267
+ color: #666666;
268
+ }
269
+ #api-pie,
270
+ #assert-pie {
271
+ width: 80px;
272
+ height: 80px;
273
+ }
274
+ </style>
275
+ <script src="https://img.cdn.apipost.cn/cdn/test-report/js/template-web.js"></script>
276
+ <script src="https://img.cdn.apipost.cn/cdn/test-report/js/echarts.min.js"></script>
277
+ </head>
278
+ <body>
279
+ <div id="app">
280
+ <img class="apipost-logo" src="https://img.cdn.apipost.cn/new_www/index_img/apipost-logo_or.svg" />
281
+ <div class="apipost-report-wrap"></div>
282
+ </div>
283
+
284
+ <script type="text/html" id="tpl">
285
+ <div class="apipost-report-wrap-tpl">
286
+ <h1>{{value.report_name}}</h1>
287
+ <div class="report-info">
288
+ <div class="report-item">
289
+ <span class="label">测试用例/测试套件:</span>
290
+ <span class="value">{{value.report_name}}</span>
291
+ </div>
292
+ <div class="report-item">
293
+ <span class="label">测试时间:</span>
294
+ <span class="value">{{value.start_time}}</span>
295
+ </div>
296
+ <div class="report-item">
297
+ <span class="label">测试工具:</span>
298
+ <span class="value"><a href="https://www.apipost.cn/download.html">apipost客户端</a></span>
299
+ </div>
300
+ </div>
301
+ <div class="dashed"></div>
302
+
303
+ <div class="report-title">
304
+ <img src="https://img.cdn.apipost.cn/cdn/test-report/img/doc.png" alt="" />
305
+ <span class="title">测试结果</span>
306
+ </div>
307
+ <div class="chart-wrap">
308
+ <div class="api">
309
+ <div id="api-pie"></div>
310
+ <div class="api-des">
311
+ <span class="api-title">接口</span>
312
+ <span class="api-label"
313
+ >接口通过率:{{formatRate({ passed: value?.http?.passed, failure:
314
+ value?.http?.failure }, value?.http?.passed)}}</span
315
+ >
316
+ <span class="api-label"
317
+ >接口失败率:{{formatRate({ passed: value?.http?.passed, failure:
318
+ value?.http?.failure }, value?.http?.failure)}}</span
319
+ >
320
+ </div>
321
+ </div>
322
+ <div class="api">
323
+ <div id="assert-pie"></div>
324
+ <div class="api-des">
325
+ <span class="api-title">断言</span>
326
+ <span class="api-label"
327
+ >断言通过率:{{formatRate({ passed: value?.assert?.passed, failure:
328
+ value?.assert?.failure }, value?.assert?.passed)}}</span
329
+ >
330
+ <span class="api-label"
331
+ >断言失败率:{{formatRate({ passed: value?.assert?.passed, failure:
332
+ value?.assert?.failure }, value?.assert?.failure)}}</span
333
+ >
334
+ </div>
335
+ </div>
336
+ </div>
337
+ <div class="report-table">
338
+ <table>
339
+ <thead>
340
+ <tr>
341
+ <th></th>
342
+ <th>请求总数</th>
343
+ <th>通过</th>
344
+ <th>失败</th>
345
+ </tr>
346
+ </thead>
347
+ <tbody>
348
+ <tr>
349
+ <td>接口</td>
350
+ <td>{{value.http.failure + value.http.passed}}</td>
351
+ <td>{{value.http.passed}}</td>
352
+ <td>{{value.http.failure}}</td>
353
+ </tr>
354
+ <tr>
355
+ <td>断言</td>
356
+ <td>{{value.assert.failure + value.assert.passed}}</td>
357
+ <td>{{value.assert.passed}}</td>
358
+ <td>{{value.assert.failure}}</td>
359
+ </tr>
360
+ </tbody>
361
+ </table>
362
+ </div>
363
+
364
+ <div class="report-info-list">
365
+ <div class="report-info-item">
366
+ <span>开始时间 : {{value.start_time}}</span>
367
+ </div>
368
+ <div class="report-info-item">
369
+ <span>结束时间 : {{value.end_time}}</span>
370
+ </div>
371
+ <div class="report-info-item">
372
+ <span>总耗时 : {{value.long_time}}</span>
373
+ </div>
374
+ <div class="report-info-item">
375
+ <span>总响应时间 : {{value.total_response_time}}ms</span>
376
+ </div>
377
+ <div class="report-info-item">
378
+ <span>平均响应时间 : {{value.average_response_time}}ms</span>
379
+ </div>
380
+ <div class="report-info-item">
381
+ <span>总响应数据大小 : {{value.total_received_data}}kb</span>
382
+ </div>
383
+ <div class="report-info-item">
384
+ <span>未测接口 : {{value.ignore_count}}</span>
385
+ </div>
386
+ </div>
387
+
388
+ <div class="dashed"></div>
389
+ {{if value.type === 'single'}}
390
+ <div class="report-title">
391
+ <img src="https://img.cdn.apipost.cn/cdn/test-report/img/doc.png" alt="" />
392
+ <span class="title">测试情况</span>
393
+ </div>
394
+
395
+ <div class="action-wrap">
396
+ <div class="test-detail failed">
397
+ <div class="toggle-arrow">
398
+ <span class="icon-bg">
399
+ <img src="https://img.cdn.apipost.cn/cdn/test-report/img/arrow.png" class="arrow" alt="" />
400
+ </span>
401
+ <span class="title">失败情况</span>
402
+ </div>
403
+ <div class="test-event-list show">
404
+ {{each value.logList.filter(item => item.http_error === 1 || item.assert_error === 1) item
405
+ key}}
406
+ <div data-text="{{key}}" id="{{key}}" class="test-event-item">
407
+ <div class="panel">
408
+ <img class="status" src="https://img.cdn.apipost.cn/cdn/test-report/img/error.png" alt="" />
409
+ <div class="index">{{key + 1}}</div>
410
+ <div class="method">{{item?.request?.method}}</div>
411
+ <span class="name">{{item?.request?.name}}</span>
412
+ <div class="link">
413
+ <a href="{{item?.request?.url}}">{{item?.request?.url}}</a>
414
+ </div>
415
+ </div>
416
+ <div class="item-info">
417
+ <span>请求状况:{{(item?.http_error === 1) ? '失败' : '成功'}}</span>
418
+ <span>状态码:{{item?.response?.data?.response?.code}}</span>
419
+ <span>响应时间:{{item?.response?.data?.response?.responseTime}}ms</span>
420
+ <span>响应数据大小:{{item?.response?.data?.response?.responseSize}}kb</span>
421
+ </div>
422
+ {{if item?.assert && item?.assert.length > 0}}
423
+ <div class="assert-info">
424
+ <span class="assert-label">断言:</span>
425
+ <div class="response-panel">
426
+ {{each item?.assert assert cKey}} {{if assert.status === 'error'}}
427
+ <div class="error">
428
+ <img src="https://img.cdn.apipost.cn/cdn/test-report/img/error.png" alt="" />
429
+ <span>{{assert?.expect}}</span>
430
+ </div>
431
+ {{/if}} {{if assert.status !== 'error'}}
432
+ <div class="success">
433
+ <img src="https://img.cdn.apipost.cn/cdn/test-report/img/success.png" alt="" />
434
+ <span>{{assert?.expect}}</span>
435
+ </div>
436
+ {{/if}} {{/each}}
437
+ </div>
438
+ </div>
439
+ {{/if}}
440
+ </div>
441
+ {{/each}}
442
+ </div>
443
+ </div>
444
+ <div class="dashed"></div>
445
+ <div class="test-detail success">
446
+ <div class="toggle-arrow">
447
+ <span class="icon-bg">
448
+ <img src="https://img.cdn.apipost.cn/cdn/test-report/img/arrow.png" alt="" />
449
+ </span>
450
+ <span class="title">测试详情</span>
451
+ </div>
452
+ <div class="test-event-list show">
453
+ {{each value.logList item key}}
454
+ <div data-text="{{key}}" id="{{key}}" class="test-event-item">
455
+ <div class="panel">
456
+ {{if item.http_error === -1 && item.assert_error === -1}}
457
+ <img class="status" src="https://img.cdn.apipost.cn/cdn/test-report/img/success.png" alt="" />
458
+ {{/if}} {{if item.http_error === 1 || item.assert_error === 1}}
459
+ <img class="status" src="https://img.cdn.apipost.cn/cdn/test-report/img/error.png" alt="" />
460
+ {{/if}}
461
+
462
+ <div class="index">{{key + 1}}</div>
463
+ <div class="method">{{item?.request?.method}}</div>
464
+ <span class="name">{{item?.request?.name}}</span>
465
+ <div class="link">
466
+ <a href="{{item?.request?.url}}">{{item?.request?.url}}</a>
467
+ </div>
468
+ </div>
469
+ <div class="item-info">
470
+ <span>请求状况:{{(item?.http_error === 1) ? '失败' : '成功'}}</span>
471
+ <span>状态码:{{item?.response?.data?.response?.code}}</span>
472
+ <span>响应时间:{{item?.response?.data?.response?.responseTime}}ms</span>
473
+ <span>响应数据大小:{{item?.response?.data?.response?.responseSize}}kb</span>
474
+ </div>
475
+ {{if item?.assert && item?.assert.length > 0}}
476
+ <div class="assert-info">
477
+ <span class="assert-label">断言:</span>
478
+ <div class="response-panel">
479
+ {{each item?.assert assert cKey}}
480
+ {{if assert.status === 'error'}}
481
+ <div class="error">
482
+ <img src="https://img.cdn.apipost.cn/cdn/test-report/img/error.png" alt="" />
483
+ <span>{{assert?.expect}}</span>
484
+ </div>
485
+ {{/if}}
486
+ {{if assert.status !== 'error'}}
487
+ <div class="success">
488
+ <img src="https://img.cdn.apipost.cn/cdn/test-report/img/success.png" alt="" />
489
+ <span>{{assert?.expect}}</span>
490
+ </div>
491
+ {{/if}} {{/each}}
492
+ </div>
493
+ </div>
494
+ {{/if}}
495
+ </div>
496
+ {{/each}}
497
+ </div>
498
+ </div>
499
+ </div>
500
+ {{/if}}
501
+ {{if value.type === 'combined'}}
502
+ {{each value.children child childKey}}
503
+ <div data-text="{{childKey}}" id="{{childKey}}">
504
+ <div class="report-title">
505
+ <img src="https://img.cdn.apipost.cn/cdn/test-report/img/doc.png" alt="" />
506
+ <span class="title">{{child?.report_name}}_测试情况</span>
507
+ </div>
508
+
509
+ <div class="action-wrap">
510
+ <div class="test-detail failed">
511
+ <div class="toggle-arrow">
512
+ <span class="icon-bg">
513
+ <img src="https://img.cdn.apipost.cn/cdn/test-report/img/arrow.png" class="arrow" alt="" />
514
+ </span>
515
+ <span class="title">失败情况</span>
516
+ </div>
517
+ <div class="test-event-list show">
518
+ {{each value.logList.filter(item => (item.http_error === 1 || item.assert_error === 1) && item.test_id === child.test_id) item
519
+ key}}
520
+ <div data-text="{{key}}" id="{{key}}" class="test-event-item">
521
+ <div class="panel">
522
+ <img class="status" src="https://img.cdn.apipost.cn/cdn/test-report/img/error.png" alt="" />
523
+ <div class="index">{{key + 1}}</div>
524
+ <div class="method">{{item?.request?.method}}</div>
525
+ <span class="name">{{item?.request?.name}}</span>
526
+ <div class="link">
527
+ <a href="{{item?.request?.url}}">{{item?.request?.url}}</a>
528
+ </div>
529
+ </div>
530
+ <div class="item-info">
531
+ <span>请求状况:{{(item?.http_error === 1) ? '失败' : '成功'}}</span>
532
+ <span>状态码:{{item?.response?.data?.response?.code}}</span>
533
+ <span>响应时间:{{item?.response?.data?.response?.responseTime}}ms</span>
534
+ <span>响应数据大小:{{item?.response?.data?.response?.responseSize}}kb</span>
535
+ </div>
536
+ {{if item?.assert && item?.assert.length > 0}}
537
+ <div class="assert-info">
538
+ <span class="assert-label">断言:</span>
539
+ <div class="response-panel">
540
+ {{each item?.assert assert cKey}} {{if assert.status === 'error'}}
541
+ <div class="error">
542
+ <img src="https://img.cdn.apipost.cn/cdn/test-report/img/error.png" alt="" />
543
+ <span>{{assert?.expect}}</span>
544
+ </div>
545
+ {{/if}} {{if assert.status !== 'error'}}
546
+ <div class="success">
547
+ <img src="https://img.cdn.apipost.cn/cdn/test-report/img/success.png" alt="" />
548
+ <span>{{assert?.expect}}</span>
549
+ </div>
550
+ {{/if}} {{/each}}
551
+ </div>
552
+ </div>
553
+ {{/if}}
554
+ </div>
555
+ {{/each}}
556
+ </div>
557
+ </div>
558
+ <div class="dashed"></div>
559
+ <div class="test-detail success">
560
+ <div class="toggle-arrow">
561
+ <span class="icon-bg">
562
+ <img src="https://img.cdn.apipost.cn/cdn/test-report/img/arrow.png" alt="" />
563
+ </span>
564
+ <span class="title">测试详情</span>
565
+ </div>
566
+ <div class="test-event-list show">
567
+ {{each value.logList.filter(item => item.test_id === child.test_id) item key}}
568
+ <div data-text="{{key}}" id="{{key}}" class="test-event-item">
569
+ <div class="panel">
570
+ {{if item.http_error === -1 && item.assert_error === -1}}
571
+ <img class="status" src="https://img.cdn.apipost.cn/cdn/test-report/img/success.png" alt="" />
572
+ {{/if}} {{if item.http_error === 1 || item.assert_error === 1}}
573
+ <img class="status" src="https://img.cdn.apipost.cn/cdn/test-report/img/error.png" alt="" />
574
+ {{/if}}
575
+
576
+ <div class="index">{{key + 1}}</div>
577
+ <div class="method">{{item?.request?.method}}</div>
578
+ <span class="name">{{item?.request?.name}}</span>
579
+ <div class="link">
580
+ <a href="{{item?.request?.url}}">{{item?.request?.url}}</a>
581
+ </div>
582
+ </div>
583
+ <div class="item-info">
584
+ <span>请求状况:{{(item?.http_error === 1) ? '失败' : '成功'}}</span>
585
+ <span>状态码:{{item?.response?.data?.response?.code}}</span>
586
+ <span>响应时间:{{item?.response?.data?.response?.responseTime}}ms</span>
587
+ <span>响应数据大小:{{item?.response?.data?.response?.responseSize}}kb</span>
588
+ </div>
589
+ {{if item?.assert && item?.assert.length > 0}}
590
+ <div class="assert-info">
591
+ <span class="assert-label">断言:</span>
592
+ <div class="response-panel">
593
+ {{each item?.assert assert cKey}}
594
+ {{if assert.status === 'error'}}
595
+ <div class="error">
596
+ <img src="https://img.cdn.apipost.cn/cdn/test-report/img/error.png" alt="" />
597
+ <span>{{assert?.expect}}</span>
598
+ </div>
599
+ {{/if}}
600
+ {{if assert.status !== 'error'}}
601
+ <div class="success">
602
+ <img src="https://img.cdn.apipost.cn/cdn/test-report/img/success.png" alt="" />
603
+ <span>{{assert?.expect}}</span>
604
+ </div>
605
+ {{/if}} {{/each}}
606
+ </div>
607
+ </div>
608
+ {{/if}}
609
+ </div>
610
+ {{/each}}
611
+ </div>
612
+ </div>
613
+ </div>
614
+ </div>
615
+ {{/each}}
616
+ {{/if}}
617
+ </div>
618
+ </script>
619
+
620
+ <script>
621
+ template.defaults.imports.formatRate = function (info, per) {
622
+ if (
623
+ typeof info.passed !== 'number' ||
624
+ typeof info.failure !== 'number' ||
625
+ info?.passed + info?.failure === 0
626
+ ) {
627
+ return '0%';
628
+ }
629
+ if (typeof per === 'number') {
630
+ return ((per / (info?.passed + info?.failure)) * 100).toFixed(2) + '%';
631
+ }
632
+ return '-';
633
+ };
634
+
635
+ const data = {"combined_id":"0","report_id":"","report_name":"apipost测试报告","env_id":"-1","env_name":"默认环境","env_pre_url":"","user":{"role":2,"nick_name":"wenjin","email":null,"portrait":"https://img.cdn.apipost.cn/user/default_profile_photo/Vector-6.png","is_manager":1,"uuid":"UL4XWF681351","is_super_admin":1,"project_id":"2626cf41-5fa4-4780-87ab-4b1c2cecd0ba","id":"2626cf41-5fa4-4780-87ab-4b1c2cecd0ba/UL4XWF681351"},"total_count":1,"total_effective_count":1,"ignore_count":0,"total_received_data":0.29,"total_response_time":218,"average_response_time":218,"http_errors":[],"assert_errors":[],"ignore_errors":[],"http":{"passed":1,"passed_per":1,"failure":0,"failure_per":0},"assert":{"passed":0,"passed_per":0,"failure":0,"failure_per":0},"start_time":"2024-01-11 10:45:07","end_time":"2024-01-11 10:45:07","long_time":"0.26 秒","children":[],"type":"single","test_id":"ed7c2d8c-1d2d-4e1c-9574-8aaa4986d793","event_status":{"dad321dd-e63c-486e-b8e1-e719bc7b52c6":"passed"},"test_events":[{"event_id":"dad321dd-e63c-486e-b8e1-e719bc7b52c6","parent_event_id":"0","data":{"parent_id":"0","target_id":"5f79efaf-843f-49a6-88f3-5e24c6ecaca8","name":"apipost","method":"GET","url":"https://echo.apipost.cn/get.php","request":{"url":"https://echo.apipost.cn/get.php","description":"","auth":{"type":"noauth","kv":{"key":"","value":""},"bearer":{"key":""},"basic":{"username":"","password":""},"digest":{"username":"","password":"","realm":"","nonce":"","algorithm":"","qop":"","nc":"","cnonce":"","opaque":""},"hawk":{"authId":"","authKey":"","algorithm":"","user":"","nonce":"","extraData":"","app":"","delegation":"","timestamp":"","includePayloadHash":-1},"awsv4":{"accessKey":"","secretKey":"","region":"","service":"","sessionToken":"","addAuthDataToQuery":-1},"ntlm":{"username":"","password":"","domain":"","workstation":"","disableRetryRequest":1},"edgegrid":{"accessToken":"","clientToken":"","clientSecret":"","nonce":"","timestamp":"","baseURi":"","headersToSign":""},"oauth1":{"consumerKey":"","consumerSecret":"","signatureMethod":"","addEmptyParamsToSign":-1,"includeBodyHash":-1,"addParamsToHeader":-1,"realm":"","version":"1.0","nonce":"","timestamp":"","verifier":"","callback":"","tokenSecret":"","token":""}},"body":{"mode":"none","parameter":[],"raw":"","raw_para":[],"raw_schema":{"type":"object"}},"event":{"pre_script":"","test":""},"header":{"parameter":[]},"query":{"parameter":[]},"cookie":{"parameter":[]},"resful":{"parameter":[]}}},"enabled":1,"project_id":"2626cf41-5fa4-4780-87ab-4b1c2cecd0ba","sort":1,"test_id":"ed7c2d8c-1d2d-4e1c-9574-8aaa4986d793","type":"api","report_id":"","runtime_status":"passed"}],"logList":[{"test_id":"ed7c2d8c-1d2d-4e1c-9574-8aaa4986d793","parent_id":"0","event_id":"dad321dd-e63c-486e-b8e1-e719bc7b52c6","iteration_id":"e7b8d116-8c2d-46f8-86b4-8be4275dae0b","type":"api","target_id":"5f79efaf-843f-49a6-88f3-5e24c6ecaca8","request":{"parent_id":"0","target_id":"5f79efaf-843f-49a6-88f3-5e24c6ecaca8","name":"apipost","method":"GET","url":"https://echo.apipost.cn/get.php","request":{"url":"https://echo.apipost.cn/get.php","description":"","auth":{"type":"noauth","kv":{"key":"","value":""},"bearer":{"key":""},"basic":{"username":"","password":""},"digest":{"username":"","password":"","realm":"","nonce":"","algorithm":"","qop":"","nc":"","cnonce":"","opaque":""},"hawk":{"authId":"","authKey":"","algorithm":"","user":"","nonce":"","extraData":"","app":"","delegation":"","timestamp":"","includePayloadHash":-1},"awsv4":{"accessKey":"","secretKey":"","region":"","service":"","sessionToken":"","addAuthDataToQuery":-1},"ntlm":{"username":"","password":"","domain":"","workstation":"","disableRetryRequest":1},"edgegrid":{"accessToken":"","clientToken":"","clientSecret":"","nonce":"","timestamp":"","baseURi":"","headersToSign":""},"oauth1":{"consumerKey":"","consumerSecret":"","signatureMethod":"","addEmptyParamsToSign":-1,"includeBodyHash":-1,"addParamsToHeader":-1,"realm":"","version":"1.0","nonce":"","timestamp":"","verifier":"","callback":"","tokenSecret":"","token":""}},"body":{"mode":"none","parameter":[],"raw":"","raw_para":[],"raw_schema":{"type":"object"}},"event":{"pre_script":"","test":""},"header":{"parameter":[{"key":"cookie","value":"httponly-cookie=httponly-value;cookie-test8=renge==;-/?","description":"","not_null":1,"field_type":"String","type":"Text","is_checked":1}]},"query":{"parameter":[]},"cookie":{"parameter":[]},"resful":{"parameter":[]}}},"response":{"status":"success","message":"success","data":{"request":{"url":"https://echo.apipost.cn/get.php","uri":{"slashes":true,"protocol":"https:","hash":"","query":"","pathname":"/get.php","auth":"","host":"echo.apipost.cn","port":"","hostname":"echo.apipost.cn","password":"","username":"","origin":"https://echo.apipost.cn","href":"https://echo.apipost.cn/get.php"},"method":"GET","timeout":0,"contentType":"none","header":[{"key":"User-Agent","value":"PostmanRuntime-ApipostRuntime/1.1.0"},{"key":"Cache-Control","value":"no-cache"},{"key":"cookie","value":"httponly-cookie=httponly-value;cookie-test8=renge==;-/?"},{"key":"Accept-Encoding","value":"gzip, deflate, br"}],"proxy":null,"request_headers":{"User-Agent":"PostmanRuntime-ApipostRuntime/1.1.0","Cache-Control":"no-cache","cookie":"httponly-cookie=httponly-value;cookie-test8=renge==;-/?","Accept-Encoding":"gzip, deflate, br"},"request_bodys":"","body":{"mode":"none"}},"response":{"target_id":"5f79efaf-843f-49a6-88f3-5e24c6ecaca8","responseTime":218,"responseSize":0.29,"resposneAt":"10:45:07","netWork":{"agent":"Desktop-Agent","address":{"remote":{"address":"122.114.104.58","family":"IPv4","port":443}}},"status":"OK","code":200,"timingPhases":{"wait":0.7654579877853394,"dns":12.554166913032532,"tcp":25.51754105091095,"firstByte":95.50737500190735,"download":3.731916904449463,"total":218.3376249074936,"secureHandshake":80.26116704940796},"headers":{"Date":"Thu, 11 Jan 2024 02:45:07 GMT","Server":"Apache","X-Powered-By":"PHP/7.1.3","Access-Control-Allow-Origin":"*","Access-Control-Allow-Method":"POST,GET,PUT,DELETE,OPTIONS,OPTION","Access-Control-Allow-Methods":"POST,GET,PUT,DELETE,OPTIONS,OPTION","Access-Control-Allow-Headers":"Content-Type,Content-Length,Accept-Encoding,X-Requested-with, Origin,Authorization","AbCd":"AAhh","Set-Cookie":["security_session_verify=82fe838d61f4fbef59f372e3c8ced4cc; expires=Sun, 14-Jan-24 10:45:07 GMT; path=/; HttpOnly","security_session_verify=82fe838d61f4fbef59f372e3c8ced4cc; expires=Sun, 14-Jan-24 10:45:07 GMT; path=/; HttpOnly","cookie-test1-folder=B; expires=Thu, 11-Jan-2024 03:45:07 GMT; Max-Age=3600; path=/echo; domain=echo.apipost.cn","cookie-test1=0; expires=Thu, 11-Jan-2024 03:45:07 GMT; Max-Age=3600; path=/; domain=echo.apipost.cn","cookie-test2=0; expires=Thu, 11-Jan-2024 03:45:07 GMT; Max-Age=3600; path=/; domain=echo.apipost.cn","cookie-test3=%25E4%25BD%25A0%25E5%25A5%25BD; expires=Thu, 11-Jan-2024 03:45:07 GMT; Max-Age=3600; path=/; domain=echo.apipost.cn","cookie-test4=%E4%BD%A0%E5%A5%BD%3D%3D%3D; expires=Thu, 11-Jan-2024 03:45:07 GMT; Max-Age=3600; path=/; domain=.apipost.cn","cookie-test5=nihao; expires=Thu, 11-Jan-2024 03:45:07 GMT; Max-Age=3600; path=/; domain=apipost.cn","cookie-test6=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; domain=echo.apipost.cn","cookie-test7=0; expires=Thu, 11-Jan-2024 02:15:07 GMT; Max-Age=-1800; path=/; domain=echo.apipost.cn","cookie-test8=renge%3D%3D%3B-%2F%3F","httponly-cookie=httponly-value; HttpOnly","security_session_verify=82fe838d61f4fbef59f372e3c8ced4cc; expires=Sun, 14-Jan-24 10:45:07 GMT; path=/; HttpOnly"],"Strict-Transport-Security":"max-age=63072000; includeSubdomains; preload","Vary":"Accept-Encoding","Content-Encoding":"gzip","Content-Length":"293","Connection":"close","Content-Type":"application/json;charset=utf-8"},"fitForShow":"Monaco","resMime":{"ext":"json","mime":"application/json"},"stream":{"type":"Buffer","data":[120,156,93,144,79,79,195,48,12,197,191,202,228,115,211,173,29,234,186,78,21,170,38,36,142,8,137,19,227,208,165,94,27,145,57,33,73,145,96,218,119,199,253,51,132,184,217,239,217,47,191,248,2,232,156,52,13,66,177,138,134,218,7,7,5,248,94,74,244,30,34,176,198,7,40,94,223,34,104,113,46,28,126,244,120,83,79,74,227,84,217,158,37,224,149,14,235,6,57,229,2,47,30,157,168,90,164,193,121,226,164,115,77,207,61,5,117,70,81,89,53,100,207,237,97,153,196,73,188,226,237,125,45,59,20,123,67,193,25,205,107,100,132,28,164,193,50,230,93,241,107,208,133,96,13,233,47,33,71,165,252,237,63,107,221,227,110,82,69,96,200,188,116,72,45,150,229,78,28,150,247,156,241,56,254,7,80,118,38,174,39,132,88,18,27,21,255,216,6,241,64,124,13,69,45,207,180,223,202,70,139,6,79,186,14,24,45,142,110,68,32,66,25,148,33,30,144,218,120,132,107,4,114,6,187,252,39,251,203,58,178,193,109,120,162,99,127,230,99,99,36,228,11,114,224,81,181,106,56,90,122,151,111,179,117,182,222,228,121,186,77,210,77,150,95,127,0,81,207,143,25]},"resCookies":[{"name":"security_session_verify","value":"82fe838d61f4fbef59f372e3c8ced4cc","expires":"2024-01-14T10:45:07.000Z","path":"/","httpOnly":true,"cookie_id":"66d728db-a433-42e5-a7b8-c32d102e879f"},{"name":"security_session_verify","value":"82fe838d61f4fbef59f372e3c8ced4cc","expires":"2024-01-14T10:45:07.000Z","path":"/","httpOnly":true,"cookie_id":"66d728db-a433-42e5-a7b8-c32d102e879f"},{"name":"cookie-test1-folder","value":"B","expires":"2024-01-11T03:45:07.000Z","maxAge":3600,"path":"/echo","domain":"echo.apipost.cn","cookie_id":"80437402-13bd-4008-8082-3b59e01bebdf","project_id":"2626cf41-5fa4-4780-87ab-4b1c2cecd0ba"},{"name":"cookie-test1","value":"0","expires":"2024-01-11T03:45:07.000Z","maxAge":3600,"path":"/","domain":"echo.apipost.cn","cookie_id":"52d22ab9-1308-414b-aeb2-3d942173b5a7","project_id":"2626cf41-5fa4-4780-87ab-4b1c2cecd0ba"},{"name":"cookie-test2","value":"0","expires":"2024-01-11T03:45:07.000Z","maxAge":3600,"path":"/","domain":"echo.apipost.cn","cookie_id":"a3121834-9482-41b2-8358-e22c66657dc8","project_id":"2626cf41-5fa4-4780-87ab-4b1c2cecd0ba"},{"name":"cookie-test3","value":"%E4%BD%A0%E5%A5%BD","expires":"2024-01-11T03:45:07.000Z","maxAge":3600,"path":"/","domain":"echo.apipost.cn","cookie_id":"555ce4e0-1051-4f81-b600-ea9dad9480d8","project_id":"2626cf41-5fa4-4780-87ab-4b1c2cecd0ba"},{"name":"cookie-test4","value":"你好===","expires":"2024-01-11T03:45:07.000Z","maxAge":3600,"path":"/","domain":".apipost.cn","cookie_id":"356bc883-2ba8-4f2e-bfde-f69e55fd87f8","project_id":"2626cf41-5fa4-4780-87ab-4b1c2cecd0ba"},{"name":"cookie-test5","value":"nihao","expires":"2024-01-11T03:45:07.000Z","maxAge":3600,"path":"/","domain":"apipost.cn","cookie_id":"aee8b885-f917-4ec3-833c-7382c019a51e","project_id":"2626cf41-5fa4-4780-87ab-4b1c2cecd0ba"},{"name":"cookie-test6","value":"deleted","expires":"1970-01-01T00:00:01.000Z","maxAge":0,"path":"/","domain":"echo.apipost.cn","cookie_id":"7f06e348-777d-4163-b3c9-0a8e015ddde1","project_id":"2626cf41-5fa4-4780-87ab-4b1c2cecd0ba"},{"name":"cookie-test7","value":"0","expires":"2024-01-11T02:15:07.000Z","maxAge":-1800,"path":"/","domain":"echo.apipost.cn","cookie_id":"3d5b09d5-d3b4-4c28-a215-5fb23b41cbc3","project_id":"2626cf41-5fa4-4780-87ab-4b1c2cecd0ba"},{"name":"cookie-test8","value":"renge==;-/?","cookie_id":"2305799e-5e58-4071-aa23-d64d1489903e"},{"name":"httponly-cookie","value":"httponly-value","httpOnly":true,"cookie_id":"0506bb58-97f0-49ad-9f5c-fb6fc92daeab"},{"name":"security_session_verify","value":"82fe838d61f4fbef59f372e3c8ced4cc","expires":"2024-01-14T10:45:07.000Z","path":"/","httpOnly":true,"cookie_id":"66d728db-a433-42e5-a7b8-c32d102e879f"}],"filename":"response_5f79efaf-843f-49a6-88f3-5e24c6ecaca8.json"}}},"http_error":-1,"assert":[],"datetime":"2024-01-11 10:45:07","assert_error":-1}]};
636
+ console.log(data, 'data')
637
+
638
+ document.title = data?.report_name || '';
639
+ const _docContentHtml = template('tpl', {
640
+ value: data,
641
+ });
642
+ const oWrap = document.querySelector('.apipost-report-wrap');
643
+ oWrap.innerHTML = _docContentHtml;
644
+
645
+ (() => {
646
+ const oApp = document.querySelector('#app'),
647
+ oTestReport = oApp.querySelector('.apipost-report-wrap'),
648
+ oActionWrap = oTestReport.querySelector('.action-wrap'),
649
+ oTestDetailFailed = oActionWrap.querySelector('.test-detail.failed'),
650
+ oTestDetailSuccess = oActionWrap.querySelector('.test-detail.success');
651
+
652
+ const oTestDetails = document.querySelectorAll('.test-detail');
653
+ let curIndex = 0;
654
+
655
+ const init = () => {
656
+ bindEvent();
657
+ initPie();
658
+ };
659
+
660
+ function bindEvent() {
661
+ Array.from(oTestDetails).forEach(item => {
662
+ item.addEventListener('click', handleToggle.bind(null, item), false)
663
+ })
664
+ }
665
+
666
+ function handleToggle(detailWrap, e) {
667
+ const clickClassName = e.target.className;
668
+ const oTestList = detailWrap.querySelector('.test-event-list');
669
+
670
+ if (oTestList && ['title', 'toggle-arrow', 'arrow'].includes(clickClassName)) {
671
+ const className = oTestList.className;
672
+ if (className.includes('show')) {
673
+ oTestList.className = 'test-event-list hide';
674
+ } else {
675
+ oTestList.className = 'test-event-list show';
676
+ }
677
+ }
678
+ }
679
+
680
+ const computedInfo = (info) => {
681
+ if (info?.passed == 0 && info?.failure == 0) {
682
+ return [{ value: info?.passed, name: '接口通过率' }];
683
+ }
684
+ return [
685
+ { value: info?.passed, name: '接口通过率' },
686
+ { value: info?.failure, name: '接口失败率' },
687
+ ];
688
+ };
689
+
690
+ const getOption = (info, color) => {
691
+ return {
692
+ color: color || ['#26CEA4', 'red'],
693
+ series: [
694
+ {
695
+ name: 'Access From',
696
+ type: 'pie',
697
+ radius: ['50%', '80%'],
698
+ avoidLabelOverlap: false,
699
+ label: {
700
+ show: false,
701
+ position: 'center',
702
+ },
703
+ emphasis: {
704
+ label: {
705
+ show: true,
706
+ fontSize: 5,
707
+ },
708
+ },
709
+ labelLine: {
710
+ show: false,
711
+ },
712
+ data: computedInfo(info),
713
+ },
714
+ ],
715
+ };
716
+ };
717
+ function initPie() {
718
+ const apiPieWrap = document.querySelector('#api-pie');
719
+ const assertPieWrap = document.querySelector('#assert-pie');
720
+
721
+ if (apiPieWrap) {
722
+ const pie = echarts.init(apiPieWrap);
723
+ const options = getOption(
724
+ {
725
+ passed: data?.http?.passed,
726
+ failure: data?.http?.failure,
727
+ },
728
+ ['#26CEA4', '#E45252']
729
+ );
730
+ pie && pie.setOption(options);
731
+ }
732
+ if (assertPieWrap) {
733
+ const pie = echarts.init(assertPieWrap);
734
+ const options = getOption(
735
+ {
736
+ passed: data?.assert?.passed,
737
+ failure: data?.assert?.failure,
738
+ },
739
+ ['#26CEA4', '#E45252']
740
+ );
741
+ pie && pie.setOption(options);
742
+ }
743
+ }
744
+
745
+ init();
746
+ })();
747
+ </script>
748
+ </body>
749
+ </html>
750
+