Skip to content

Commit e0c76ca

Browse files
committed
APIAuto: 解决删除不了场景串联用例子项,解决默认 testAccountId = '0' 导致回归测试场景串联及切换帐号查看结果时用例与帐号关联错误
1 parent a26f829 commit e0c76ca

1 file changed

Lines changed: 21 additions & 20 deletions

File tree

  • APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/js

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/js/main.js‎

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
var standard = App.isMLEnabled ? tr.standard : tr.response;
234234
var standardObj = StringUtil.isEmpty(standard, true) ? null : parseJSON(standard);
235235
var curAccount = App.getCurrentAccount() || {}
236-
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || 0 : 0)
236+
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || '' : '')
237237
var tests = App.tests[accountIdStr] || {};
238238
var responseObj = (tests[d.id] || {})[0]
239239

@@ -294,7 +294,7 @@
294294
var standard = App.isMLEnabled ? tr.standard : tr.response;
295295
var standardObj = StringUtil.isEmpty(standard, true) ? null : parseJSON(standard);
296296
var curAccount = App.getCurrentAccount() || {}
297-
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || 0 : 0)
297+
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || '' : '')
298298
var tests = App.tests[accountIdStr] || {};
299299
var responseObj = (tests[d.id] || {})[0]
300300

@@ -479,7 +479,7 @@
479479
var standard = App.isMLEnabled ? tr.standard : tr.response;
480480
var standardObj = StringUtil.isEmpty(standard, true) ? null : parseJSON(standard);
481481
var curAccount = App.getCurrentAccount() || {}
482-
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || 0 : 0)
482+
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || '' : '')
483483
var tests = App.tests[accountIdStr] || {};
484484
var responseObj = (tests[d.id] || {})[0]
485485

@@ -527,7 +527,7 @@
527527
var standard = App.isMLEnabled ? tr.standard : tr.response;
528528
var standardObj = StringUtil.isEmpty(standard, true) ? null : parseJSON(standard);
529529
var curAccount = App.getCurrentAccount() || {}
530-
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || 0 : 0)
530+
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || '' : '')
531531
var tests = App.tests[accountIdStr] || {};
532532
var responseObj = (tests[d.id] || {})[0]
533533

@@ -1577,7 +1577,7 @@ https://github.com/Tencent/APIJSON/issues
15771577
var standard = this.isMLEnabled ? tr.standard : tr.response;
15781578
var standardObj = StringUtil.isEmpty(standard, true) ? null : parseJSON(standard);
15791579
var curAccount = this.getCurrentAccount() || {}
1580-
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || 0 : 0)
1580+
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || '' : '')
15811581
var tests = this.tests[accountIdStr] || {};
15821582
var responseObj = (tests[d.id] || {})[0]
15831583

@@ -1627,7 +1627,7 @@ https://github.com/Tencent/APIJSON/issues
16271627
var standard = this.isMLEnabled ? tr.standard : tr.response;
16281628
var standardObj = StringUtil.isEmpty(standard, true) ? null : parseJSON(standard);
16291629
var curAccount = this.getCurrentAccount() || {}
1630-
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || 0 : 0)
1630+
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || '' : '')
16311631
var tests = this.tests[accountIdStr] || {};
16321632
var responseObj = (tests[d.id] || {})[0]
16331633

@@ -2409,17 +2409,18 @@ https://github.com/Tencent/APIJSON/issues
24092409

