Skip to content

Commit 1e79fbf

Browse files
committed
UIGO:兼容 UIGOX 的 uigo.x.UIAutoApp
1 parent b94ceb0 commit 1e79fbf

File tree

2 files changed

+44
-30
lines changed
  • APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/ui

2 files changed

+44
-30
lines changed

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/ui/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
<a style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(! isDelegateEnabled, 9)">服务器代理: {{ isDelegateEnabled ? '已开启,点击关闭' : '已关闭,点击开启' }}</a>
111111
<a style="border-bottom: #DDD 1px solid;width: 100%;display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden;" href="javascript:void(0)" @click="showConfig(! isRandomShow, 5)">{{ isRandomShow ? '隐藏(固定)步骤 Step' : '显示(编辑)步骤 Step' }}</a>
112112
<a style="border-bottom: #DDD 1px solid;width: 100%;display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden;" href="javascript:void(0)" @click="showConfig(! isHeaderShow, 4)">{{ isHeaderShow ? '隐藏(固定)请求头 Request Header' : '显示(编辑)请求头 Request Header' }}</a>
113+
<a style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(true, 3)">{{ '应用入口 App Class: \n' + host }}</a>
113114
<a style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(true, 8)">项目服务器地址URL: {{ project || '点击设置' }}</a>
114115
<a v-show="User.id == null || User.id <= 0" style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(true, 6)">托管服务器地址URL: {{ server || '点击设置' }}</a>
115116
<li v-show="User.id != null && User.id > 0" style="padding: 0px;margin: 0px; border-bottom: #DDD 1px solid;width: 100%; display: inline-block;text-align: center;" >

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

Lines changed: 43 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,8 @@
565565
isVideoFirst: false,
566566
type: OPERATE_TYPE_REVIEW,
567567
types: [ OPERATE_TYPE_RECORD, OPERATE_TYPE_REVIEW, OPERATE_TYPE_REPLAY ],
568-
host: 'uiauto.UIAutoApp.', // 'unitauto.test.TestUtil.',
568+
// host: 'uiauto.UIAutoApp', // 'unitauto.test.TestUtil.',
569+
host: 'uigo.x.UIAutoApp', // 'unitauto.test.TestUtil.',
569570
branch: 'countArray',
570571
database: 'MYSQL',// 'POSTGRESQL',
571572
schema: 'sys',
@@ -713,9 +714,9 @@
713714
vUrl.value = (isAdminOperation ? this.server : baseUrl) + branchUrl
714715
}
715716
else { //隐藏(固定)URL Host
716-
if (isAdminOperation) {
717-
this.host = this.server
718-
}
717+
// if (isAdminOperation) {
718+
// this.host = this.server
719+
// }
719720
vUrl.value = branchUrl
720721
}
721722

