apipost-cli 1.0.17 → 1.0.18

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.
package/dist/index.js CHANGED
@@ -549500,6 +549500,7 @@ const path = __nccwpck_require__(71017);
549500
549500
  const program = new Command();
549501
549501
  const homedir = os.homedir();
549502
549502
  const request = __nccwpck_require__(48699);
549503
+ const JSON5 = __nccwpck_require__(86904);
549503
549504
  let now = dayjs();
549504
549505
  let formattedTime = now.format('YYYY-MM-DD HH:mm:ss');
549505
549506
 
@@ -549525,7 +549526,7 @@ let last_msg = "";
549525
549526
  const currentWorkingDirectory = process.cwd();
549526
549527
  const cliOption = {
549527
549528
  reporters: 'cli',
549528
- outDir: __nccwpck_require__.ab + "apipost-reports",
549529
+ outDir: path.join(currentWorkingDirectory, "apipost-reports"),
549529
549530
  outFile: '',
549530
549531
  iterationData: '',
549531
549532
  iterationCount: 1,
@@ -549719,9 +549720,11 @@ const parseCommandString = async (url, options) => {
549719
549720
  const data = fs.readFileSync(url, 'utf8');
549720
549721
  runData = JSON.parse(data);
549721
549722
  } catch (err) {
549722
- console.log(`读取本地文件失败, 原因 [${err.message}]`);
549723
- fs.appendFileSync(path.join(homedir, 'apipost-cli-error.log'), `${formattedTime}\t读取本地文件失败, 原因 [${err.message}]\n`);
549724
- return;
549723
+ //尝试修复一次
549724
+
549725
+ console.log(`读取本地文件失败, 原因 [${err.message}]`);
549726
+ fs.appendFileSync(path.join(homedir, 'apipost-cli-error.log'), `${formattedTime}\t读取本地文件失败, 原因 [${err.message}]\n`);
549727
+ return;
549725
549728
  }
549726
549729
  }else{
549727
549730
  //增加https 证书忽略
@@ -549731,7 +549734,7 @@ const parseCommandString = async (url, options) => {
549731
549734
  }
549732
549735
 
549733
549736
  if (_.has(runData, 'code')) {
549734
- if (runData.code === 10000 && _.isObject(_.get(runData, 'data'))) {
549737
+ if (runData.code == 10000 && _.isObject(_.get(runData, 'data'))) {
549735
549738
  runData = _.get(runData, 'data');
549736
549739
  } else {
549737
549740
  console.log(`执行失败, 原因 [${runData.msg}]`);
@@ -549783,6 +549786,15 @@ const bindEvent = (program) => {
549783
549786
  program.parse();
549784
549787
  }
549785
549788
 
549789
+ function fixJsonString(jsonString) {
549790
+ // 正则: 匹配冒号后不是空白符或双引号的任何字符序列
549791
+ const regex = /":([\w|@|\.]+),/g;
549792
+ // 将匹配到的值用双引号括起来
549793
+ const fixedString = jsonString.replace(regex, '":"$1",');
549794
+
549795
+ return fixedString;
549796
+ }
549797
+
549786
549798
  const init = () => {
549787
549799
  bindEvent(program);
549788
549800
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apipost-cli",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "Apipost 命令行运行工具",
5
5
  "main": "./dist/index.js",
6
6
  "files": [
@@ -19,6 +19,7 @@
19
19
  "author": "Apipost Team",
20
20
  "license": "UNLICENSED",
21
21
  "dependencies": {
22
+ "json5": "^2.2.3"
22
23
  },
23
24
  "devDependencies": {
24
25
  "@vercel/ncc": "^0.38.1",
@@ -1,750 +0,0 @@
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":"测试查询角色详细信息测试报告","env_id":"32e2403f-586b-4f99-ac53-0190cedb1918","env_name":"BETA正式","env_pre_url":"http://permission.beta.xfusion.com/interface","env_pre_urls":{"default":"http://permission.beta.xfusion.com/interface"},"user":{"nick_name":"wuyang@xfusion.com","email":"wuyang@xfusion.com","portrait":"https://apipost.xfusion.com/static/user/default_profile_photo/Vector-4.png","openid":"107558763110348","uuid":"5X9DD4E46126","is_admin":1,"is_super_admin":-1,"is_manager":1,"role":2,"project_id":"3ad342a0-44fb-4582-ad00-024e50e1d2f9","id":"3ad342a0-44fb-4582-ad00-024e50e1d2f9/5X9DD4E46126"},"total_count":2,"total_effective_count":2,"ignore_count":0,"total_received_data":0.02,"total_response_time":0,"average_response_time":0,"http_errors":[{"test_id":"e174fa15-cce1-46ab-8c4b-f68a8f3e4d62","parent_id":"0","event_id":"0beac0ae-2721-4cc1-bb39-6a11820f559a","iteration_id":"7e171513-bb0a-40bc-9c28-85d03ff67236","type":"api","target_id":"be109489-837e-47de-9119-7e297ed109b9","request":{"parent_id":"923dc0cf-e919-4bfe-bb9a-a5ef9304cf8d","target_id":"be109489-837e-47de-9119-7e297ed109b9","name":"beta灰度测试应用平铺权限","method":"POST","url":"http://permission.beta.xfusion.com/interface/authenticationservice/valid/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","request":{"url":"http://permission.beta.xfusion.com/interface/authenticationservice/valid/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","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":"json","parameter":[],"raw":"{\r\n\t\"pageNum\": 5,\r\n\t\"pageSize\": 100,\r\n\t\"orderByAsc\": [\"roleId\"]\r\n\r\n}","raw_para":[]},"event":{"pre_script":"","test":""},"header":{"parameter":[{"is_checked":"1","type":"Text","key":"authorization","value":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJiODQyY2VjMGE1ODg0ZTRkOGIyZTRkMGFmMGNhN2VjMCIsImFjY291bnRfdHlwZSI6IklBTV9TRVJWSUNFIiwibmJmIjoxNzA0Njc5NTE4LCJhY2NvdW50X2lkIjoiODcyYzg5NDI4MzlkNGJkMjAxODNjOWU4Njc2YjAwYjMiLCJlbnRlcnByaXNlIjoiMTExMTExMTExMTExMTExMTY2NjY2NjY2NjY2NjY2NjYiLCJpc3MiOiJpYW0iLCJuYW1lIjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJwcm9qZWN0IjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJleHAiOjE3MDQ4NTIzMTgsImlhdCI6MTcwNDc2NTkxOCwianRpIjoiN2E4MmY1NjktZTNiNS00YzUxLWI3MmEtNDQ1NzcwZTgzMDFhIn0.gC2xm9h1kD3ZX40QppHoNXpPa9hrffGuWLrGxw1vBJOi-0zdLCki0DbAjylMF_LmF6fv9hgxjgTv04iFVnJCdiiw95KaC__4iHiz0HJ-hYHFo8oe6_kCtaVxbctpDnKa7z3f69OlOIa-welBJOwJUTAuYuQlYNTPyy324bo6VbE","not_null":"1","description":"","field_type":"Text"},{"is_checked":"1","type":"Text","key":"projectId","value":"b842cec0a5884e4d8b2e4d0af0ca7ec0","not_null":"1","description":"","field_type":"Text"},{"key":"cookie","value":"permissionbeta_interface_sticky=pro_mcls#cluster1_10.25.26.67_31906:3","description":"","not_null":1,"field_type":"String","type":"Text","is_checked":1}]},"query":{"parameter":[{"description":"","is_checked":"1","key":"appSys","type":"Text","not_null":"1","field_type":"Text","value":"d2ddb0d11d4046d89b9c0623836dbd1e"}]},"cookie":{"parameter":[]},"resful":{"parameter":[]},"pre_tasks":[],"post_tasks":[{"type":"pickVars","enabled":1,"data":{"source":"responseJson","variables":[{"name":"roleId","type":"tempVars","expression":"$.result[0].roleId"}]},"id":"cc92a54a-5dee-4d03-8294-cbbdeaf47feb"}]}},"response":{"status":"error","message":"RequestError: getaddrinfo ENOTFOUND permission.beta.xfusion.com[ENOTFOUND]","data":{"error":"RequestError: getaddrinfo ENOTFOUND permission.beta.xfusion.com[ENOTFOUND]","request":{"url":"undefined","timeout":0,"contentType":"none","header":[],"proxy":null,"request_bodys":{"mode":"raw","raw":"{\r\n\t\"pageNum\": 5,\r\n\t\"pageSize\": 100,\r\n\t\"orderByAsc\": [\"roleId\"]\r\n\r\n}","options":{"raw":{"language":"json"}}},"body":{"mode":"raw","raw":"{\r\n\t\"pageNum\": 5,\r\n\t\"pageSize\": 100,\r\n\t\"orderByAsc\": [\"roleId\"]\r\n\r\n}","options":{"raw":{"language":"json"}}}},"response":{"target_id":"be109489-837e-47de-9119-7e297ed109b9","responseTime":"0.00","responseSize":0.01,"resposneAt":"20:12:49","netWork":{"agent":null,"address":{"remote":{}}},"status":"OK","code":200,"timingPhases":{},"resHeaders":{},"headers":{},"header":[],"rawCookies":[],"resCookies":[],"cookies":{},"rawBody":"undefined","stream":{"type":"Buffer"},"fitForShow":"Monaco","resMime":{"ext":"json","mime":"application/json"},"raw":{"type":"json","responseText":"undefined"},"json":{},"filename":""}}},"http_error":1,"assert":[],"datetime":"2024-01-22 20:12:49","assert_error":-1},{"test_id":"e174fa15-cce1-46ab-8c4b-f68a8f3e4d62","parent_id":"0","event_id":"285d622c-26b8-4c1c-92b2-ee82f470b832","iteration_id":"0862ad13-abd4-4e74-987d-7453000eee3a","type":"api","target_id":"8e016d21-a27d-430c-bd2d-4e050ae443de","request":{"parent_id":"d36a4e00-9fa4-4515-9e99-5ff9e14e6789","target_id":"8e016d21-a27d-430c-bd2d-4e050ae443de","name":"根据id查询角色信息","method":"POST","url":"http://permission.beta.xfusion.com/interface/authenticationservice/role/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","request":{"url":"http://permission.beta.xfusion.com/interface/authenticationservice/role/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","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":"json","parameter":[],"raw":"{\n\t\"pageNum\": 1,\n\t\"pageSize\": 100,\n\t\"pageFilter\": [\n\t\t{\n\t\t\t\"column\": \".id\",\n\t\t\t\"value\": \"{{roleId}}\",\n\t\t\t\"filterType\": 1\n\t\t}\n\t]\n}","raw_para":[]},"event":{"pre_script":"","test":""},"header":{"parameter":[{"description":"","field_type":"String","is_checked":1,"key":"projectId","value":"b842cec0a5884e4d8b2e4d0af0ca7ec0","not_null":1,"type":"Text"},{"description":"","field_type":"String","is_checked":1,"key":"authorization","value":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJiODQyY2VjMGE1ODg0ZTRkOGIyZTRkMGFmMGNhN2VjMCIsImFjY291bnRfdHlwZSI6IklBTV9TRVJWSUNFIiwibmJmIjoxNzA0Njc5NTE4LCJhY2NvdW50X2lkIjoiODcyYzg5NDI4MzlkNGJkMjAxODNjOWU4Njc2YjAwYjMiLCJlbnRlcnByaXNlIjoiMTExMTExMTExMTExMTExMTY2NjY2NjY2NjY2NjY2NjYiLCJpc3MiOiJpYW0iLCJuYW1lIjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJwcm9qZWN0IjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJleHAiOjE3MDQ4NTIzMTgsImlhdCI6MTcwNDc2NTkxOCwianRpIjoiN2E4MmY1NjktZTNiNS00YzUxLWI3MmEtNDQ1NzcwZTgzMDFhIn0.gC2xm9h1kD3ZX40QppHoNXpPa9hrffGuWLrGxw1vBJOi-0zdLCki0DbAjylMF_LmF6fv9hgxjgTv04iFVnJCdiiw95KaC__4iHiz0HJ-hYHFo8oe6_kCtaVxbctpDnKa7z3f69OlOIa-welBJOwJUTAuYuQlYNTPyy324bo6VbE","not_null":1,"type":"Text"},{"key":"cookie","value":"permissionbeta_interface_sticky=pro_mcls#cluster1_10.25.26.67_31906:3","description":"","not_null":1,"field_type":"String","type":"Text","is_checked":1}]},"query":{"parameter":[{"description":"","is_checked":1,"key":"appSys","type":"Text","not_null":1,"field_type":"String","value":"d2ddb0d11d4046d89b9c0623836dbd1e"}]},"cookie":{"parameter":[]},"resful":{"parameter":[]},"pre_tasks":[],"post_tasks":[]}},"response":{"status":"error","message":"RequestError: getaddrinfo ENOTFOUND permission.beta.xfusion.com[ENOTFOUND]","data":{"error":"RequestError: getaddrinfo ENOTFOUND permission.beta.xfusion.com[ENOTFOUND]","request":{"url":"undefined","timeout":0,"contentType":"none","header":[],"proxy":null,"request_bodys":{"mode":"raw","raw":"{\n\t\"pageNum\": 1,\n\t\"pageSize\": 100,\n\t\"pageFilter\": [\n\t\t{\n\t\t\t\"column\": \".id\",\n\t\t\t\"value\": \"{{roleId}}\",\n\t\t\t\"filterType\": 1\n\t\t}\n\t]\n}","options":{"raw":{"language":"json"}}},"body":{"mode":"raw","raw":"{\n\t\"pageNum\": 1,\n\t\"pageSize\": 100,\n\t\"pageFilter\": [\n\t\t{\n\t\t\t\"column\": \".id\",\n\t\t\t\"value\": \"{{roleId}}\",\n\t\t\t\"filterType\": 1\n\t\t}\n\t]\n}","options":{"raw":{"language":"json"}}}},"response":{"target_id":"8e016d21-a27d-430c-bd2d-4e050ae443de","responseTime":"0.00","responseSize":0.01,"resposneAt":"20:12:49","netWork":{"agent":null,"address":{"remote":{}}},"status":"OK","code":200,"timingPhases":{},"resHeaders":{},"headers":{},"header":[],"rawCookies":[],"resCookies":[],"cookies":{},"rawBody":"undefined","stream":{"type":"Buffer"},"fitForShow":"Monaco","resMime":{"ext":"json","mime":"application/json"},"raw":{"type":"json","responseText":"undefined"},"json":{},"filename":""}}},"http_error":1,"assert":[],"datetime":"2024-01-22 20:12:49","assert_error":-1}],"assert_errors":[],"ignore_errors":[],"http":{"passed":0,"passed_per":0,"failure":2,"failure_per":1},"assert":{"passed":0,"passed_per":0,"failure":0,"failure_per":0},"start_time":"2024-01-22 20:12:49","end_time":"2024-01-22 20:12:49","long_time":"0.04 秒","children":[],"type":"single","test_id":"e174fa15-cce1-46ab-8c4b-f68a8f3e4d62","event_status":{"0beac0ae-2721-4cc1-bb39-6a11820f559a":"failure","285d622c-26b8-4c1c-92b2-ee82f470b832":"failure"},"test_events":[{"event_id":"0beac0ae-2721-4cc1-bb39-6a11820f559a","parent_event_id":"0","data":{"parent_id":"923dc0cf-e919-4bfe-bb9a-a5ef9304cf8d","target_id":"be109489-837e-47de-9119-7e297ed109b9","name":"beta灰度测试应用平铺权限","method":"POST","url":"/authenticationservice/valid/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","request":{"url":"/authenticationservice/valid/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","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":"json","parameter":[],"raw":"{\r\n\t\"pageNum\": 5,\r\n\t\"pageSize\": 100,\r\n\t\"orderByAsc\": [\"roleId\"]\r\n\r\n}","raw_para":[]},"event":{"pre_script":"","test":""},"header":{"parameter":[{"is_checked":"1","type":"Text","key":"authorization","value":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJiODQyY2VjMGE1ODg0ZTRkOGIyZTRkMGFmMGNhN2VjMCIsImFjY291bnRfdHlwZSI6IklBTV9TRVJWSUNFIiwibmJmIjoxNzA0Njc5NTE4LCJhY2NvdW50X2lkIjoiODcyYzg5NDI4MzlkNGJkMjAxODNjOWU4Njc2YjAwYjMiLCJlbnRlcnByaXNlIjoiMTExMTExMTExMTExMTExMTY2NjY2NjY2NjY2NjY2NjYiLCJpc3MiOiJpYW0iLCJuYW1lIjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJwcm9qZWN0IjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJleHAiOjE3MDQ4NTIzMTgsImlhdCI6MTcwNDc2NTkxOCwianRpIjoiN2E4MmY1NjktZTNiNS00YzUxLWI3MmEtNDQ1NzcwZTgzMDFhIn0.gC2xm9h1kD3ZX40QppHoNXpPa9hrffGuWLrGxw1vBJOi-0zdLCki0DbAjylMF_LmF6fv9hgxjgTv04iFVnJCdiiw95KaC__4iHiz0HJ-hYHFo8oe6_kCtaVxbctpDnKa7z3f69OlOIa-welBJOwJUTAuYuQlYNTPyy324bo6VbE","not_null":"1","description":"","field_type":"Text"},{"is_checked":"1","type":"Text","key":"projectId","value":"b842cec0a5884e4d8b2e4d0af0ca7ec0","not_null":"1","description":"","field_type":"Text"},{"is_checked":-1,"type":"Text","key":"X-HW-ID","value":"b842cec0a5884e4d8b2e4d0af0ca7ec0","not_null":"1","description":"","field_type":"Text"},{"is_checked":-1,"type":"Text","key":"X-HW-APPKEY","value":"crvv4XIlBNKnRx48OJNoRQ==","not_null":"1","description":"","field_type":"Text"}]},"query":{"parameter":[{"description":"","is_checked":"1","key":"appSys","type":"Text","not_null":"1","field_type":"Text","value":"d2ddb0d11d4046d89b9c0623836dbd1e"}]},"cookie":{"parameter":[]},"resful":{"parameter":[]},"pre_tasks":[],"post_tasks":[{"type":"pickVars","enabled":1,"data":{"source":"responseJson","variables":[{"name":"roleId","type":"tempVars","expression":"$.result[0].roleId"}]},"id":"cc92a54a-5dee-4d03-8294-cbbdeaf47feb"}]}},"enabled":1,"project_id":"3ad342a0-44fb-4582-ad00-024e50e1d2f9","sort":1,"test_id":"e174fa15-cce1-46ab-8c4b-f68a8f3e4d62","type":"api","report_id":"","runtime_status":"failure"},{"event_id":"285d622c-26b8-4c1c-92b2-ee82f470b832","parent_event_id":"0","data":{"parent_id":"d36a4e00-9fa4-4515-9e99-5ff9e14e6789","target_id":"8e016d21-a27d-430c-bd2d-4e050ae443de","name":"根据id查询角色信息","method":"POST","url":"/authenticationservice/role/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","request":{"url":"/authenticationservice/role/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","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":"json","parameter":[],"raw":"{\n\t\"pageNum\": 1,\n\t\"pageSize\": 100,\n\t\"pageFilter\": [\n\t\t{\n\t\t\t\"column\": \".id\",\n\t\t\t\"value\": \"{{roleId}}\",\n\t\t\t\"filterType\": 1\n\t\t}\n\t]\n}","raw_para":[]},"event":{"pre_script":"","test":""},"header":{"parameter":[{"description":"","field_type":"String","is_checked":1,"key":"projectId","value":"b842cec0a5884e4d8b2e4d0af0ca7ec0","not_null":1,"type":"Text"},{"description":"","field_type":"String","is_checked":1,"key":"authorization","value":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJiODQyY2VjMGE1ODg0ZTRkOGIyZTRkMGFmMGNhN2VjMCIsImFjY291bnRfdHlwZSI6IklBTV9TRVJWSUNFIiwibmJmIjoxNzA0Njc5NTE4LCJhY2NvdW50X2lkIjoiODcyYzg5NDI4MzlkNGJkMjAxODNjOWU4Njc2YjAwYjMiLCJlbnRlcnByaXNlIjoiMTExMTExMTExMTExMTExMTY2NjY2NjY2NjY2NjY2NjYiLCJpc3MiOiJpYW0iLCJuYW1lIjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJwcm9qZWN0IjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJleHAiOjE3MDQ4NTIzMTgsImlhdCI6MTcwNDc2NTkxOCwianRpIjoiN2E4MmY1NjktZTNiNS00YzUxLWI3MmEtNDQ1NzcwZTgzMDFhIn0.gC2xm9h1kD3ZX40QppHoNXpPa9hrffGuWLrGxw1vBJOi-0zdLCki0DbAjylMF_LmF6fv9hgxjgTv04iFVnJCdiiw95KaC__4iHiz0HJ-hYHFo8oe6_kCtaVxbctpDnKa7z3f69OlOIa-welBJOwJUTAuYuQlYNTPyy324bo6VbE","not_null":1,"type":"Text"},{"is_checked":-1,"type":"Text","key":"X-HW-ID","value":"","not_null":"1","description":"","field_type":"Text"},{"is_checked":-1,"type":"Text","key":"X-HW-APPKEY","value":"","not_null":"1","description":"","field_type":"Text"}]},"query":{"parameter":[{"description":"","is_checked":1,"key":"appSys","type":"Text","not_null":1,"field_type":"String","value":"d2ddb0d11d4046d89b9c0623836dbd1e"}]},"cookie":{"parameter":[]},"resful":{"parameter":[]},"pre_tasks":[],"post_tasks":[]}},"enabled":1,"project_id":"3ad342a0-44fb-4582-ad00-024e50e1d2f9","sort":2,"test_id":"e174fa15-cce1-46ab-8c4b-f68a8f3e4d62","type":"api","report_id":"","runtime_status":"failure"}],"logList":[{"test_id":"e174fa15-cce1-46ab-8c4b-f68a8f3e4d62","parent_id":"0","event_id":"0beac0ae-2721-4cc1-bb39-6a11820f559a","iteration_id":"7e171513-bb0a-40bc-9c28-85d03ff67236","type":"api","target_id":"be109489-837e-47de-9119-7e297ed109b9","request":{"parent_id":"923dc0cf-e919-4bfe-bb9a-a5ef9304cf8d","target_id":"be109489-837e-47de-9119-7e297ed109b9","name":"beta灰度测试应用平铺权限","method":"POST","url":"http://permission.beta.xfusion.com/interface/authenticationservice/valid/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","request":{"url":"http://permission.beta.xfusion.com/interface/authenticationservice/valid/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","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":"json","parameter":[],"raw":"{\r\n\t\"pageNum\": 5,\r\n\t\"pageSize\": 100,\r\n\t\"orderByAsc\": [\"roleId\"]\r\n\r\n}","raw_para":[]},"event":{"pre_script":"","test":""},"header":{"parameter":[{"is_checked":"1","type":"Text","key":"authorization","value":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJiODQyY2VjMGE1ODg0ZTRkOGIyZTRkMGFmMGNhN2VjMCIsImFjY291bnRfdHlwZSI6IklBTV9TRVJWSUNFIiwibmJmIjoxNzA0Njc5NTE4LCJhY2NvdW50X2lkIjoiODcyYzg5NDI4MzlkNGJkMjAxODNjOWU4Njc2YjAwYjMiLCJlbnRlcnByaXNlIjoiMTExMTExMTExMTExMTExMTY2NjY2NjY2NjY2NjY2NjYiLCJpc3MiOiJpYW0iLCJuYW1lIjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJwcm9qZWN0IjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJleHAiOjE3MDQ4NTIzMTgsImlhdCI6MTcwNDc2NTkxOCwianRpIjoiN2E4MmY1NjktZTNiNS00YzUxLWI3MmEtNDQ1NzcwZTgzMDFhIn0.gC2xm9h1kD3ZX40QppHoNXpPa9hrffGuWLrGxw1vBJOi-0zdLCki0DbAjylMF_LmF6fv9hgxjgTv04iFVnJCdiiw95KaC__4iHiz0HJ-hYHFo8oe6_kCtaVxbctpDnKa7z3f69OlOIa-welBJOwJUTAuYuQlYNTPyy324bo6VbE","not_null":"1","description":"","field_type":"Text"},{"is_checked":"1","type":"Text","key":"projectId","value":"b842cec0a5884e4d8b2e4d0af0ca7ec0","not_null":"1","description":"","field_type":"Text"},{"key":"cookie","value":"permissionbeta_interface_sticky=pro_mcls#cluster1_10.25.26.67_31906:3","description":"","not_null":1,"field_type":"String","type":"Text","is_checked":1}]},"query":{"parameter":[{"description":"","is_checked":"1","key":"appSys","type":"Text","not_null":"1","field_type":"Text","value":"d2ddb0d11d4046d89b9c0623836dbd1e"}]},"cookie":{"parameter":[]},"resful":{"parameter":[]},"pre_tasks":[],"post_tasks":[{"type":"pickVars","enabled":1,"data":{"source":"responseJson","variables":[{"name":"roleId","type":"tempVars","expression":"$.result[0].roleId"}]},"id":"cc92a54a-5dee-4d03-8294-cbbdeaf47feb"}]}},"response":{"status":"error","message":"RequestError: getaddrinfo ENOTFOUND permission.beta.xfusion.com[ENOTFOUND]","data":{"error":"RequestError: getaddrinfo ENOTFOUND permission.beta.xfusion.com[ENOTFOUND]","request":{"url":"undefined","timeout":0,"contentType":"none","header":[],"proxy":null,"request_bodys":{"mode":"raw","raw":"{\r\n\t\"pageNum\": 5,\r\n\t\"pageSize\": 100,\r\n\t\"orderByAsc\": [\"roleId\"]\r\n\r\n}","options":{"raw":{"language":"json"}}},"body":{"mode":"raw","raw":"{\r\n\t\"pageNum\": 5,\r\n\t\"pageSize\": 100,\r\n\t\"orderByAsc\": [\"roleId\"]\r\n\r\n}","options":{"raw":{"language":"json"}}}},"response":{"target_id":"be109489-837e-47de-9119-7e297ed109b9","responseTime":"0.00","responseSize":0.01,"resposneAt":"20:12:49","netWork":{"agent":null,"address":{"remote":{}}},"status":"OK","code":200,"timingPhases":{},"resHeaders":{},"headers":{},"header":[],"rawCookies":[],"resCookies":[],"cookies":{},"rawBody":"undefined","stream":{"type":"Buffer"},"fitForShow":"Monaco","resMime":{"ext":"json","mime":"application/json"},"raw":{"type":"json","responseText":"undefined"},"json":{},"filename":""}}},"http_error":1,"assert":[],"datetime":"2024-01-22 20:12:49","assert_error":-1},{"test_id":"e174fa15-cce1-46ab-8c4b-f68a8f3e4d62","parent_id":"0","event_id":"285d622c-26b8-4c1c-92b2-ee82f470b832","iteration_id":"0862ad13-abd4-4e74-987d-7453000eee3a","type":"api","target_id":"8e016d21-a27d-430c-bd2d-4e050ae443de","request":{"parent_id":"d36a4e00-9fa4-4515-9e99-5ff9e14e6789","target_id":"8e016d21-a27d-430c-bd2d-4e050ae443de","name":"根据id查询角色信息","method":"POST","url":"http://permission.beta.xfusion.com/interface/authenticationservice/role/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","request":{"url":"http://permission.beta.xfusion.com/interface/authenticationservice/role/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","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":"json","parameter":[],"raw":"{\n\t\"pageNum\": 1,\n\t\"pageSize\": 100,\n\t\"pageFilter\": [\n\t\t{\n\t\t\t\"column\": \".id\",\n\t\t\t\"value\": \"{{roleId}}\",\n\t\t\t\"filterType\": 1\n\t\t}\n\t]\n}","raw_para":[]},"event":{"pre_script":"","test":""},"header":{"parameter":[{"description":"","field_type":"String","is_checked":1,"key":"projectId","value":"b842cec0a5884e4d8b2e4d0af0ca7ec0","not_null":1,"type":"Text"},{"description":"","field_type":"String","is_checked":1,"key":"authorization","value":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJiODQyY2VjMGE1ODg0ZTRkOGIyZTRkMGFmMGNhN2VjMCIsImFjY291bnRfdHlwZSI6IklBTV9TRVJWSUNFIiwibmJmIjoxNzA0Njc5NTE4LCJhY2NvdW50X2lkIjoiODcyYzg5NDI4MzlkNGJkMjAxODNjOWU4Njc2YjAwYjMiLCJlbnRlcnByaXNlIjoiMTExMTExMTExMTExMTExMTY2NjY2NjY2NjY2NjY2NjYiLCJpc3MiOiJpYW0iLCJuYW1lIjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJwcm9qZWN0IjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJleHAiOjE3MDQ4NTIzMTgsImlhdCI6MTcwNDc2NTkxOCwianRpIjoiN2E4MmY1NjktZTNiNS00YzUxLWI3MmEtNDQ1NzcwZTgzMDFhIn0.gC2xm9h1kD3ZX40QppHoNXpPa9hrffGuWLrGxw1vBJOi-0zdLCki0DbAjylMF_LmF6fv9hgxjgTv04iFVnJCdiiw95KaC__4iHiz0HJ-hYHFo8oe6_kCtaVxbctpDnKa7z3f69OlOIa-welBJOwJUTAuYuQlYNTPyy324bo6VbE","not_null":1,"type":"Text"},{"key":"cookie","value":"permissionbeta_interface_sticky=pro_mcls#cluster1_10.25.26.67_31906:3","description":"","not_null":1,"field_type":"String","type":"Text","is_checked":1}]},"query":{"parameter":[{"description":"","is_checked":1,"key":"appSys","type":"Text","not_null":1,"field_type":"String","value":"d2ddb0d11d4046d89b9c0623836dbd1e"}]},"cookie":{"parameter":[]},"resful":{"parameter":[]},"pre_tasks":[],"post_tasks":[]}},"response":{"status":"error","message":"RequestError: getaddrinfo ENOTFOUND permission.beta.xfusion.com[ENOTFOUND]","data":{"error":"RequestError: getaddrinfo ENOTFOUND permission.beta.xfusion.com[ENOTFOUND]","request":{"url":"undefined","timeout":0,"contentType":"none","header":[],"proxy":null,"request_bodys":{"mode":"raw","raw":"{\n\t\"pageNum\": 1,\n\t\"pageSize\": 100,\n\t\"pageFilter\": [\n\t\t{\n\t\t\t\"column\": \".id\",\n\t\t\t\"value\": \"{{roleId}}\",\n\t\t\t\"filterType\": 1\n\t\t}\n\t]\n}","options":{"raw":{"language":"json"}}},"body":{"mode":"raw","raw":"{\n\t\"pageNum\": 1,\n\t\"pageSize\": 100,\n\t\"pageFilter\": [\n\t\t{\n\t\t\t\"column\": \".id\",\n\t\t\t\"value\": \"{{roleId}}\",\n\t\t\t\"filterType\": 1\n\t\t}\n\t]\n}","options":{"raw":{"language":"json"}}}},"response":{"target_id":"8e016d21-a27d-430c-bd2d-4e050ae443de","responseTime":"0.00","responseSize":0.01,"resposneAt":"20:12:49","netWork":{"agent":null,"address":{"remote":{}}},"status":"OK","code":200,"timingPhases":{},"resHeaders":{},"headers":{},"header":[],"rawCookies":[],"resCookies":[],"cookies":{},"rawBody":"undefined","stream":{"type":"Buffer"},"fitForShow":"Monaco","resMime":{"ext":"json","mime":"application/json"},"raw":{"type":"json","responseText":"undefined"},"json":{},"filename":""}}},"http_error":1,"assert":[],"datetime":"2024-01-22 20:12:49","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
-