Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
xiaofang li
MeterSphere
Commits
c4cf9b28
Commit
c4cf9b28
authored
4 years ago
by
Captain.B
Browse files
Options
Download
Plain Diff
Merge remote-tracking branch 'origin/v1.8' into v1.8
parents
fa08d597
13242356
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java
+8
-6
...pi/dto/definition/request/sampler/MsHTTPSamplerProxy.java
backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java
+5
-1
...java/io/metersphere/api/service/ApiAutomationService.java
backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java
+10
-0
...a/io/metersphere/excel/listener/TestCaseDataListener.java
backend/src/main/java/io/metersphere/track/controller/TestPlanController.java
+2
-2
...a/io/metersphere/track/controller/TestPlanController.java
backend/src/main/java/io/metersphere/track/service/TestPlanService.java
+2
-2
...in/java/io/metersphere/track/service/TestPlanService.java
frontend/src/business/components/api/definition/ApiDefinition.vue
+1
-1
.../src/business/components/api/definition/ApiDefinition.vue
frontend/src/business/components/api/definition/components/Run.vue
+12
-8
...src/business/components/api/definition/components/Run.vue
frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue
+9
-7
...components/api/definition/components/case/ApiCaseItem.vue
frontend/src/business/components/api/definition/components/case/ApiCaseList.vue
+2
-0
...components/api/definition/components/case/ApiCaseList.vue
frontend/src/business/components/api/definition/components/list/ApiList.vue
+14
-5
...ess/components/api/definition/components/list/ApiList.vue
frontend/src/business/components/api/definition/components/module/ApiModule.vue
+1
-6
...components/api/definition/components/module/ApiModule.vue
frontend/src/business/components/api/homepage/components/SceneInfoCard.vue
+6
-2
...ness/components/api/homepage/components/SceneInfoCard.vue
frontend/src/business/components/common/select-tree/SelectTree.vue
+5
-2
...src/business/components/common/select-tree/SelectTree.vue
frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseEdit.vue
+2
-1
...plan/view/comonents/functional/FunctionalTestCaseEdit.vue
frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue
+6
-0
...s/track/review/view/components/TestReviewTestCaseEdit.vue
with
85 additions
and
43 deletions
+85
-43
backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java
+
8
-
6
View file @
c4cf9b28
...
...
@@ -160,14 +160,16 @@ public class MsHTTPSamplerProxy extends MsTestElement {
sampler
.
setProtocol
(
urlObject
.
getProtocol
());
sampler
.
setPath
(
urlObject
.
getPath
());
}
else
{
String
configStr
=
config
.
getConfig
().
get
(
this
.
getProjectId
()).
getHttpConfig
().
getSocket
();
sampler
.
setDomain
(
configStr
);
if
(
config
.
getConfig
().
get
(
this
.
getProjectId
()).
getHttpConfig
().
getPort
()
>
0
)
{
sampler
.
setDomain
(
config
.
getConfig
().
get
(
this
.
getProjectId
()).
getHttpConfig
().
getDomain
());
sampler
.
setDomain
(
config
.
getConfig
().
get
(
this
.
getProjectId
()).
getHttpConfig
().
getDomain
());
url
=
config
.
getConfig
().
get
(
this
.
getProjectId
()).
getHttpConfig
().
getProtocol
()
+
"://"
+
config
.
getConfig
().
get
(
this
.
getProjectId
()).
getHttpConfig
().
getSocket
();
URL
urlObject
=
new
URL
(
url
);
String
envPath
=
StringUtils
.
equals
(
urlObject
.
getPath
(),
"/"
)
?
""
:
urlObject
.
getPath
();
if
(
StringUtils
.
isNotBlank
(
this
.
getPath
()))
{
envPath
+=
this
.
getPath
();
}
sampler
.
setPort
(
config
.
getConfig
().
get
(
this
.
getProjectId
()).
getHttpConfig
().
getPort
());
sampler
.
setProtocol
(
config
.
getConfig
().
get
(
this
.
getProjectId
()).
getHttpConfig
().
getProtocol
());
sampler
.
setPath
(
this
.
get
Path
()
);
sampler
.
setPath
(
env
Path
);
}
String
envPath
=
sampler
.
getPath
();
if
(
CollectionUtils
.
isNotEmpty
(
this
.
getRest
())
&&
this
.
isRest
())
{
...
...
@@ -187,7 +189,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
}
}
else
{
String
url
=
this
.
getUrl
();
if
(!
url
.
startsWith
(
"http://"
)
&&
!
url
.
startsWith
(
"https://"
))
{
if
(
StringUtils
.
isNotEmpty
(
url
)
&&
!
url
.
startsWith
(
"http://"
)
&&
!
url
.
startsWith
(
"https://"
))
{
url
=
"http://"
+
url
;
}
if
(
StringUtils
.
isNotEmpty
(
this
.
getPort
())
&&
this
.
getPort
().
startsWith
(
"${"
))
{
...
...
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java
+
5
-
1
View file @
c4cf9b28
...
...
@@ -30,6 +30,7 @@ import io.metersphere.commons.utils.*;
import
io.metersphere.controller.request.ScheduleRequest
;
import
io.metersphere.i18n.Translator
;
import
io.metersphere.job.sechedule.ApiScenarioTestJob
;
import
io.metersphere.job.sechedule.SwaggerUrlImportJob
;
import
io.metersphere.job.sechedule.TestPlanTestJob
;
import
io.metersphere.service.ScheduleService
;
import
io.metersphere.track.dto.TestPlanDTO
;
...
...
@@ -231,6 +232,7 @@ public class ApiAutomationService {
scenario
.
setPrincipal
(
request
.
getPrincipal
());
scenario
.
setStepTotal
(
request
.
getStepTotal
());
scenario
.
setUpdateTime
(
System
.
currentTimeMillis
());
scenario
.
setDescription
(
request
.
getDescription
());
scenario
.
setScenarioDefinition
(
JSON
.
toJSONString
(
request
.
getScenarioDefinition
()));
if
(
StringUtils
.
isNotEmpty
(
request
.
getStatus
()))
{
scenario
.
setStatus
(
request
.
getStatus
());
...
...
@@ -816,7 +818,9 @@ public class ApiAutomationService {
if
(
StringUtils
.
equals
(
request
.
getGroup
(),
ScheduleGroup
.
TEST_PLAN_TEST
.
name
()))
{
scheduleService
.
addOrUpdateCronJob
(
request
,
TestPlanTestJob
.
getJobKey
(
request
.
getResourceId
()),
TestPlanTestJob
.
getTriggerKey
(
request
.
getResourceId
()),
TestPlanTestJob
.
class
);
}
else
{
}
else
if
(
StringUtils
.
equals
(
request
.
getGroup
(),
ScheduleGroup
.
SWAGGER_IMPORT
.
name
())){
scheduleService
.
addOrUpdateCronJob
(
request
,
SwaggerUrlImportJob
.
getJobKey
(
request
.
getResourceId
()),
SwaggerUrlImportJob
.
getTriggerKey
(
request
.
getResourceId
()),
SwaggerUrlImportJob
.
class
);
}
else
{
scheduleService
.
addOrUpdateCronJob
(
request
,
ApiScenarioTestJob
.
getJobKey
(
request
.
getResourceId
()),
ApiScenarioTestJob
.
getTriggerKey
(
request
.
getResourceId
()),
ApiScenarioTestJob
.
class
);
}
...
...
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java
+
10
-
0
View file @
c4cf9b28
...
...
@@ -67,6 +67,16 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
break
;
}
}
//增加字数校验,每一层不能超过100字
for
(
int
i
=
0
;
i
<
nodes
.
length
;
i
++)
{
String
nodeStr
=
nodes
[
i
];
if
(
StringUtils
.
isNotEmpty
(
nodeStr
)){
if
(
nodeStr
.
trim
().
length
()>
100
){
stringBuilder
.
append
(
Translator
.
get
(
"module"
)
+
Translator
.
get
(
"test_track.length_less_than"
)
+
"100:"
+
nodeStr
);
break
;
}
}
}
}
// if (StringUtils.equals(data.getType(), TestCaseConstants.Type.Functional.getValue()) && StringUtils.equals(data.getMethod(), TestCaseConstants.Method.Auto.getValue())) {
...
...
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/track/controller/TestPlanController.java
+
2
-
2
View file @
c4cf9b28
...
...
@@ -91,8 +91,8 @@ public class TestPlanController {
@PostMapping
(
"/edit"
)
@RequiresRoles
(
value
=
{
RoleConstants
.
TEST_USER
,
RoleConstants
.
TEST_MANAGER
},
logical
=
Logical
.
OR
)
public
void
editTestPlan
(
@RequestBody
TestPlanDTO
testPlanDTO
)
{
testPlanService
.
editTestPlan
(
testPlanDTO
,
true
);
public
String
editTestPlan
(
@RequestBody
TestPlanDTO
testPlanDTO
)
{
return
testPlanService
.
editTestPlan
(
testPlanDTO
,
true
);
}
@PostMapping
(
"/edit/status/{planId}"
)
...
...
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/track/service/TestPlanService.java
+
2
-
2
View file @
c4cf9b28
...
...
@@ -176,7 +176,7 @@ public class TestPlanService {
return
Optional
.
ofNullable
(
testPlanMapper
.
selectByPrimaryKey
(
testPlanId
)).
orElse
(
new
TestPlan
());
}
public
in
t
editTestPlan
(
TestPlanDTO
testPlan
,
Boolean
isSendMessage
)
{
public
Str
in
g
editTestPlan
(
TestPlanDTO
testPlan
,
Boolean
isSendMessage
)
{
checkTestPlanExist
(
testPlan
);
TestPlan
res
=
testPlanMapper
.
selectByPrimaryKey
(
testPlan
.
getId
());
// 先查一次库
testPlan
.
setUpdateTime
(
System
.
currentTimeMillis
());
...
...
@@ -230,7 +230,7 @@ public class TestPlanService {
.
build
();
noticeSendService
.
send
(
NoticeConstants
.
TaskType
.
TEST_PLAN_TASK
,
noticeModel
);
}
return
i
;
return
testPlan
.
getId
()
;
}
//计划内容
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/api/definition/ApiDefinition.vue
+
1
-
1
View file @
c4cf9b28
...
...
@@ -392,8 +392,8 @@
}
},
runTest
(
data
)
{
this
.
setTabTitle
(
data
);
this
.
handleTabsEdit
(
this
.
$t
(
"
commons.api
"
),
"
TEST
"
,
data
);
this
.
setTabTitle
(
data
);
},
saveApi
(
data
)
{
this
.
setTabTitle
(
data
);
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/api/definition/components/Run.vue
+
12
-
8
View file @
c4cf9b28
...
...
@@ -58,22 +58,26 @@
}
},
run
()
{
let
projectId
=
this
.
$store
.
state
.
projectId
;
// 如果envMap不存在,是单接口调用
if
(
!
this
.
envMap
||
this
.
envMap
.
size
===
0
)
{
projectId
=
this
.
$store
.
state
.
projectId
;
}
else
{
// 场景步骤下接口调用
if
(
this
.
runData
.
projectId
){
projectId
=
this
.
runData
.
projectId
;
}
}
let
testPlan
=
new
TestPlan
();
let
threadGroup
=
new
ThreadGroup
();
threadGroup
.
hashTree
=
[];
testPlan
.
hashTree
=
[
threadGroup
];
this
.
runData
.
forEach
(
item
=>
{
item
.
projectId
=
projectId
;
threadGroup
.
hashTree
.
push
(
item
);
})
let
projectId
=
""
;
// 如果envMap不存在,是单接口调用
if
(
!
this
.
envMap
||
this
.
envMap
.
size
===
0
)
{
projectId
=
this
.
$store
.
state
.
projectId
;
}
else
{
// 场景步骤下接口调用
projectId
=
this
.
runData
.
projectId
;
}
let
reqObj
=
{
id
:
this
.
reportId
,
testElement
:
testPlan
,
type
:
this
.
type
,
projectId
:
projectId
,
environmentMap
:
strMapToObj
(
this
.
envMap
)};
let
bodyFiles
=
getBodyUploadFiles
(
reqObj
,
this
.
runData
);
let
url
=
""
;
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue
+
9
-
7
View file @
c4cf9b28
...
...
@@ -27,7 +27,7 @@
<i
class=
"icon el-icon-arrow-right"
:class=
"
{'is-active': apiCase.active}" @click="active(apiCase)"/>
<el-input
v-if=
"!apiCase.id || isShowInput"
size=
"small"
v-model=
"apiCase.name"
:name=
"index"
:key=
"index"
class=
"ms-api-header-select"
style=
"width: 180px"
@
blur=
"saveTestCase(apiCase)"
:placeholder=
"$t('commons.input_name')"
ref=
"nameEdit"
/>
@
blur=
"saveTestCase(apiCase
,true
)"
:placeholder=
"$t('commons.input_name')"
ref=
"nameEdit"
/>
<span
v-else
>
{{
apiCase
.
id
?
apiCase
.
name
:
''
}}
<i
class=
"el-icon-edit"
style=
"cursor:pointer"
@
click=
"showInput(apiCase)"
v-tester
/>
...
...
@@ -48,7 +48,7 @@
<el-col
:span=
"4"
>
<div
class=
"tag-item"
@
click.stop
>
<ms-input-tag
:currentScenario=
"apiCase"
ref=
"tag"
@
keyup.enter.native=
"saveTestCase(apiCase)"
/>
<ms-input-tag
:currentScenario=
"apiCase"
ref=
"tag"
@
keyup.enter.native=
"saveTestCase(apiCase
,true
)"
/>
</div>
</el-col>
...
...
@@ -291,7 +291,7 @@
}
});
},
saveCase
(
row
)
{
saveCase
(
row
,
hideAlert
)
{
let
tmp
=
JSON
.
parse
(
JSON
.
stringify
(
row
));
this
.
isShowInput
=
false
;
if
(
this
.
validate
(
tmp
))
{
...
...
@@ -328,16 +328,18 @@
row
.
createTime
=
data
.
createTime
;
row
.
updateTime
=
data
.
updateTime
;
if
(
!
row
.
message
)
{
this
.
$success
(
this
.
$t
(
'
commons.save_success
'
));
this
.
$emit
(
'
refresh
'
);
if
(
!
hideAlert
){
this
.
$success
(
this
.
$t
(
'
commons.save_success
'
));
this
.
$emit
(
'
refresh
'
);
}
}
});
},
saveTestCase
(
row
)
{
saveTestCase
(
row
,
hideAlert
)
{
if
(
this
.
api
.
saved
)
{
this
.
addModule
(
row
);
}
else
{
this
.
saveCase
(
row
);
this
.
saveCase
(
row
,
hideAlert
);
}
},
showInput
(
row
)
{
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/api/definition/components/case/ApiCaseList.vue
+
2
-
0
View file @
c4cf9b28
...
...
@@ -306,6 +306,8 @@
this
.
$warning
(
this
.
$t
(
'
api_test.environment.select_environment
'
));
return
;
}
this
.
envMap
=
new
Map
();
this
.
envMap
.
set
(
this
.
$store
.
state
.
projectId
,
this
.
environment
);
this
.
runData
=
[];
this
.
batchLoadingIds
=
[];
this
.
selectdCases
=
[];
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/api/definition/components/list/ApiList.vue
+
14
-
5
View file @
c4cf9b28
...
...
@@ -248,6 +248,7 @@ import {Api_List} from "@/business/components/common/model/JsonData";
import
HeaderCustom
from
"
@/business/components/common/head/HeaderCustom
"
;
import
HeaderLabelOperate
from
"
@/business/components/common/head/HeaderLabelOperate
"
;
import
{
Body
}
from
"
@/business/components/api/definition/model/ApiTestModel
"
;
import
{
buildNodePath
}
from
"
@/business/components/api/definition/model/NodeTree
"
;
export
default
{
...
...
@@ -768,13 +769,21 @@ export default {
});
},
buildApiPath
(
apis
)
{
apis
.
forEach
((
api
)
=>
{
try
{
let
options
=
[];
this
.
moduleOptions
.
forEach
(
item
=>
{
if
(
api
.
moduleId
===
item
.
id
)
{
api
.
modulePath
=
item
.
path
;
}
buildNodePath
(
item
,
{
path
:
''
},
options
);
});
});
apis
.
forEach
((
api
)
=>
{
options
.
forEach
((
item
)
=>
{
if
(
api
.
moduleId
===
item
.
id
)
{
api
.
modulePath
=
item
.
path
;
}
})
});
}
catch
(
e
)
{
console
.
log
(
e
);
}
},
sort
(
column
)
{
// 每次只对一个字段排序
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/api/definition/components/module/ApiModule.vue
+
1
-
6
View file @
c4cf9b28
...
...
@@ -133,16 +133,11 @@
this
.
data
.
forEach
(
node
=>
{
buildTree
(
node
,
{
path
:
''
});
});
this
.
$emit
(
'
setModuleOptions
'
,
this
.
data
);
this
.
$emit
(
'
setNodeTree
'
,
this
.
data
);
if
(
this
.
$refs
.
nodeTree
)
{
this
.
$refs
.
nodeTree
.
filter
(
this
.
condition
.
filterText
);
}
let
moduleOptions
=
[];
this
.
data
.
forEach
(
node
=>
{
buildNodePath
(
node
,
{
path
:
''
},
moduleOptions
);
});
this
.
moduleOptions
=
moduleOptions
;
this
.
$emit
(
'
setModuleOptions
'
,
moduleOptions
);
}
});
},
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/api/homepage/components/SceneInfoCard.vue
+
6
-
2
View file @
c4cf9b28
...
...
@@ -68,7 +68,7 @@
</el-aside>
<el-main
style=
"padding: 0px 0px 0px 0px; line-height: 40px; text-align: center;"
>
<span
v-if=
"interfaceCoverage === 'waitting...'"
>
{{
interfaceCoverage
}}
<i
class=
"el-icon-loading lading-icon"
></i>
</span>
<span
v-else
class=
"rows-count-number"
>
{{
interfaceCoverage
}}
...
...
@@ -161,7 +161,11 @@ export default {
color
:
var
(
--count_number
);
margin
:
20px
auto
;
}
.lading-icon
{
font-size
:
25px
;
color
:
var
(
--count_number
);
font-weight
:
bold
;
}
.main-number-show
{
width
:
100px
;
height
:
100px
;
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/common/select-tree/SelectTree.vue
+
5
-
2
View file @
c4cf9b28
...
...
@@ -379,14 +379,17 @@
.common-tree
{
overflow
:
auto
;
height
:
200px
;
min-height
:
200px
;
max-height
:
400px
;
}
.ms-tree-select
{
width
:
100%
;
z-index
:
111
;
}
/
deep
/
.el-tree-node__children
{
overflow
:
inherit
;
}
.ok
{
float
:
right
;
}
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseEdit.vue
+
2
-
1
View file @
c4cf9b28
...
...
@@ -711,7 +711,7 @@ export default {
.border-hidden
>>>
.el-textarea__inner
{
border-style
:
hidden
;
background-color
:
white
;
color
:
#
6
06
266
;
color
:
#06
0505
;
}
.cast_label
{
...
...
@@ -785,4 +785,5 @@ p {
height
:
550px
;
overflow
:
auto
;
}
</
style
>
This diff is collapsed.
Click to expand it.
frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue
+
6
-
0
View file @
c4cf9b28
...
...
@@ -549,4 +549,10 @@ export default {
.comment-card
>>>
.el-card__body
{
height
:
calc
(
100vh
-
120px
);
}
.tb-edit
>>>
.el-textarea__inner
{
border-style
:
hidden
;
background-color
:
white
;
color
:
#060505
;
}
</
style
>
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment