Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
489077ad
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 3 年多
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
489077ad
编写于
3月 17, 2021
作者:
C
Captain.B
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
8170ffe3
e58dcf4d
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
137 addition
and
198 deletion
+137
-198
backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java
...o/metersphere/api/controller/ApiAutomationController.java
+1
-1
backend/src/main/java/io/metersphere/api/dto/automation/ApiScenarioDTO.java
...ava/io/metersphere/api/dto/automation/ApiScenarioDTO.java
+2
-0
backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java
...java/io/metersphere/api/service/ApiAutomationService.java
+26
-26
backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml
...a/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml
+0
-2
backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java
...ersphere/track/controller/TestPlanTestCaseController.java
+6
-0
backend/src/main/java/io/metersphere/track/service/TestCaseReviewScenarioCaseService.java
...here/track/service/TestCaseReviewScenarioCaseService.java
+0
-37
backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java
...etersphere/track/service/TestPlanScenarioCaseService.java
+0
-31
backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java
...io/metersphere/track/service/TestPlanTestCaseService.java
+7
-0
backend/src/main/java/io/metersphere/track/service/TestReviewTestCaseService.java
.../metersphere/track/service/TestReviewTestCaseService.java
+2
-0
frontend/package.json
frontend/package.json
+1
-1
frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue
...ss/components/api/automation/scenario/ApiScenarioList.vue
+3
-11
frontend/src/business/components/api/automation/scenario/testplan/TestPlanList.vue
...ponents/api/automation/scenario/testplan/TestPlanList.vue
+8
-3
frontend/src/business/components/common/components/MsModuleMinder.vue
.../business/components/common/components/MsModuleMinder.vue
+7
-0
frontend/src/business/components/common/head/HeaderCustom.vue
...tend/src/business/components/common/head/HeaderCustom.vue
+0
-1
frontend/src/business/components/track/case/components/BatchEdit.vue
...c/business/components/track/case/components/BatchEdit.vue
+19
-6
frontend/src/business/components/track/case/components/TestCaseEdit.vue
...usiness/components/track/case/components/TestCaseEdit.vue
+0
-2
frontend/src/business/components/track/common/minder/TestCaseMinder.vue
...usiness/components/track/common/minder/TestCaseMinder.vue
+2
-0
frontend/src/business/components/track/common/minder/TestPlanMinder.vue
...usiness/components/track/common/minder/TestPlanMinder.vue
+39
-56
frontend/src/business/components/track/common/minder/TestReviewMinder.vue
...iness/components/track/common/minder/TestReviewMinder.vue
+3
-5
frontend/src/business/components/track/common/minder/minderUtils.js
...rc/business/components/track/common/minder/minderUtils.js
+3
-3
frontend/src/business/components/track/plan/view/comonents/api/RelevanceScenarioList.vue
...s/track/plan/view/comonents/api/RelevanceScenarioList.vue
+5
-2
frontend/src/business/components/track/plan/view/comonents/api/TestCaseScenarioRelevance.vue
...ack/plan/view/comonents/api/TestCaseScenarioRelevance.vue
+1
-5
frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue
...track/plan/view/comonents/api/TestPlanApiScenarioList.vue
+2
-6
未找到文件。
backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java
浏览文件 @
489077ad
...
...
@@ -86,7 +86,7 @@ public class ApiAutomationController {
}
@GetMapping
(
"/getApiScenario/{id}"
)
public
ApiScenario
getScenarioDefinition
(
@PathVariable
String
id
)
{
public
ApiScenario
DTO
getScenarioDefinition
(
@PathVariable
String
id
)
{
return
apiAutomationService
.
getApiScenario
(
id
);
}
...
...
backend/src/main/java/io/metersphere/api/dto/automation/ApiScenarioDTO.java
浏览文件 @
489077ad
...
...
@@ -18,4 +18,6 @@ public class ApiScenarioDTO extends ApiScenarioWithBLOBs {
* 场景跨项目ID
*/
private
List
<
String
>
projectIds
;
private
String
caseId
;
}
backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java
浏览文件 @
489077ad
...
...
@@ -94,42 +94,38 @@ public class ApiAutomationService {
public
List
<
ApiScenarioDTO
>
list
(
ApiScenarioRequest
request
)
{
request
=
this
.
initRequest
(
request
,
true
,
true
);
List
<
ApiScenarioDTO
>
list
=
extApiScenarioMapper
.
list
(
request
);
setApiScenarioProjectIds
(
list
);
return
list
;
}
public
List
<
ApiScenarioDTO
>
listReview
(
ApiScenarioRequest
request
)
{
request
=
this
.
initRequest
(
request
,
true
,
true
);
List
<
ApiScenarioDTO
>
list
=
extApiScenarioMapper
.
listReview
(
request
);
setApiScenarioProjectIds
(
list
);
return
list
;
}
private
void
setApiScenarioProjectIds
(
List
<
ApiScenarioDTO
>
list
)
{
private
void
setApiScenarioProjectIds
(
ApiScenarioDTO
data
)
{
// 如果场景步骤涉及多项目,则把涉及到的项目ID保存在projectIds属性
list
.
forEach
(
data
->
{
List
<
String
>
idList
=
new
ArrayList
<>();
String
definition
=
data
.
getScenarioDefinition
();
if
(
StringUtils
.
isNotBlank
(
definition
))
{
RunDefinitionRequest
d
=
JSON
.
parseObject
(
definition
,
RunDefinitionRequest
.
class
);
if
(
d
!=
null
)
{
Map
<
String
,
String
>
map
=
d
.
getEnvironmentMap
();
if
(
map
!=
null
)
{
if
(
map
.
isEmpty
())
{
List
<
String
>
ids
=
(
List
<
String
>)
JSONPath
.
read
(
definition
,
"$..projectId"
);
idList
.
addAll
(
new
HashSet
<>(
ids
));
}
else
{
Set
<
String
>
set
=
d
.
getEnvironmentMap
().
keySet
();
idList
=
new
ArrayList
<>(
set
);
}
List
<
String
>
idList
=
new
ArrayList
<>();
String
definition
=
data
.
getScenarioDefinition
();
if
(
StringUtils
.
isNotBlank
(
definition
))
{
RunDefinitionRequest
d
=
JSON
.
parseObject
(
definition
,
RunDefinitionRequest
.
class
);
if
(
d
!=
null
)
{
Map
<
String
,
String
>
map
=
d
.
getEnvironmentMap
();
if
(
map
!=
null
)
{
if
(
map
.
isEmpty
())
{
List
<
String
>
ids
=
(
List
<
String
>)
JSONPath
.
read
(
definition
,
"$..projectId"
);
idList
.
addAll
(
new
HashSet
<>(
ids
));
}
else
{
// 兼容历史数据,无EnvironmentMap直接赋值场景所属项目
idList
.
add
(
data
.
getProjectId
()
);
Set
<
String
>
set
=
d
.
getEnvironmentMap
().
keySet
();
idList
=
new
ArrayList
<>(
set
);
}
}
else
{
// 兼容历史数据,无EnvironmentMap直接赋值场景所属项目
idList
.
add
(
data
.
getProjectId
());
}
}
data
.
setProjectIds
(
idList
);
});
}
data
.
setProjectIds
(
idList
);
}
/**
...
...
@@ -333,8 +329,12 @@ public class ApiAutomationService {
}
}
public
ApiScenarioWithBLOBs
getApiScenario
(
String
id
)
{
return
apiScenarioMapper
.
selectByPrimaryKey
(
id
);
public
ApiScenarioDTO
getApiScenario
(
String
id
)
{
ApiScenarioDTO
apiScenarioDTO
=
new
ApiScenarioDTO
();
ApiScenarioWithBLOBs
scenarioWithBLOBs
=
apiScenarioMapper
.
selectByPrimaryKey
(
id
);
BeanUtils
.
copyBean
(
apiScenarioDTO
,
scenarioWithBLOBs
);
setApiScenarioProjectIds
(
apiScenarioDTO
);
return
apiScenarioDTO
;
}
public
List
<
ApiScenarioWithBLOBs
>
getApiScenarios
(
List
<
String
>
ids
)
{
...
...
backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml
浏览文件 @
489077ad
...
...
@@ -134,7 +134,6 @@
</sql>
<select
id=
"list"
resultMap=
"BaseResultMap"
>
select api_scenario.id, api_scenario.project_id, api_scenario.tags, api_scenario.user_id, api_scenario.num,
api_scenario.scenario_definition,
api_scenario.api_scenario_module_id,api_scenario.module_path, api_scenario.name, api_scenario.level,
api_scenario.status, api_scenario.principal, api_scenario.step_total, api_scenario.follow_people,
api_scenario.last_result,api_scenario.pass_rate,api_scenario.report_id,
...
...
@@ -339,7 +338,6 @@
</select>
<select
id=
"listReview"
resultMap=
"BaseResultMap"
>
select api_scenario.id, api_scenario.project_id, api_scenario.tags, api_scenario.user_id, api_scenario.num,
api_scenario.scenario_definition,
api_scenario.api_scenario_module_id,api_scenario.module_path, api_scenario.name, api_scenario.level,
api_scenario.status, api_scenario.principal, api_scenario.step_total, api_scenario.follow_people,
api_scenario.last_result,api_scenario.pass_rate,api_scenario.report_id,
...
...
backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java
浏览文件 @
489077ad
...
...
@@ -101,6 +101,12 @@ public class TestPlanTestCaseController {
testPlanTestCaseService
.
editTestCase
(
testPlanTestCase
);
}
@PostMapping
(
"/minder/edit"
)
@RequiresRoles
(
value
=
{
RoleConstants
.
TEST_USER
,
RoleConstants
.
TEST_MANAGER
},
logical
=
Logical
.
OR
)
public
void
editTestCaseForMinder
(
@RequestBody
List
<
TestPlanTestCaseWithBLOBs
>
testPlanTestCases
)
{
testPlanTestCaseService
.
editTestCaseForMinder
(
testPlanTestCases
);
}
@PostMapping
(
"/batch/edit"
)
@RequiresRoles
(
value
=
{
RoleConstants
.
TEST_USER
,
RoleConstants
.
TEST_MANAGER
},
logical
=
Logical
.
OR
)
public
void
editTestCaseBath
(
@RequestBody
TestPlanCaseBatchRequest
request
)
{
...
...
backend/src/main/java/io/metersphere/track/service/TestCaseReviewScenarioCaseService.java
浏览文件 @
489077ad
package
io.metersphere.track.service
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONPath
;
import
io.metersphere.api.dto.automation.ApiScenarioDTO
;
import
io.metersphere.api.dto.automation.ApiScenarioRequest
;
import
io.metersphere.api.dto.automation.RunScenarioRequest
;
import
io.metersphere.api.dto.automation.TestPlanScenarioRequest
;
import
io.metersphere.api.dto.definition.RunDefinitionRequest
;
import
io.metersphere.api.service.ApiAutomationService
;
import
io.metersphere.api.service.ApiScenarioReportService
;
import
io.metersphere.base.domain.TestCaseReviewScenario
;
import
io.metersphere.base.domain.TestCaseReviewScenarioExample
;
import
io.metersphere.base.domain.TestPlanApiScenario
;
import
io.metersphere.base.domain.TestPlanApiScenarioExample
;
import
io.metersphere.base.mapper.TestCaseReviewScenarioMapper
;
import
io.metersphere.base.mapper.TestPlanApiScenarioMapper
;
import
io.metersphere.base.mapper.ext.ExtTestCaseReviewScenarioCaseMapper
;
import
io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper
;
import
io.metersphere.commons.constants.ApiRunMode
;
import
io.metersphere.commons.utils.ServiceUtils
;
import
io.metersphere.track.dto.RelevanceScenarioRequest
;
...
...
@@ -45,46 +39,15 @@ public class TestCaseReviewScenarioCaseService {
request
.
setProjectId
(
null
);
request
.
setOrders
(
ServiceUtils
.
getDefaultOrder
(
request
.
getOrders
()));
List
<
ApiScenarioDTO
>
apiTestCases
=
extTestCaseReviewScenarioCaseMapper
.
list
(
request
);
setApiScenarioProjectIds
(
apiTestCases
);
if
(
CollectionUtils
.
isEmpty
(
apiTestCases
))
{
return
apiTestCases
;
}
return
apiTestCases
;
}
private
void
setApiScenarioProjectIds
(
List
<
ApiScenarioDTO
>
list
)
{
// 如果场景步骤涉及多项目,则把涉及到的项目ID保存在projectIds属性
list
.
forEach
(
data
->
{
List
<
String
>
idList
=
new
ArrayList
<>();
String
definition
=
data
.
getScenarioDefinition
();
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotBlank
(
definition
))
{
RunDefinitionRequest
d
=
JSON
.
parseObject
(
definition
,
RunDefinitionRequest
.
class
);
if
(
d
!=
null
)
{
Map
<
String
,
String
>
map
=
d
.
getEnvironmentMap
();
if
(
map
!=
null
)
{
if
(
map
.
isEmpty
())
{
List
<
String
>
ids
=
(
List
<
String
>)
JSONPath
.
read
(
definition
,
"$..projectId"
);
idList
.
addAll
(
new
HashSet
<>(
ids
));
}
else
{
Set
<
String
>
set
=
d
.
getEnvironmentMap
().
keySet
();
idList
=
new
ArrayList
<>(
set
);
}
}
else
{
// 兼容历史数据,无EnvironmentMap直接赋值场景所属项目
idList
.
add
(
data
.
getProjectId
());
}
}
}
data
.
setProjectIds
(
idList
);
});
}
public
List
<
ApiScenarioDTO
>
relevanceList
(
ApiScenarioRequest
request
)
{
request
.
setNotInTestPlan
(
true
);
List
<
ApiScenarioDTO
>
list
=
apiAutomationService
.
listReview
(
request
);
setApiScenarioProjectIds
(
list
);
return
list
;
}
...
...
backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java
浏览文件 @
489077ad
...
...
@@ -42,46 +42,15 @@ public class TestPlanScenarioCaseService {
request
.
setProjectId
(
null
);
request
.
setOrders
(
ServiceUtils
.
getDefaultOrder
(
request
.
getOrders
()));
List
<
ApiScenarioDTO
>
apiTestCases
=
extTestPlanScenarioCaseMapper
.
list
(
request
);
setApiScenarioProjectIds
(
apiTestCases
);
if
(
CollectionUtils
.
isEmpty
(
apiTestCases
))
{
return
apiTestCases
;
}
return
apiTestCases
;
}
private
void
setApiScenarioProjectIds
(
List
<
ApiScenarioDTO
>
list
)
{
// 如果场景步骤涉及多项目,则把涉及到的项目ID保存在projectIds属性
list
.
forEach
(
data
->
{
List
<
String
>
idList
=
new
ArrayList
<>();
String
definition
=
data
.
getScenarioDefinition
();
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotBlank
(
definition
))
{
RunDefinitionRequest
d
=
JSON
.
parseObject
(
definition
,
RunDefinitionRequest
.
class
);
if
(
d
!=
null
)
{
Map
<
String
,
String
>
map
=
d
.
getEnvironmentMap
();
if
(
map
!=
null
)
{
if
(
map
.
isEmpty
())
{
List
<
String
>
ids
=
(
List
<
String
>)
JSONPath
.
read
(
definition
,
"$..projectId"
);
idList
.
addAll
(
new
HashSet
<>(
ids
));
}
else
{
Set
<
String
>
set
=
d
.
getEnvironmentMap
().
keySet
();
idList
=
new
ArrayList
<>(
set
);
}
}
else
{
// 兼容历史数据,无EnvironmentMap直接赋值场景所属项目
idList
.
add
(
data
.
getProjectId
());
}
}
}
data
.
setProjectIds
(
idList
);
});
}
public
List
<
ApiScenarioDTO
>
relevanceList
(
ApiScenarioRequest
request
)
{
request
.
setNotInTestPlan
(
true
);
List
<
ApiScenarioDTO
>
list
=
apiAutomationService
.
list
(
request
);
setApiScenarioProjectIds
(
list
);
return
list
;
}
...
...
backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java
浏览文件 @
489077ad
...
...
@@ -154,4 +154,11 @@ public class TestPlanTestCaseService {
public
List
<
TestPlanCaseDTO
>
listForMinder
(
String
planId
)
{
return
extTestPlanTestCaseMapper
.
listForMinder
(
planId
);
}
public
void
editTestCaseForMinder
(
List
<
TestPlanTestCaseWithBLOBs
>
testPlanTestCases
)
{
testPlanTestCases
.
forEach
(
item
->
{
item
.
setUpdateTime
(
System
.
currentTimeMillis
());
testPlanTestCaseMapper
.
updateByPrimaryKeySelective
(
item
);
});
}
}
backend/src/main/java/io/metersphere/track/service/TestReviewTestCaseService.java
浏览文件 @
489077ad
...
...
@@ -172,6 +172,8 @@ public class TestReviewTestCaseService {
testCase
.
setId
(
item
.
getCaseId
());
testCase
.
setReviewStatus
(
item
.
getStatus
());
testCaseList
.
add
(
testCase
);
testCase
.
setUpdateTime
(
System
.
currentTimeMillis
());
item
.
setUpdateTime
(
System
.
currentTimeMillis
());
testCaseReviewTestCaseMapper
.
updateByPrimaryKeySelective
(
item
);
});
testCaseList
.
forEach
(
testCaseMapper:
:
updateByPrimaryKeySelective
);
...
...
frontend/package.json
浏览文件 @
489077ad
...
...
@@ -49,7 +49,7 @@
"xml-js"
:
"^1.6.11"
,
"yan-progress"
:
"^1.0.3"
,
"jsonpath"
:
"^1.1.0"
,
"vue-minder-editor-plus"
:
"^1.0.1
7
"
,
"vue-minder-editor-plus"
:
"^1.0.1
8
"
,
"jsencrypt"
:
"^3.1.0"
},
"devDependencies"
:
{
...
...
frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue
浏览文件 @
489077ad
...
...
@@ -439,7 +439,7 @@
},
handleBatchEdit
()
{
this
.
$refs
.
batchEdit
.
open
(
this
.
selectDataCounts
);
this
.
$refs
.
batchEdit
.
setScenarioSelectRows
(
this
.
selectRows
);
this
.
$refs
.
batchEdit
.
setScenarioSelectRows
(
this
.
selectRows
,
"
scenario
"
);
},
handleBatchMove
()
{
this
.
$refs
.
testBatchMove
.
open
(
this
.
moduleTree
,
[],
this
.
moduleOptions
);
...
...
@@ -457,11 +457,7 @@
// 批量修改环境
if
(
form
.
type
===
'
projectEnv
'
)
{
let
param
=
{};
let
map
=
new
Map
();
this
.
selectRows
.
forEach
(
row
=>
{
map
.
set
(
row
.
id
,
row
.
projectIds
);
})
param
.
mapping
=
strMapToObj
(
map
);
param
.
mapping
=
strMapToObj
(
form
.
map
);
param
.
envMap
=
strMapToObj
(
form
.
projectEnvMap
);
this
.
$post
(
'
/api/automation/batch/update/env
'
,
param
,
()
=>
{
this
.
$success
(
this
.
$t
(
'
commons.save_success
'
));
...
...
@@ -519,11 +515,7 @@
this
.
planVisible
=
false
;
let
map
=
new
Map
();
this
.
selectRows
.
forEach
(
row
=>
{
map
.
set
(
row
.
id
,
row
.
projectIds
);
})
obj
.
mapping
=
strMapToObj
(
map
);
obj
.
mapping
=
strMapToObj
(
params
[
2
]);
obj
.
envMap
=
strMapToObj
(
params
[
1
]);
this
.
$post
(
"
/api/automation/scenario/plan
"
,
obj
,
response
=>
{
...
...
frontend/src/business/components/api/automation/scenario/testplan/TestPlanList.vue
浏览文件 @
489077ad
...
...
@@ -195,7 +195,8 @@ export default {
],
projectEnvMap
:
new
Map
(),
projectList
:
[],
projectIds
:
new
Set
()
projectIds
:
new
Set
(),
map
:
new
Map
(),
}
},
watch
:
{
...
...
@@ -221,7 +222,7 @@ export default {
if
(
!
sign
)
{
return
false
;
}
this
.
$emit
(
'
addTestPlan
'
,
this
.
selection
,
this
.
projectEnvMap
);
this
.
$emit
(
'
addTestPlan
'
,
this
.
selection
,
this
.
projectEnvMap
,
this
.
map
);
}
},
cancel
(){
...
...
@@ -237,7 +238,11 @@ export default {
setScenarioSelectRows
(
rows
)
{
this
.
projectIds
.
clear
();
rows
.
forEach
(
row
=>
{
row
.
projectIds
.
forEach
(
id
=>
this
.
projectIds
.
add
(
id
));
this
.
result
=
this
.
$get
(
'
/api/automation/getApiScenario/
'
+
row
.
id
,
res
=>
{
let
data
=
res
.
data
;
data
.
projectIds
.
forEach
(
d
=>
this
.
projectIds
.
add
(
d
));
this
.
map
.
set
(
row
.
id
,
data
.
projectIds
);
})
})
},
initTableData
()
{
...
...
frontend/src/business/components/common/components/MsModuleMinder.vue
浏览文件 @
489077ad
...
...
@@ -7,6 +7,7 @@
:height=
"700"
:progress-enable=
"false"
:tags=
"tags"
:distinct-tags=
"distinctTags"
@
save=
"save"
/>
</div>
...
...
@@ -36,6 +37,12 @@ export default {
return
[]
}
},
distinctTags
:
{
type
:
Array
,
default
()
{
return
[]
}
}
},
data
()
{
return
{
...
...
frontend/src/business/components/common/head/HeaderCustom.vue
浏览文件 @
489077ad
...
...
@@ -54,7 +54,6 @@ export default {
/*this.optionalField = items*/
},
saveHeader
()
{
console
.
log
(
this
.
type
)
let
param
=
{
userId
:
getCurrentUser
().
id
,
type
:
this
.
type
,
...
...
frontend/src/business/components/track/case/components/BatchEdit.vue
浏览文件 @
489077ad
...
...
@@ -7,6 +7,7 @@
class=
"batch-edit-dialog"
:destroy-on-close=
"true"
@
close=
"handleClose"
v-loading=
"result.loading"
>
<el-form
:model=
"form"
label-position=
"right"
label-width=
"150px"
size=
"medium"
ref=
"form"
:rules=
"rules"
>
<el-form-item
:label=
"$t('test_track.case.batch_update', [size])"
prop=
"type"
>
...
...
@@ -72,7 +73,10 @@
projectList
:
[],
projectIds
:
new
Set
(),
selectRows
:
new
Set
(),
projectEnvMap
:
new
Map
()
projectEnvMap
:
new
Map
(),
map
:
new
Map
(),
isScenario
:
''
,
result
:
{}
}
},
methods
:
{
...
...
@@ -84,6 +88,7 @@
if
(
!
this
.
$refs
.
envPopover
.
checkEnv
())
{
return
false
;
}
this
.
form
.
map
=
this
.
map
;
}
this
.
$emit
(
"
batchEdit
"
,
this
.
form
);
this
.
dialogVisible
=
false
;
...
...
@@ -113,12 +118,9 @@
this
.
projectIds
.
add
(
row
.
projectId
)
})
},
setScenarioSelectRows
(
rows
)
{
setScenarioSelectRows
(
rows
,
sign
)
{
this
.
selectRows
=
rows
;
this
.
projectIds
.
clear
();
this
.
selectRows
.
forEach
(
row
=>
{
row
.
projectIds
.
forEach
(
id
=>
this
.
projectIds
.
add
(
id
));
})
this
.
isScenario
=
sign
;
},
handleClose
()
{
this
.
form
=
{};
...
...
@@ -127,6 +129,17 @@
},
changeType
(
val
)
{
this
.
$set
(
this
.
form
,
"
value
"
,
""
);
if
(
val
===
'
projectEnv
'
&&
this
.
isScenario
!==
''
)
{
this
.
projectIds
.
clear
();
this
.
selectRows
.
forEach
(
row
=>
{
let
id
=
this
.
isScenario
===
'
scenario
'
?
row
.
id
:
row
.
caseId
;
this
.
result
=
this
.
$get
(
'
/api/automation/getApiScenario/
'
+
id
,
res
=>
{
let
data
=
res
.
data
;
data
.
projectIds
.
forEach
(
d
=>
this
.
projectIds
.
add
(
d
));
this
.
map
.
set
(
row
.
id
,
data
.
projectIds
);
})
})
}
this
.
filterable
=
val
===
"
maintainer
"
||
val
===
"
executor
"
;
this
.
options
=
this
.
valueArr
[
val
];
this
.
typeArr
.
forEach
(
item
=>
{
...
...
frontend/src/business/components/track/case/components/TestCaseEdit.vue
浏览文件 @
489077ad
...
...
@@ -679,8 +679,6 @@ export default {
return
param
;
},
getOption
(
param
)
{
console
.
log
(
this
.
type
)
console
.
log
(
"
3452
"
)
let
formData
=
new
FormData
();
let
type
=
this
.
type
if
(
this
.
type
===
'
copy
'
)
{
...
...
frontend/src/business/components/track/common/minder/TestCaseMinder.vue
浏览文件 @
489077ad
...
...
@@ -3,6 +3,7 @@
v-loading=
"result.loading"
:tree-nodes=
"treeNodes"
:data-map=
"dataMap"
:tags=
"tags"
@
save=
"save"
/>
</
template
>
...
...
@@ -17,6 +18,7 @@ name: "TestCaseMinder",
return
{
testCase
:
[],
dataMap
:
new
Map
(),
tags
:
[
'
用例
'
,
'
前置条件
'
,
'
备注
'
],
result
:
{}
}
},
...
...
frontend/src/business/components/track/common/minder/TestPlanMinder.vue
浏览文件 @
489077ad
...
...
@@ -3,6 +3,8 @@
v-loading=
"result.loading"
:tree-nodes=
"treeNodes"
:data-map=
"dataMap"
:tags=
"tags"
:distinct-tags=
"[...tags, '未开始']"
@
save=
"save"
/>
</
template
>
...
...
@@ -15,9 +17,9 @@ name: "TestPlanMinder",
components
:
{
MsModuleMinder
},
data
()
{
return
{
testCase
:
[],
dataMap
:
new
Map
(),
result
:
{}
result
:
{},
tags
:
[
'
通过
'
,
'
失败
'
,
'
阻塞
'
,
'
跳过
'
],
}
},
props
:
{
...
...
@@ -44,24 +46,30 @@ name: "TestPlanMinder",
getTestCases
()
{
if
(
this
.
projectId
)
{
this
.
result
=
this
.
$get
(
'
/test/plan/case/list/minder/
'
+
this
.
planId
,
response
=>
{
this
.
testCase
=
response
.
data
;
this
.
dataMap
=
getTestCaseDataMap
(
this
.
testCase
);
this
.
dataMap
=
getTestCaseDataMap
(
response
.
data
,
true
,
(
data
,
item
)
=>
{
if
(
item
.
stats
===
'
Pass
'
)
{
data
.
resource
.
push
(
"
通过
"
);
}
else
if
(
item
.
reviewStatus
===
'
Failure
'
)
{
data
.
resource
.
push
(
"
失败
"
);
}
else
if
(
item
.
reviewStatus
===
'
Blocking
'
)
{
data
.
resource
.
push
(
"
阻塞
"
);
}
else
if
(
item
.
reviewStatus
===
'
Skip
'
)
{
data
.
resource
.
push
(
"
跳过
"
);
}
else
{
data
.
resource
.
push
(
"
未开始
"
);
}
});
});
}
},
save
(
data
)
{
// let saveCases = [];
// this.buildSaveCase(data.root, saveCases, undefined);
// console.log(saveCases);
// let param = {
// projectId: this.projectId,
// data: saveCases
// }
// this.result = this.$post('/test/case/minder/edit', param, () => {
// this.$success(this.$t('commons.save_success'));
// });
let
saveCases
=
[];
this
.
buildSaveCase
(
data
.
root
,
saveCases
);
this
.
result
=
this
.
$post
(
'
/test/plan/case/minder/edit
'
,
saveCases
,
()
=>
{
this
.
$success
(
this
.
$t
(
'
commons.save_success
'
));
});
},
buildSaveCase
(
root
,
saveCases
,
parent
)
{
buildSaveCase
(
root
,
saveCases
)
{
let
data
=
root
.
data
;
if
(
data
.
resource
&&
data
.
resource
.
indexOf
(
"
用例
"
)
>
-
1
)
{
this
.
_buildSaveCase
(
root
,
saveCases
,
parent
);
...
...
@@ -73,52 +81,27 @@ name: "TestPlanMinder",
}
}
},
_buildSaveCase
(
node
,
saveCases
,
parent
)
{
_buildSaveCase
(
node
,
saveCases
)
{
let
data
=
node
.
data
;
let
isChange
=
false
;
if
(
!
data
.
changed
)
{
return
;
}
let
testCase
=
{
id
:
data
.
id
,
name
:
data
.
text
,
nodeId
:
parent
?
parent
.
id
:
""
,
nodePath
:
parent
?
parent
.
path
:
""
,
type
:
data
.
type
?
data
.
type
:
'
functional
'
,
method
:
data
.
method
?
data
.
method
:
'
manual
'
,
maintainer
:
data
.
maintainer
,
priority
:
'
P
'
+
data
.
priority
,
};
if
(
data
.
changed
)
isChange
=
true
;
let
steps
=
[];
let
stepNum
=
1
;
if
(
node
.
children
)
{
node
.
children
.
forEach
((
childNode
)
=>
{
let
childData
=
childNode
.
data
;
if
(
childData
.
resource
&&
childData
.
resource
.
indexOf
(
'
前置条件
'
)
>
-
1
)
{
testCase
.
prerequisite
=
childData
.
text
;
}
else
if
(
childData
.
resource
&&
childData
.
resource
.
indexOf
(
'
备注
'
)
>
-
1
)
{
testCase
.
remark
=
childData
.
text
;
}
else
{
// 测试步骤
let
step
=
{};
step
.
num
=
stepNum
++
;
step
.
desc
=
childData
.
text
;
if
(
childNode
.
children
)
{
let
result
=
""
;
childNode
.
children
.
forEach
((
child
)
=>
{
result
+=
child
.
data
.
text
;
if
(
child
.
data
.
changed
)
isChange
=
true
;
})
step
.
result
=
result
;
}
steps
.
push
(
step
);
}
if
(
childData
.
changed
)
isChange
=
true
;
})
}
testCase
.
steps
=
JSON
.
stringify
(
steps
);
if
(
isChange
)
{
saveCases
.
push
(
testCase
);
if
(
data
.
resource
.
length
>
1
)
{
if
(
data
.
resource
.
indexOf
(
'
失败
'
)
>
-
1
)
{
testCase
.
status
=
'
Failure
'
;
}
else
if
(
data
.
resource
.
indexOf
(
'
通过
'
)
>
-
1
)
{
testCase
.
status
=
'
Pass
'
;
}
else
if
(
data
.
resource
.
indexOf
(
'
阻塞
'
)
>
-
1
)
{
testCase
.
status
=
'
Blocking
'
;
}
else
if
(
data
.
resource
.
indexOf
(
'
跳过
'
)
>
-
1
)
{
testCase
.
status
=
'
Skip
'
;
}
}
},
saveCases
.
push
(
testCase
);
}
}
}
</
script
>
...
...
frontend/src/business/components/track/common/minder/TestReviewMinder.vue
浏览文件 @
489077ad
...
...
@@ -4,6 +4,7 @@
:tree-nodes=
"treeNodes"
:data-map=
"dataMap"
:tags=
"tags"
:distinct-tags=
"[...tags, '未开始']"
@
save=
"save"
/>
</
template
>
...
...
@@ -16,7 +17,6 @@ name: "TestReviewMinder",
components
:
{
MsModuleMinder
},
data
()
{
return
{
testCase
:
[],
dataMap
:
new
Map
(),
tags
:
[
'
通过
'
,
'
不通过
'
],
result
:
{}
...
...
@@ -60,10 +60,8 @@ name: "TestReviewMinder",
}
},
save
(
data
)
{
console
.
log
(
data
);
let
saveCases
=
[];
this
.
buildSaveCase
(
data
.
root
,
saveCases
);
console
.
log
(
saveCases
);
this
.
result
=
this
.
$post
(
'
/test/review/case/minder/edit
'
,
saveCases
,
()
=>
{
this
.
$success
(
this
.
$t
(
'
commons.save_success
'
));
});
...
...
@@ -91,9 +89,9 @@ name: "TestReviewMinder",
// name: data.text,
};
if
(
data
.
resource
.
length
>
1
)
{
if
(
data
.
resource
.
indexOf
(
'
不通过
'
))
{
if
(
data
.
resource
.
indexOf
(
'
不通过
'
)
>
-
1
)
{
testCase
.
status
=
'
UnPass
'
;
}
else
if
(
data
.
resource
.
indexOf
(
'
通过
'
))
{
}
else
if
(
data
.
resource
.
indexOf
(
'
通过
'
)
>
-
1
)
{
testCase
.
status
=
'
Pass
'
;
}
}
...
...
frontend/src/business/components/track/common/minder/minderUtils.js
浏览文件 @
489077ad
...
...
@@ -42,11 +42,11 @@ function parseChildren(nodeItem, item, isDisable) {
let
children
=
[];
_parseChildren
(
children
,
item
.
prerequisite
,
"
前置条件
"
,
isDisable
);
item
.
steps
.
forEach
((
step
)
=>
{
let
descNode
=
_parseChildren
(
children
,
step
.
desc
,
"
测试步骤
"
,
isDisable
);
let
descNode
=
_parseChildren
(
children
,
step
.
desc
,
undefined
,
isDisable
);
if
(
descNode
)
{
descNode
.
data
.
num
=
step
.
num
;
descNode
.
children
=
[];
_parseChildren
(
descNode
.
children
,
step
.
result
,
"
预期结果
"
,
isDisable
);
_parseChildren
(
descNode
.
children
,
step
.
result
,
undefined
,
isDisable
);
}
});
_parseChildren
(
children
,
item
.
remark
,
"
备注
"
,
isDisable
);
...
...
@@ -58,7 +58,7 @@ function _parseChildren(children, k, v, isDisable) {
let
node
=
{
data
:
{
text
:
k
,
resource
:
[
v
]
resource
:
v
?
[
v
]
:
[
]
}
}
if
(
isDisable
)
{
...
...
frontend/src/business/components/track/plan/view/comonents/api/RelevanceScenarioList.vue
浏览文件 @
489077ad
...
...
@@ -93,6 +93,7 @@
projectEnvMap
:
new
Map
(),
projectList
:
[],
projectIds
:
new
Set
(),
map
:
new
Map
()
}
},
watch
:
{
...
...
@@ -159,8 +160,10 @@
initProjectIds
()
{
this
.
projectIds
.
clear
();
this
.
selectRows
.
forEach
(
row
=>
{
row
.
projectIds
.
forEach
(
id
=>
{
this
.
projectIds
.
add
(
id
);
this
.
result
=
this
.
$get
(
'
/api/automation/getApiScenario/
'
+
row
.
id
,
res
=>
{
let
data
=
res
.
data
;
data
.
projectIds
.
forEach
(
d
=>
this
.
projectIds
.
add
(
d
));
this
.
map
.
set
(
row
.
id
,
data
.
projectIds
);
})
})
},
...
...
frontend/src/business/components/track/plan/view/comonents/api/TestCaseScenarioRelevance.vue
浏览文件 @
489077ad
...
...
@@ -104,12 +104,8 @@
}
let
param
=
{};
let
url
=
'
/api/automation/relevance
'
;
let
rows
=
this
.
$refs
.
apiScenarioList
.
selectRows
;
const
envMap
=
this
.
$refs
.
apiScenarioList
.
projectEnvMap
;
let
map
=
new
Map
();
rows
.
forEach
(
row
=>
{
map
.
set
(
row
.
id
,
row
.
projectIds
);
})
let
map
=
this
.
$refs
.
apiScenarioList
.
map
;
param
.
planId
=
this
.
planId
;
param
.
mapping
=
strMapToObj
(
map
);
param
.
envMap
=
strMapToObj
(
envMap
);
...
...
frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue
浏览文件 @
489077ad
...
...
@@ -358,15 +358,11 @@ export default {
},
handleBatchEdit
()
{
this
.
$refs
.
batchEdit
.
open
(
this
.
selectRows
.
size
);
this
.
$refs
.
batchEdit
.
setScenarioSelectRows
(
this
.
selectRows
);
this
.
$refs
.
batchEdit
.
setScenarioSelectRows
(
this
.
selectRows
,
"
planScenario
"
);
},
batchEdit
(
form
)
{
let
param
=
{};
let
map
=
new
Map
();
this
.
selectRows
.
forEach
(
row
=>
{
map
.
set
(
row
.
id
,
row
.
projectIds
);
})
param
.
mapping
=
strMapToObj
(
map
);
param
.
mapping
=
strMapToObj
(
form
.
map
);
param
.
envMap
=
strMapToObj
(
form
.
projectEnvMap
);
if
(
this
.
planId
)
{
this
.
$post
(
'
/test/plan/scenario/case/batch/update/env
'
,
param
,
()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录