runner-runtime 1.0.45 → 1.0.47

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/events/api.js CHANGED
@@ -9,7 +9,7 @@ const FileType = require("file-type"),
9
9
  tough = require("tough-cookie"),
10
10
  Buffer = require("buffer/").Buffer,
11
11
  isImage = require("is-image");
12
- const { getAPIFromCollection, smartUrlJoin, replace2RegExp, getParentTargetIDs,encodeURIComponentUnique, base64toCacheFile, getInsideVariables, getCaseInsensitive, camelCaseToSnakeCase } = require('../libs/utils'),
12
+ const { getAPIFromCollection, smartUrlJoin, jsfGenerate, replace2RegExp, getParentTargetIDs, encodeURIComponentUnique, base64toCacheFile, getInsideVariables, getCaseInsensitive, camelCaseToSnakeCase } = require('../libs/utils'),
13
13
  { generateHarFromRequest } = require('../libs/2har'),
14
14
 
15
15
  _ = require('lodash');
@@ -38,6 +38,8 @@ const convert2PostmanRequest = (request, option) => {
38
38
  }
39
39
  };
40
40
 
41
+ const { lang } = option;
42
+
41
43
  // 处理 url
42
44
  const raw = autoReplaceMockVar(_.get(request, "request.url") || _.get(request, "url"));
43
45
  const uri = new Url(raw);
@@ -53,10 +55,17 @@ const convert2PostmanRequest = (request, option) => {
53
55
  );