24102410
// 删除接口文档
24112411
deleteDoc: function () {
2412+
var isChainShow = this.isChainShow
24122413
var isDeleteRandom = this.isDeleteRandom
24132414
var isDeleteChainGroup = this.isDeleteChainGroup
24142415
var item = (isDeleteRandom ? this.currentRandomItem : this.currentDocItem) || {}
2415-
var doc = (isDeleteRandom ? item.Random : (isDeleteChainGroup ? item.Chain : item.Document)) || {}
2416+
var doc = (isDeleteRandom ? item.Random : (isDeleteChainGroup || isChainShow ? item.Chain : item.Document)) || {}
24162417

24172418
var type = isDeleteRandom ? '随机配置' : (isDeleteChainGroup ? '分组' : '接口')
24182419
if ((isDeleteChainGroup && doc.groupId == null) || (isDeleteChainGroup != true && doc.id == null)) {
24192420
alert('未选择' + type + '或' + type + '不存在!')
24202421
return
24212422
}
2422-
if ((isDeleteChainGroup && doc.groupName != this.exTxt.name) || (isDeleteChainGroup != true && doc.name != this.exTxt.name)) {
2423+
if ((isDeleteChainGroup && doc.groupName != this.exTxt.name) || (isDeleteChainGroup != true && doc.name != this.exTxt.name && doc.documentName != this.exTxt.name)) {
24232424
alert('输入的' + type + '名和要删除的' + type + '名不匹配!')
24242425
return
24252426
}
@@ -2428,7 +2429,6 @@ https://github.com/Tencent/APIJSON/issues
24282429

24292430
this.isTestCaseShow = false
24302431
this.isRandomListShow = false
2431-
var isChainShow = this.isChainShow
24322432

24332433
var url = this.server + '/delete'
24342434
var req = isDeleteRandom ? {
@@ -2737,7 +2737,7 @@ https://github.com/Tencent/APIJSON/issues
27372737
const testCases = App.testCases
27382738
const position = index
27392739

2740-
const id = curAccount.id || 0
2740+
const id = curAccount.id || ''
27412741
const name = curAccount.name || ''
27422742
const account = curAccount.account || curAccount.phone || ''
27432743
const info = JSON.stringify(curAccount) || '{}'
@@ -4605,7 +4605,7 @@ https://github.com/Tencent/APIJSON/issues
46054605
this.currentAccountIndex = index
46064606
this.changeScriptType(App.scriptType)
46074607

4608-
var accountIdStr = String(item != null && item.isLoggedIn ? item.id || 0 : 0)
4608+
var accountIdStr = String(item != null && item.isLoggedIn ? item.id || '' : '')
46094609
var tests = App.doneCount >= App.allCount && noShowCase != true && this.isCrossEnabled && this.isStatisticsEnabled && this.reportId != null && this.reportId > 0 ? this.tests[accountIdStr] : null
46104610
if (JSONObject.isEmpty(tests) != true) {
46114611
this.showCompare4TestCaseList(true)
@@ -4681,7 +4681,7 @@ https://github.com/Tencent/APIJSON/issues
46814681
item.isLoggedIn = true
46824682
}
46834683

4684-
var accountIdStr = String(item != null && item.isLoggedIn ? item.id || 0 : 0)
4684+
var accountIdStr = String(item != null && item.isLoggedIn ? item.id || '' : '')
46854685
var tests = App.tests[accountIdStr]
46864686
if (JSONObject.isEmpty(tests) != true) {
46874687
App.showCompare4TestCaseList(true)
@@ -4702,7 +4702,7 @@ https://github.com/Tencent/APIJSON/issues
47024702
// item.isLoggedIn = true
47034703
// }
47044704
//
4705-
// var accountIdStr = String(item != null && item.isLoggedIn ? item.id || 0 : 0)
4705+
// var accountIdStr = String(item != null && item.isLoggedIn ? item.id || '' : '')
47064706
// var tests = this.tests[accountIdStr]
47074707
// if (JSONObject.isEmpty(tests) != true) {
47084708
// this.showCompare4TestCaseList(true)
@@ -4774,7 +4774,7 @@ https://github.com/Tencent/APIJSON/issues
47744774
reportId = null
47754775
}
47764776

4777-
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || 0 : 0)
4777+
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || '' : '')
47784778
var tests = this.tests[accountIdStr] // FIXME account.phone + '@' + (account.baseUrl || baseUrl)]
47794779
var hasTests = JSONObject.isEmpty(tests) != true
47804780
if (hasTests || this.isChainShow || (reportId != null && reportId >= 0)) {
@@ -4929,7 +4929,7 @@ https://github.com/Tencent/APIJSON/issues
49294929
// TODO 后续再支持嵌套子组合 'toGroupId': groupId,
49304930
'userId': userId,
49314931
'groupId@': '[]/Chain/groupId',
4932-
'@column': "id,groupId,documentId,randomId,rank,testAccountId,testName,testInfo",
4932+
'@column': "id,groupId,documentId,documentName,randomId,rank,testAccountId,testName,testInfo",
49334933
'@order': 'rank+,id+',
49344934
'documentId>': 0
49354935
},
@@ -5065,7 +5065,8 @@ https://github.com/Tencent/APIJSON/issues
50655065
'rank': this.formatDateTime(StringUtil.isEmpty(nextRank, true) ? null : new Date(new Date(nextRank).getTime() - 10)),
50665066
'groupName': groupName,
50675067
'groupId': groupId,
5068-
'documentId': item.id
5068+
'documentId': item.id,
5069+
'documentName': item.name
50695070
},
50705071
tag: 'Chain'
50715072
}, {}, function (url, res, err) {
@@ -5571,7 +5572,7 @@ https://github.com/Tencent/APIJSON/issues
55715572
this.currentAccountIndex = accountIndex //解决 onTestResponse 用 -1 存进去, handleTest 用 currentAccountIndex 取出来为空
55725573
var docId = ((this.currentRemoteItem || {}).Document || {}).id
55735574

5574-
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || 0 : 0)
5575+
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || '' : '')
55755576
var tests = (this.tests[accountIdStr] || {})[docId]
55765577
if (JSONObject.isEmpty(tests) != true) {
55775578
// if (! isSub) {
@@ -11352,7 +11353,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
1135211353
}
1135311354

1135411355
var curAccount = this.accounts[accountIndex] || {}
11355-
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || 0 : 0)
11356+
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || '' : '')
1135611357
var tests = this.tests[accountIdStr] || {}
1135711358
var t = tests[documentId]
1135811359
if (t == null) {
@@ -11825,7 +11826,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
1182511826
*/
1182611827
setTimeout(function () {
1182711828
var curAccount = App.getCurrentAccount() || {}
11828-
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || 0 : 0)
11829+
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || '' : '')
1182911830
var tests = App.tests[accountIdStr] || {}
1183011831
saveTextAs(
1183111832
'# APIJSON自动化回归测试-后\n主页: https://github.com/Tencent/APIJSON'
@@ -11913,7 +11914,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
1191311914
var lastKey = pathKeys[pathKeys.length - 1];
1191411915

1191511916
var curAccount = this.getCurrentAccount() || {}
11916-
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || 0 : 0)
11917+
var accountIdStr = String(curAccount.isLoggedIn ? curAccount.id || '' : '')
1191711918
var tests = this.tests[accountIdStr] || {}
1191811919
var currentResponse = (tests[isRandom ? random.documentId : document.id] || {})[
1191911920
isRandom ? (random.id > 0 ? random.id : (random.toId + '' + random.id)) : 0

0 commit comments

Comments
 (0)