@@ -779,8 +780,8 @@
779780
if (index <= 0) {
780781
throw new Error('必须要有类名!完整的 URL 必须符合格式 package.Class.method !')
781782
}
782-
url = url.substring(0, index)
783-
index = url.lastIndexOf('.')
783+
// url = url.substring(0, index)
784+
// index = url.lastIndexOf('.')
784785
var clazz = StringUtil.trim(index < 0 ? url : url.substring(index + 1))
785786
if (App.language == 'Java' || App.language == 'JavaScript' || App.language == 'TypeScript') {
786787
if (/[A-Z]{0}[A-Za-z0-9_]/.test(clazz) != true) {
@@ -796,8 +797,8 @@
796797
if (index <= 0) {
797798
throw new Error('必须要有类名!完整的 URL 必须符合格式 package.Class.method !')
798799
}
799-
url = url.substring(0, index)
800-
index = url.lastIndexOf('.')
800+
// url = url.substring(0, index)
801+
// index = url.lastIndexOf('.')
801802
return StringUtil.trim(index < 0 ? '' : url.substring(0, index))
802803
},
803804
//获取请求的tag
@@ -968,7 +969,8 @@
968969
showConfig: function (show, index) {
969970
App.isConfigShow = false
970971
if (App.isTestCaseShow) {
971-
if (index == 3 || index == 4 || index == 5 || index == 10) {
972+
// if (index == 3 || index == 4 || index == 5 || index == 10) {
973+
if (index == 4 || index == 5 || index == 10) {
972974
App.showTestCase(false, false)
973975
}
974976
}
@@ -980,12 +982,13 @@
980982
case 0:
981983
case 1:
982984
case 2:
985+
case 3:
983986
case 6:
984987
case 7:
985988
case 8:
986989
case 10:
987990
App.exTxt.name = index == 0 ? App.database : (index == 1 ? App.schema : (index == 2
988-
? App.language : (index == 6 ? App.server : (index == 8 ? App.project : '/method/list'))))
991+
? App.language : (index == 3 ? App.host : (index == 6 ? App.server : (index == 8 ? App.project : '/method/list')))))
989992
App.isConfigShow = true
990993

991994
if (index == 0) {
@@ -1008,11 +1011,11 @@
10081011
, App.getRequest(vInput.value), App.getHeader(vHeader.value))
10091012
}
10101013
break
1011-
case 3:
1012-
App.host = App.getBaseUrl()
1013-
App.showUrl(false, new String(vUrl.value).substring(App.host.length)) //没必要导致必须重新获取 Response,App.onChange(false)
1014-
App.remotes = null
1015-
break
1014+
// case 3:
1015+
// App.host = App.getBaseUrl()
1016+
// App.showUrl(false, new String(vUrl.value).substring(App.host.length)) //没必要导致必须重新获取 Response,App.onChange(false)
1017+
// App.remotes = null
1018+
// break
10161019
case 4:
10171020
App.isHeaderShow = show
10181021
App.saveCache('', 'isHeaderShow', show)
@@ -1029,12 +1032,13 @@
10291032
}
10301033
else if (index == 3) {
10311034
var host = StringUtil.get(App.host)
1032-
var branch = new String(vUrl.value)
1033-
App.host = ''
1034-
vUrl.value = host + branch //保证 showUrl 里拿到的 baseUrl = App.host (http://apijson.cn:8080/put /balance)
1035-
App.setBaseUrl() //保证自动化测试等拿到的 baseUrl 是最新的
1036-
App.showUrl(false, branch) //没必要导致必须重新获取 Response,App.onChange(false)
1037-
App.remotes = null
1035+
// var branch = new String(vUrl.value)
1036+
App.host = host
1037+
// vUrl.value = host + branch //保证 showUrl 里拿到的 baseUrl = App.host (http://apijson.cn:8080/put /balance)
1038+
// App.setBaseUrl() //保证自动化测试等拿到的 baseUrl 是最新的
1039+
// App.showUrl(false, branch) //没必要导致必须重新获取 Response,App.onChange(false)
1040+
// App.remotes = null
1041+
App.saveCache('', 'host', host)
10381042
}
10391043
else if (index == 4) {
10401044
App.isHeaderShow = show
@@ -1517,6 +1521,10 @@
15171521
doc = null
15181522
App.onChange(false)
15191523
break
1524+
case 3:
1525+
App.host = App.exTxt.name
1526+
App.saveCache('', 'host', App.host)
1527+
break
15201528
case 6:
15211529
App.server = App.exTxt.name
15221530
App.saveCache('', 'server', App.server)
@@ -1619,7 +1627,7 @@
16191627
},
16201628
'Output': {
16211629
'inputId': 0,
1622-
'host': App.getBaseUrl(),
1630+
'host': App.getBaseUrl(),
16231631
'testAccountId': currentAccountId,
16241632
'response': ''
16251633
},
@@ -3252,9 +3260,12 @@
32523260
inputList[i] = list[i].Input
32533261
}
32543262

3255-
App.request(false, REQUEST_TYPE_JSON, App.project + '/method/invoke', {
3256-
"package": 'uiauto', // 'uiauto',
3257-
"class": 'UIAutoApp', // 'UIAutoApp',
3263+
var pkg = this.getPackage(this.host) || 'uiauto'
3264+
var cls = this.getClass(this.host) || 'UIAutoApp'
3265+
3266+
this.request(false, REQUEST_TYPE_JSON, this.project + '/method/invoke', {
3267+
"package": pkg, // 'uiauto',
3268+
"class": cls, // 'UIAutoApp',
32583269
"constructor": 'getInstance',
32593270
"method": isRecord ? 'prepareRecord' : 'prepareReplay',
32603271
"methodArgs": isRecord ? ["boolean:true", "boolean:true"] : [ inputList, "int:0", "boolean:true", "boolean:true"]
@@ -3274,8 +3285,8 @@
32743285

32753286
App.testRandomProcess = '正在' + (isRecord ? '录制' : '回放') + '...'
32763287
App.request(false, REQUEST_TYPE_JSON, App.project + '/method/invoke', {
3277-
"package": 'uiauto', // 'uiauto',
3278-
"class": 'UIAutoApp', // 'UIAutoApp',
3288+
"package": pkg, // 'uiauto',
3289+
"class": cls, // 'UIAutoApp',
32793290
"constructor": 'getInstance',
32803291
"method": 'onClickPlay',
32813292
"static": false
@@ -3326,10 +3337,12 @@
33263337
},
33273338

33283339
loopRandomTestResult: function (list, inputList, allCount, offset, header) {
3329-
App.request(false, REQUEST_TYPE_JSON, App.project + '/method/invoke', {
3340+
var pkg = this.getPackage(this.host) || 'uiauto'
3341+
var cls = this.getClass(this.host) || 'UIAutoApp'
3342+
this.request(false, REQUEST_TYPE_JSON, App.project + '/method/invoke', {
33303343
"static": true,
3331-
"package": 'uiauto', // 'uiauto',
3332-
"class": 'UIAutoApp', // 'UIAutoApp',
3344+
"package": pkg, // 'uiauto',
3345+
"class": cls, // 'UIAutoApp',
33333346
"method": 'getOutputList',
33343347
"methodArgs": [{ // UIAutoApp app
33353348
// "type": "uiauto.UIAutoApp",

0 commit comments

Comments
 (0)