54
56
  _.forEach(_.get(request, "request.query.parameter"), (item) => {
55
57
  if (_.isObject(item) && item?.is_checked > 0) {
56
- let { key, value } = item;
58
+ let { key, value, schema } = item;
57
59
  key = String(autoReplaceMockVar(_.trim(key)));
58
60
  value = String(autoReplaceMockVar(value));
59
61
 
62
+ if (value == '' && _.isObject(schema)) {
63
+ const tmpValue = jsfGenerate(schema, [], option?.lang);
64
+
65
+ if (!_.isUndefined(tmpValue)) {
66
+ value = tmpValue;
67
+ }
68
+ }
60
69
  if (key != "") {
61
70
  if (value == "" && queryAddEqual < 1) {
62
71
  // 不拼接 = 号
@@ -85,10 +94,18 @@ const convert2PostmanRequest = (request, option) => {
85
94
  _.forEach(
86
95
  _.get(request, "request.restful.parameter"), (item) => {
87
96
  if (_.isObject(item) && item?.is_checked > 0) {
88
- let { key, value } = item;
97
+ let { key, value, schema } = item;
89
98
  key = autoReplaceMockVar(_.trim(key));
90
99
  value = autoReplaceMockVar(value);
91
100
 
101
+ if (value == '' && _.isObject(schema)) {
102
+ const tmpValue = jsfGenerate(schema, [], option?.lang);
103
+
104
+ if (!_.isUndefined(tmpValue)) {
105
+ value = tmpValue;
106
+ }
107
+ }
108
+
92
109
  if (key != "") {
93
110
  uriVariable.push({ key, value });
94
111
  }
@@ -258,9 +275,17 @@ const convert2PostmanRequest = (request, option) => {
258
275
  _.forEach(_.get(request, "request.header.parameter"), (item) => {
259
276
  if (_.isObject(item) && item?.is_checked > 0) {
260
277
  let disabled = item?.is_checked > 0 ? false : true;
261
- let { key, value } = item;
278
+ let { key, value, schema } = item;
262
279
  key = autoReplaceMockVar(_.trim(key));
263
280
  value = autoReplaceMockVar(value);
281
+
282
+ if (value == '' && _.isObject(schema)) {
283
+ const tmpValue = jsfGenerate(schema, [], option?.lang);
284
+
285
+ if (!_.isUndefined(tmpValue)) {
286
+ value = tmpValue;
287
+ }
288
+ }
264
289
  key != "" && header.push({ key, value, disabled });
265
290
  }
266
291
  }
@@ -344,6 +369,14 @@ const convert2PostmanRequest = (request, option) => {
344
369
 
345
370
  let value = autoReplaceMockVar(item.value);
346
371
 
372
+ if (value == '' && _.isObject(item?.schema)) {
373
+ const tmpValue = jsfGenerate(item?.schema, [], option?.lang);
374
+
375
+ if (!_.isUndefined(tmpValue)) {
376
+ value = tmpValue;
377
+ }
378
+ }
379
+
347
380
  if (_.isUndefined(_.get(request, "request.cookie.cookie_encode")) || _.parseInt(_.get(request, "request.cookie.cookie_encode")) > 0) {
348
381
  value = encodeURIComponentUnique(value);
349
382
  }
@@ -390,10 +423,7 @@ const convert2PostmanRequest = (request, option) => {
390
423
  }
391
424
  }
392
425
  }
393
- } catch (e) {
394
-
395
- console.log(e)
396
- }
426
+ } catch (e) {}
397
427
 
398
428
  // 处理body
399
429
  const body = {};
@@ -432,10 +462,21 @@ const convert2PostmanRequest = (request, option) => {
432
462
  disabled: false,
433
463
  });
434
464
  } else {
465
+ let { value, schema } = item;
466
+ value = autoReplaceMockVar(value);
467
+
468
+ if (value == '' && _.isObject(schema)) {
469
+ const tmpValue = jsfGenerate(schema, [], option?.lang);
470
+
471
+ if (!_.isUndefined(tmpValue)) {
472
+ value = tmpValue;
473
+ }
474
+ }
475
+
435
476
  if (bodyMode == "form-data" && item.content_type != "") {
436
477
  body[body.mode].push({
437
478
  key: autoReplaceMockVar(item.key),
438
- value: autoReplaceMockVar(item.value),
479
+ value,
439
480
  type: "text",
440
481
  disabled: false,
441
482
  contentType: item.content_type,
@@ -443,7 +484,7 @@ const convert2PostmanRequest = (request, option) => {
443
484
  } else {
444
485
  body[body.mode].push({
445
486
  key: autoReplaceMockVar(item.key),
446
- value: autoReplaceMockVar(item.value),
487
+ value,
447
488
  type: "text",
448
489
  disabled: false,
449
490
  });
@@ -556,7 +597,7 @@ const convert2PostmanOptions = (request, option, variables) => {
556
597
  const globals = new sdk.VariableScope({
557
598
  values: globalsVariables,
558
599
  });
559
- console.log(JSON.stringify(variables, null,2))
600
+
560
601
  const requester = {
561
602
  strictSSL: false,
562
603
  protocolVersion: requestJson?.protocol == 'http/1.1' ? 'http1' : 'http2',
@@ -1947,6 +1988,7 @@ const initRequestJson = (event, option) => {
1947
1988
  let currentCookie = {
1948
1989
  key: key,
1949
1990
  value: item?.value,
1991
+ schema: item?.schema
1950
1992
  };
1951
1993
  if (currentKey > -1) {
1952
1994
  cookieArr[currentKey] = currentCookie;
@@ -2137,7 +2179,6 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
2137
2179
 
2138
2180
  // script print
2139
2181
  console(cursor, level, ...args) {
2140
- console.log({ level, args })
2141
2182
  if (_.isUndefined(_.get(eventRuntimeData, [event?.event_id, "console"]))) {
2142
2183
  _.set(eventRuntimeData, [event?.event_id, "console"], []);
2143
2184
  }
@@ -2203,7 +2244,7 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
2203
2244
  })
2204
2245
  }
2205
2246
  }
2206
- console.log(String(request?.url), 111111)
2247
+ // console.log(String(request?.url), 111111)
2207
2248
  const requestOptions = convert2EchoRequest(request, requestJson, postmanJSON, history);
2208
2249
  _.set(eventRuntimeData, [event?.event_id, "request"], requestOptions);
2209
2250
 
@@ -2262,7 +2303,6 @@ console.log(String(request?.url), 111111)
2262
2303
  _.set(eventRuntimeData, [event?.event_id, "assertions"], []);
2263
2304
  }
2264
2305
 
2265
- console.log(assertions,`assertionsassertionsassertionsassertionsassertions`)
2266
2306
  eventRuntimeData[event?.event_id].assertions = _.unionWith(_.concat(_.get(eventRuntimeData, [event?.event_id, "assertions"]), assertions), _.isEqual);
2267
2307
  }
2268
2308
  }
@@ -2296,7 +2336,7 @@ console.log(String(request?.url), 111111)
2296
2336
  const success_assert = _.filter(_.get(eventRuntimeData, [event?.event_id, "assertions"]), (item) => {
2297
2337
  return item?.passed === false
2298
2338
  })
2299
-
2339
+
2300
2340
  _.set(eventRuntimeData, [event?.event_id, "status"], {
2301
2341
  assert: _.get(eventRuntimeData, [event?.event_id, "assertions"], []),
2302
2342
  success_assert,
package/libs/2har.js CHANGED
@@ -71,7 +71,7 @@ function generateHarFromRequest(options) {
71
71
  ],
72
72
  },
73
73
  };
74
- console.log(JSON.stringify(har, null,2))
74
+
75
75
  return har;
76
76
  }
77
77
 
package/libs/utils.js CHANGED
@@ -1,6 +1,9 @@
1
+ const { Schema } = require("../../json-schema-faker-pro/dist/vendor");
2
+
1
3
  const atomicSleep = require("atomic-sleep"),
2
4
  _ = require('lodash'),
3
5
  fs = require("fs"),
6
+ jsf = require("json-schema-faker-pro"),
4
7
  path = require("path"),
5
8
  { mockExp } = require('exp-mock'),
6
9
  Mock = require('mockjs5-pro'),
@@ -312,14 +315,13 @@ const getCaseInsensitive = (object, keyToFind) => {
312
315
  const variableReplace = (str, variables, option) => {
313
316
  const AllVars = getInsideVariables();
314
317
  ["variables", "globals", "_globals", "environment"].forEach((varName) => {
315
- console.log(11111111,_.get(variables, `${varName}`))
316
318
  _.assign(AllVars, _.get(variables, `${varName}`))
317
319
  })
318
320
 
319
321
  str = _.replace(str, /\{\{([^}]+)\}\}/g, (match, key) => {
320
322
  return _.get(AllVars, key.trim(), match);
321
323
  });
322
- console.log(2222222, str, _.get(AllVars, 'IF_xunhuan'),_.keys(AllVars))
324
+
323
325
  const { lang, custom_functions } = option;
324
326
 
325
327
  try {
@@ -449,7 +451,7 @@ const formatAutotestReportList = (eventResultList) => {
449
451
  if (_.includes(['assert_visual', 'assert'], item?.type)) {
450
452
  type = 'api';
451
453
  }
452
- console.log(item?.status?.success_assert,`item?.status?.success_assertitem?.status?.success_assertitem?.status?.success_assertitem?.status?.success_assert`)
454
+
453
455
  list.push(_.assign(
454
456
  _.pick(item?.response, ['timings', 'response_time', 'response_at', 'proxy', 'status', 'code', 'response_size']),
455
457
  _.pick(item?.request, ['url', 'method', 'name', 'target_id', 'project_id']),
@@ -535,7 +537,7 @@ const camelCaseToSnakeCase = (obj) => {
535
537
  return obj;
536
538
  }
537
539
 
538
- const encodeURIComponentUnique = (str) =>{
540
+ const encodeURIComponentUnique = (str) => {
539
541
  if (_.startsWith(str, '{{') && _.endsWith(str, '}}')) {
540
542
  return str;
541
543
  } else {
@@ -550,8 +552,32 @@ const encodeURIComponentUnique = (str) =>{
550
552
  }
551
553
  }
552
554
 
555
+ const jsfGenerate = (schema, mockRules = [], lang) => {
556
+ jsf.option({
557
+ alwaysFakeOptionals: true,
558
+ useExamplesValue: true,
559
+ fillProperties: false,
560
+ useDefaultValue: true,
561
+ mockRules,
562
+ lang: 'zh-cn',
563
+ });
564
+
565
+ let genResult = undefined;
566
+
567
+ if (_.some(["default", "examples", "pattern", "format", "x-mock","enum"], (value) => _.includes(_.keys(schema?.schema), value))) {
568
+ try {
569
+ genResult = jsf.generate(schema);
570
+ } catch (e) { }
571
+ }
572
+
573
+ if (!_.isUndefined(genResult)) {
574
+ return genResult;
575
+ }
576
+ }
577
+
553
578
  module.exports = {
554
579
  atomicSleep,
580
+ jsfGenerate,
555
581
  getAPIFromCollection,
556
582
  getParentTargetIDs,
557
583
  base64toCacheFile,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runner-runtime",
3
- "version": "1.0.45",
3
+ "version": "1.0.47",
4
4
  "description": "runner-runtime.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,11 +24,13 @@
24
24
  "apipost-tools": "^0.0.38",
25
25
  "atomic-sleep": "^1.0.0",
26
26
  "content-disposition": "^0.5.4",
27
+ "database-query": "^1.1.12",
27
28
  "exp-mock": "^2.0.15",
28
29
  "file-type": "^16.5.4",
29
30
  "is-image": "^3.0.0",
30
31
  "is-svg": "^4.3.2",
31
32
  "json-bigint": "^1.0.0",
33
+ "json-schema-faker-pro": "^0.5.14",
32
34
  "json5": "^2.2.3",
33
35
  "jsonpath": "^1.1.1",
34
36
  "lodash": "^4.17.21",
package/tmp/request.js CHANGED
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
2
  "option": {
3
- "scene": "auto_test",
3
+ "scene": "http_request",
4
4
  "globals": {},
5
5
  "project": {
6
6
  "request": {
@@ -72,166 +72,11 @@ module.exports = {
72
72
  "uri": ""
73
73
  }
74
74
  },
75
- "environment": {
76
- "ID": "222",
77
- "key": "value"
78
- }
75
+ "environment": {}
79
76
  },
80
77
  "cookies": {
81
78
  "switch": 1,
82
- "data": [
83
- {
84
- "key": "security_session_verify",
85
- "value": "4560bdb4c5ddc22643bc99515ea21fcf",
86
- "expires": "2025-04-19T14:45:34.000Z",
87
- "path": "/",
88
- "httpOnly": true,
89
- "creation": "2025-04-16T06:45:35.543Z",
90
- "name": "security_session_verify",
91
- "cookie_id": "375d8dd3f700a",
92
- "domain": "echo.apipost.cn",
93
- "project_id": "1a8a2a84eb7da002"
94
- },
95
- {
96
- "key": "security_session_verify",
97
- "value": "4560bdb4c5ddc22643bc99515ea21fcf",
98
- "expires": "2025-04-19T14:10:50.000Z",
99
- "path": "/",
100
- "httpOnly": true,
101
- "creation": "2025-04-16T06:10:50.623Z",
102
- "name": "security_session_verify",
103
- "cookie_id": "375d8dd3f700b",
104
- "domain": "echo.apipost.cn",
105
- "project_id": "1a8a2a84eb7da002"
106
- },
107
- {
108
- "key": "cookie-test1-folder",
109
- "value": "B",
110
- "expires": "Wed, 16 Apr 2025 07:45:42 GMT",
111
- "maxAge": 3600,
112
- "domain": "echo.apipost.cn",
113
- "path": "/echo",
114
- "creation": "2025-04-16T06:45:35.542Z",
115
- "name": "cookie-test1-folder",
116
- "cookie_id": "375d8dd3f700c",
117
- "project_id": "1a8a2a84eb7da002"
118
- },
119
- {
120
- "key": "cookie-test1",
121
- "value": "0",
122
- "expires": "Wed, 16 Apr 2025 07:45:42 GMT",
123
- "maxAge": 3600,
124
- "domain": "echo.apipost.cn",
125
- "path": "/",
126
- "creation": "2025-04-16T06:45:35.542Z",
127
- "name": "cookie-test1",
128
- "cookie_id": "375d8dd3f700d",
129
- "project_id": "1a8a2a84eb7da002"
130
- },
131
- {
132
- "key": "cookie-test2",
133
- "value": "0",
134
- "expires": "Wed, 16 Apr 2025 07:45:42 GMT",
135
- "maxAge": 3600,
136
- "domain": "echo.apipost.cn",
137
- "path": "/",
138
- "creation": "2025-04-16T06:45:35.542Z",
139
- "name": "cookie-test2",
140
- "cookie_id": "375d8dd3f700e",
141
- "project_id": "1a8a2a84eb7da002"
142
- },
143
- {
144
- "key": "cookie-test3",
145
- "value": "%25E4%25BD%25A0%25E5%25A5%25BD",
146
- "expires": "Wed, 16 Apr 2025 07:45:42 GMT",
147
- "maxAge": 3600,
148
- "domain": "echo.apipost.cn",
149
- "path": "/",
150
- "creation": "2025-04-16T06:45:35.542Z",
151
- "name": "cookie-test3",
152
- "cookie_id": "375d8dd3f700f",
153
- "project_id": "1a8a2a84eb7da002"
154
- },
155
- {
156
- "key": "cookie-test6",
157
- "value": "deleted",
158
- "expires": "Wed, 16 Apr 2025 06:45:42 GMT",
159
- "maxAge": 0,
160
- "domain": "echo.apipost.cn",
161
- "path": "/",
162
- "creation": "2025-04-16T06:45:35.543Z",
163
- "name": "cookie-test6",
164
- "cookie_id": "375d8dd3f7012",
165
- "project_id": "1a8a2a84eb7da002"
166
- },
167
- {
168
- "key": "cookie-test7",
169
- "value": "0",
170
- "expires": "Wed, 16 Apr 2025 06:45:42 GMT",
171
- "maxAge": 0,
172
- "domain": "echo.apipost.cn",
173
- "path": "/",
174
- "creation": "2025-04-16T06:45:35.543Z",
175
- "name": "cookie-test7",
176
- "cookie_id": "375d8dd3f7013",
177
- "project_id": "1a8a2a84eb7da002"
178
- },
179
- {
180
- "key": "cookie-test8",
181
- "value": "renge%3D%3D%3B-%2F%3F",
182
- "creation": "2025-04-16T06:45:35.543Z",
183
- "name": "cookie-test8",
184
- "cookie_id": "375d8dd3f7014",
185
- "domain": "echo.apipost.cn",
186
- "project_id": "1a8a2a84eb7da002"
187
- },
188
- {
189
- "key": "httponly-cookie",
190
- "value": "httponly-value",
191
- "httpOnly": true,
192
- "creation": "2025-04-16T06:45:35.543Z",
193
- "name": "httponly-cookie",
194
- "cookie_id": "375d8dd3f7015",
195
- "domain": "echo.apipost.cn",
196
- "project_id": "1a8a2a84eb7da002"
197
- },
198
- {
199
- "key": "security_session_verify",
200
- "value": "4560bdb4c5ddc22643bc99515ea21fcf",
201
- "expires": "2025-04-19T14:10:50.000Z",
202
- "path": "/",
203
- "httpOnly": true,
204
- "creation": "2025-04-16T06:10:50.626Z",
205
- "name": "security_session_verify",
206
- "cookie_id": "375d8dd3f7016",
207
- "domain": "echo.apipost.cn",
208
- "project_id": "1a8a2a84eb7da002"
209
- },
210
- {
211
- "key": "cookie-test4",
212
- "value": "%E4%BD%A0%E5%A5%BD%3D%3D%3D",
213
- "expires": "Wed, 16 Apr 2025 07:45:42 GMT",
214
- "maxAge": 3600,
215
- "domain": "apipost.cn",
216
- "path": "/",
217
- "creation": "2025-04-16T06:45:35.542Z",
218
- "name": "cookie-test4",
219
- "cookie_id": "375d8dd3f7010",
220
- "project_id": "1a8a2a84eb7da002"
221
- },
222
- {
223
- "key": "cookie-test5",
224
- "value": "nihao",
225
- "expires": "Wed, 16 Apr 2025 07:45:42 GMT",
226
- "maxAge": 3600,
227
- "domain": "apipost.cn",
228
- "path": "/",
229
- "creation": "2025-04-16T06:45:35.542Z",
230
- "name": "cookie-test5",
231
- "cookie_id": "375d8dd3f7011",
232
- "project_id": "1a8a2a84eb7da002"
233
- }
234
- ]
79
+ "data": []
235
80
  },
236
81
  "system_configs": {
237
82
  "send_timeout": 0,
@@ -263,181 +108,140 @@ module.exports = {
263
108
  "custom_functions": {},
264
109
  "collection": [
265
110
  {
266
- "target_id": "378a5473f704e",
111
+ "target_id": "4e4b0a4b37003",
267
112
  "target_type": "api",
268
113
  "parent_id": "0",
269
- "name": "副本",
114
+ "name": "新建接口",
270
115
  "request": {
271
116
  "auth": {
272
117
  "type": "inherit"
273
118
  },
274
- "body": {
275
- "mode": "none",
276
- "parameter": [],
277
- "raw": "",
278
- "raw_parameter": [],
279
- "raw_schema": {
280
- "type": "object"
281
- },
282
- "binary": null
283
- },
284
- "pre_tasks": [],
285
- "post_tasks": [],
286
119
  "header": {
287
- "parameter": []
120
+ "parameter": [
121
+ {
122
+ "description": "",
123
+ "field_type": "string",
124
+ "is_checked": 1,
125
+ "key": "h1",
126
+ "value": "",
127
+ "not_null": 1,
128
+ "schema": {
129
+ "type": "string",
130
+ "x-mock": "{{'123456'|md5}}"
131
+ },
132
+ "param_id": "604725e36e00e"
133
+ }
134
+ ]
288
135
  },
289
136
  "query": {
137
+ "query_add_equal": 1,
290
138
  "parameter": [
291
139
  {
292
140
  "description": "",
293
141
  "field_type": "string",
294
142
  "is_checked": 1,
295
- "key": "id",
296
- "value": "{{id}}",
143
+ "key": "q1",
144
+ "value": "",
297
145
  "not_null": 1,
298
146
  "schema": {
299
- "type": "string"
147
+ "type": "string",
148
+ "x-mock": "{{'222'|md5}}"
300
149
  },
301
- "param_id": "375b74ab9b006"
150
+ "param_id": "604365b39b00c"
302
151
  }
303
- ],
304
- "query_add_equal": 1
305
- },
306
- "cookie": {
307
- "parameter": [],
308
- "cookie_encode": 1
152
+ ]
309
153
  },
310
154
  "restful": {
311
155
  "parameter": []
312
- }
156
+ },
157
+ "cookie": {
158
+ "cookie_encode": 1,
159
+ "parameter": [
160
+ {
161
+ "description": "",
162
+ "field_type": "string",
163
+ "is_checked": 1,
164
+ "key": "",
165
+ "value": "",
166
+ "not_null": 1,
167
+ "schema": {
168
+ "type": "string"
169
+ },
170
+ "param_id": "6042d1bb5e00a"
171
+ },
172
+ {
173
+ "description": "",
174
+ "field_type": "string",
175
+ "is_checked": 1,
176
+ "key": "cookie11111",
177
+ "value": "",
178
+ "not_null": 1,
179
+ "static": true,
180
+ "schema": {
181
+ "type": "string"
182
+ },
183
+ "param_id": "604398079b00d"
184
+ }
185
+ ]
186
+ },
187
+ "body": {
188
+ "mode": "urlencoded",
189
+ "parameter": [
190
+ {
191
+ "description": "",
192
+ "field_type": "string",
193
+ "is_checked": 1,
194
+ "key": "age",
195
+ "value": "",
196
+ "not_null": 1,
197
+ "schema": {
198
+ "type": "string",
199
+ "x-mock": "{{$mockjs.telephone()}}"
200
+ },
201
+ "param_id": "600c409771006"
202
+ },
203
+ {
204
+ "description": "",
205
+ "field_type": "string",
206
+ "is_checked": 1,
207
+ "key": "",
208
+ "value": "",
209
+ "not_null": 1,
210
+ "static": true,
211
+ "schema": {
212
+ "type": "string"
213
+ },
214
+ "param_id": "6043189b5e00b"
215
+ }
216
+ ],
217
+ "binary": "",
218
+ "raw": "",
219
+ "raw_parameter": [],
220
+ "raw_schema": {
221
+ "type": "object"
222
+ }
223
+ },
224
+ "pre_tasks": [],
225
+ "post_tasks": []
313
226
  },
314
227
  "parents": [],
315
228
  "method": "POST",
316
229
  "protocol": "http/1.1",
317
- "url": "echo.apipost.cn/get.php?id={{id}}",
230
+ "url": "https://httpbin.org/anything?q1=mm",
318
231
  "pre_url": ""
319
232
  }
320
233
  ],
321
- "database_configs": {},
322
- "name": "新建用例2",
323
- "ignore_error": -1,
324
- "enable_sandbox": -1,
325
- "iterationCount": 1,
326
- "sleep": 0,
327
- "testing_id": "37896d73f7045",
328
- "iterates_data_id": "0",
329
- "iterationData": []
234
+ "database_configs": {}
330
235
  },
331
236
  "test_events": [
332
237
  {
333
- "parent_event_id": "0",
334
- "enabled": 1,
335
- "type": "assert_visual",
238
+ "type": "api",
336
239
  "data": {
337
- "name": "可视化断言",
338
- "data": {
339
- "type": "envVars",
340
- "expression": {
341
- "compareType": "eq",
342
- "compareValue": "222",
343
- "path": "{{ID}}"
344
- }
345
- }
346
- },
347
- "project_id": "1a8a2a84eb7da002",
348
- "test_id": "37896d73f7045",
349
- "event_id": "37c37987f706e",
350
- "sort": 0
351
- },
352
- {
353
- "parent_event_id": "0",
354
- "enabled": -1,
355
- "type": "loop",
356
- "data": {
357
- "name": "循环",
358
- "loop_type": 3,
359
- "sleep": 0,
360
- "loop_timeout": 0,
361
- "loop_condition": {
362
- "var": "{{ID}}",
363
- "compare": "eq",
364
- "value": "222"
365
- },
366
- "loop_traverse_data": {
367
- "type": 1,
368
- "iterationData": [],
369
- "name": ""
370
- }
371
- },
372
- "project_id": "1a8a2a84eb7da002",
373
- "test_id": "37896d73f7045",
374
- "event_id": "37d3975bf7079",
375
- "sort": 2,
376
- "children": [
377
- {
378
- "type": "api",
379
- "auto_sync": false,
380
- "test_id": "37896d73f7045",
381
- "event_id": "378b6a33f7053",
382
- "enabled": -1,
383
- "data": {
384
- "target_id": "378a5473f704e",
385
- "project_id": "1a8a2a84eb7da002",
386
- "parent_id": "0",
387
- "target_type": "api",
388
- "apiData": {
389
- "name": "测试 副本",
390
- "method": "POST",
391
- "protocol": "http/1.1",
392
- "url": "echo.apipost.cn/get.php?id={{id}}",
393
- "request": {
394
- "auth": {
395
- "type": "inherit"
396
- },
397
- "body": {
398
- "raw": "",
399
- "mode": "none",
400
- "binary": "",
401
- "parameter": [],
402
- "raw_schema": {
403
- "type": "object"
404
- },
405
- "raw_parameter": []
406
- },
407
- "query": {
408
- "parameter": [
409
- {
410
- "key": "id",
411
- "value": "{{id}}",
412
- "schema": {
413
- "type": "string"
414
- },
415
- "not_null": 1,
416
- "param_id": "375b74ab9b006",
417
- "field_type": "string",
418
- "is_checked": 1,
419
- "description": ""
420
- }
421
- ],
422
- "query_add_equal": 1
423
- },
424
- "cookie": {
425
- "parameter": [],
426
- "cookie_encode": 1
427
- },
428
- "header": {
429
- "parameter": []
430
- },
431
- "restful": {
432
- "parameter": []
433
- },
434
- "pre_tasks": [],
435
- "post_tasks": []
436
- }
437
- }
438
- }
439
- }
440
- ]
240
+ "target_id": "4e4b0a4b37003",
241
+ "project_id": "1a8b7f4d6f51e002",
242
+ "parent_id": "0",
243
+ "target_type": "api"
244
+ }
441
245
  }
442
246
  ]
443
247
  }