refactor: merge v1.1
This commit is contained in:
commit
bac8f3215e
|
@ -81,6 +81,9 @@ public class PostmanParser extends ApiImportAbstractParser {
|
||||||
private Body parseBody(PostmanRequest requestDesc, HttpRequest request) {
|
private Body parseBody(PostmanRequest requestDesc, HttpRequest request) {
|
||||||
Body body = new Body();
|
Body body = new Body();
|
||||||
JSONObject postmanBody = requestDesc.getBody();
|
JSONObject postmanBody = requestDesc.getBody();
|
||||||
|
if (postmanBody == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
String bodyMode = postmanBody.getString("mode");
|
String bodyMode = postmanBody.getString("mode");
|
||||||
if (StringUtils.equals(bodyMode, PostmanRequestBodyMode.RAW.value())) {
|
if (StringUtils.equals(bodyMode, PostmanRequestBodyMode.RAW.value())) {
|
||||||
body.setRaw(postmanBody.getString(bodyMode));
|
body.setRaw(postmanBody.getString(bodyMode));
|
||||||
|
|
|
@ -142,9 +142,20 @@
|
||||||
<select id="list" resultType="io.metersphere.track.dto.TestCaseDTO">
|
<select id="list" resultType="io.metersphere.track.dto.TestCaseDTO">
|
||||||
select test_case.* from test_case
|
select test_case.* from test_case
|
||||||
<where>
|
<where>
|
||||||
<if test="request.name != null">
|
<choose>
|
||||||
and test_case.name like CONCAT('%', #{request.name},'%')
|
<!--高级-->
|
||||||
</if>
|
<when test="request.combine != null">
|
||||||
|
<include refid="combine">
|
||||||
|
<property name="condition" value="request.combine"/>
|
||||||
|
</include>
|
||||||
|
</when>
|
||||||
|
<!--普通-->
|
||||||
|
<otherwise>
|
||||||
|
<if test="request.name != null">
|
||||||
|
and test_case.name like CONCAT('%', #{request.name},'%')
|
||||||
|
</if>
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
|
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
|
||||||
and test_case.node_id in
|
and test_case.node_id in
|
||||||
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
|
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
|
||||||
|
|
|
@ -6,15 +6,114 @@
|
||||||
extends="io.metersphere.base.mapper.TestPlanMapper.BaseResultMap">
|
extends="io.metersphere.base.mapper.TestPlanMapper.BaseResultMap">
|
||||||
<result column="project_name" property="projectName"/>
|
<result column="project_name" property="projectName"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
<sql id="condition">
|
||||||
|
<choose>
|
||||||
|
<when test='${object}.operator == "like"'>
|
||||||
|
like CONCAT('%', #{${object}.value},'%')
|
||||||
|
</when>
|
||||||
|
<when test='${object}.operator == "not like"'>
|
||||||
|
not like CONCAT('%', #{${object}.value},'%')
|
||||||
|
</when>
|
||||||
|
<when test='${object}.operator == "in"'>
|
||||||
|
in
|
||||||
|
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
|
||||||
|
#{v}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
<when test='${object}.operator == "not in"'>
|
||||||
|
not in
|
||||||
|
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
|
||||||
|
#{v}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
<when test='${object}.operator == "between"'>
|
||||||
|
between #{${object}.value[0]} and #{${object}.value[1]}
|
||||||
|
</when>
|
||||||
|
<when test='${object}.operator == "gt"'>
|
||||||
|
> #{${object}.value}
|
||||||
|
</when>
|
||||||
|
<when test='${object}.operator == "lt"'>
|
||||||
|
< #{${object}.value}
|
||||||
|
</when>
|
||||||
|
<when test='${object}.operator == "ge"'>
|
||||||
|
>= #{${object}.value}
|
||||||
|
</when>
|
||||||
|
<when test='${object}.operator == "le"'>
|
||||||
|
<= #{${object}.value}
|
||||||
|
</when>
|
||||||
|
<when test='${object}.operator == "current user"'>
|
||||||
|
= '${@io.metersphere.commons.utils.SessionUtils@getUserId()}'
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
= #{${object}.value}
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<sql id="combine">
|
||||||
|
<if test="${condition}.name != null">
|
||||||
|
and test_plan.name
|
||||||
|
<include refid="condition">
|
||||||
|
<property name="object" value="${condition}.name"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<if test="${condition}.projectName != null">
|
||||||
|
and project.name
|
||||||
|
<include refid="condition">
|
||||||
|
<property name="object" value="${condition}.projectName"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<if test="${condition}.principal != null">
|
||||||
|
and test_plan.principal
|
||||||
|
<include refid="condition">
|
||||||
|
<property name="object" value="${condition}.principal"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<if test="${condition}.createTime != null">
|
||||||
|
and test_plan.create_time
|
||||||
|
<include refid="condition">
|
||||||
|
<property name="object" value="${condition}.createTime"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<if test="${condition}.status != null">
|
||||||
|
and test_plan.status
|
||||||
|
<include refid="condition">
|
||||||
|
<property name="object" value="${condition}.status"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<if test="${condition}.updateTime != null">
|
||||||
|
and test_plan.update_time
|
||||||
|
<include refid="condition">
|
||||||
|
<property name="object" value="${condition}.updateTime"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<if test="${condition}.stage != null">
|
||||||
|
and test_plan.stage
|
||||||
|
<include refid="condition">
|
||||||
|
<property name="object" value="${condition}.stage"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
</sql>
|
||||||
|
|
||||||
<select id="list" resultMap="BaseResultMap" parameterType="io.metersphere.track.request.testcase.QueryTestPlanRequest">
|
<select id="list" resultMap="BaseResultMap" parameterType="io.metersphere.track.request.testcase.QueryTestPlanRequest">
|
||||||
select test_plan.*, project.name as project_name
|
select test_plan.*, project.name as project_name
|
||||||
from test_plan
|
from test_plan
|
||||||
left join project on test_plan.project_id = project.id
|
left join project on test_plan.project_id = project.id
|
||||||
<where>
|
<where>
|
||||||
<if test="request.name != null">
|
<choose>
|
||||||
and test_plan.name like CONCAT('%', #{request.name},'%')
|
<!--高级-->
|
||||||
</if>
|
<when test="request.combine != null">
|
||||||
|
<include refid="combine">
|
||||||
|
<property name="condition" value="request.combine"/>
|
||||||
|
</include>
|
||||||
|
</when>
|
||||||
|
<!--普通-->
|
||||||
|
<otherwise>
|
||||||
|
<if test="request.name != null">
|
||||||
|
and test_plan.name like CONCAT('%', #{request.name},'%')
|
||||||
|
</if>
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
<if test="request.workspaceId != null">
|
<if test="request.workspaceId != null">
|
||||||
AND project.workspace_id = #{request.workspaceId}
|
AND project.workspace_id = #{request.workspaceId}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="getUserList" resultMap="BaseResultMap">
|
<select id="getUserList" resultMap="BaseResultMap">
|
||||||
select u.id, u.name, u.email, u.phone, u.language, u.status,
|
select u.id, u.name, u.email, u.phone, u.language, u.status, u.source,
|
||||||
u.last_organization_id, u.last_workspace_id, u.language, u.create_time, u.update_time
|
u.last_organization_id, u.last_workspace_id, u.language, u.create_time, u.update_time
|
||||||
from `user` u
|
from `user` u
|
||||||
<where>
|
<where>
|
||||||
|
|
|
@ -2,9 +2,13 @@ package io.metersphere.controller;
|
||||||
|
|
||||||
import io.metersphere.base.domain.SystemParameter;
|
import io.metersphere.base.domain.SystemParameter;
|
||||||
import io.metersphere.commons.constants.ParamConstants;
|
import io.metersphere.commons.constants.ParamConstants;
|
||||||
|
import io.metersphere.commons.constants.RoleConstants;
|
||||||
import io.metersphere.ldap.domain.LdapInfo;
|
import io.metersphere.ldap.domain.LdapInfo;
|
||||||
import io.metersphere.service.SystemParameterService;
|
import io.metersphere.service.SystemParameterService;
|
||||||
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -16,11 +20,13 @@ public class SystemParameterController {
|
||||||
private SystemParameterService SystemParameterService;
|
private SystemParameterService SystemParameterService;
|
||||||
|
|
||||||
@PostMapping("/edit/email")
|
@PostMapping("/edit/email")
|
||||||
|
@RequiresRoles(value = {RoleConstants.ADMIN})
|
||||||
public void editMail(@RequestBody List<SystemParameter> systemParameter) {
|
public void editMail(@RequestBody List<SystemParameter> systemParameter) {
|
||||||
SystemParameterService.editMail(systemParameter);
|
SystemParameterService.editMail(systemParameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/testConnection")
|
@PostMapping("/testConnection")
|
||||||
|
@RequiresRoles(value = {RoleConstants.ADMIN})
|
||||||
public void testConnection(@RequestBody HashMap<String, String> hashMap) {
|
public void testConnection(@RequestBody HashMap<String, String> hashMap) {
|
||||||
SystemParameterService.testConnection(hashMap);
|
SystemParameterService.testConnection(hashMap);
|
||||||
}
|
}
|
||||||
|
@ -31,16 +37,19 @@ public class SystemParameterController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/mail/info")
|
@GetMapping("/mail/info")
|
||||||
|
@RequiresRoles(value = {RoleConstants.ADMIN})
|
||||||
public Object mailInfo() {
|
public Object mailInfo() {
|
||||||
return SystemParameterService.mailInfo(ParamConstants.Classify.MAIL.getValue());
|
return SystemParameterService.mailInfo(ParamConstants.Classify.MAIL.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/save/ldap")
|
@PostMapping("/save/ldap")
|
||||||
|
@RequiresRoles(value = {RoleConstants.ADMIN})
|
||||||
public void saveLdap(@RequestBody List<SystemParameter> systemParameter) {
|
public void saveLdap(@RequestBody List<SystemParameter> systemParameter) {
|
||||||
SystemParameterService.saveLdap(systemParameter);
|
SystemParameterService.saveLdap(systemParameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/ldap/info")
|
@GetMapping("/ldap/info")
|
||||||
|
@RequiresRoles(value = {RoleConstants.ADMIN})
|
||||||
public LdapInfo getLdapInfo() {
|
public LdapInfo getLdapInfo() {
|
||||||
return SystemParameterService.getLdapInfo(ParamConstants.Classify.LDAP.getValue());
|
return SystemParameterService.getLdapInfo(ParamConstants.Classify.LDAP.getValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package io.metersphere.controller;
|
package io.metersphere.controller;
|
||||||
|
|
||||||
import io.metersphere.base.domain.UserKey;
|
import io.metersphere.base.domain.UserKey;
|
||||||
|
import io.metersphere.commons.constants.RoleConstants;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.security.ApiKeyHandler;
|
import io.metersphere.security.ApiKeyHandler;
|
||||||
import io.metersphere.service.UserKeyService;
|
import io.metersphere.service.UserKeyService;
|
||||||
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||||
import org.apache.shiro.web.util.WebUtils;
|
import org.apache.shiro.web.util.WebUtils;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
@ -16,6 +19,7 @@ import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("user/key")
|
@RequestMapping("user/key")
|
||||||
|
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
|
||||||
public class UserKeysController {
|
public class UserKeysController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class DockerTestEngine extends AbstractEngine {
|
||||||
restTemplateWithTimeOut.getForObject(uri, String.class);
|
restTemplateWithTimeOut.getForObject(uri, String.class);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error("stop load test fail... " + testId, e);
|
LogUtil.error("stop load test fail... " + testId, e);
|
||||||
MSException.throwException(Translator.get("container_delete_fail") + ", Error: " + e.getMessage());
|
MSException.throwException(Translator.get("container_delete_fail"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.List;
|
||||||
|
|
||||||
@RequestMapping("/test/case")
|
@RequestMapping("/test/case")
|
||||||
@RestController
|
@RestController
|
||||||
|
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
|
||||||
public class TestCaseController {
|
public class TestCaseController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
|
|
@ -10,10 +10,11 @@ import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.List;
|
||||||
|
|
||||||
@RequestMapping("/case/node")
|
@RequestMapping("/case/node")
|
||||||
@RestController
|
@RestController
|
||||||
|
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
|
||||||
public class TestCaseNodeController {
|
public class TestCaseNodeController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.metersphere.track.domain;
|
package io.metersphere.track.domain;
|
||||||
|
|
||||||
|
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
|
||||||
import io.metersphere.track.dto.TestCaseReportMetricDTO;
|
import io.metersphere.track.dto.TestCaseReportMetricDTO;
|
||||||
import io.metersphere.track.dto.TestCaseReportStatusResultDTO;
|
import io.metersphere.track.dto.TestCaseReportStatusResultDTO;
|
||||||
import io.metersphere.track.dto.TestPlanCaseDTO;
|
import io.metersphere.track.dto.TestPlanCaseDTO;
|
||||||
|
@ -7,6 +8,7 @@ import io.metersphere.track.dto.TestPlanDTO;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ReportResultChartComponent extends ReportComponent {
|
public class ReportResultChartComponent extends ReportComponent {
|
||||||
|
@ -25,7 +27,24 @@ public class ReportResultChartComponent extends ReportComponent {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterBuild(TestCaseReportMetricDTO testCaseReportMetric) {
|
public void afterBuild(TestCaseReportMetricDTO testCaseReportMetric) {
|
||||||
testCaseReportMetric.setExecuteResult(new ArrayList<>(reportStatusResultMap.values()));
|
testCaseReportMetric.setExecuteResult(getReportStatusResult());
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<TestCaseReportStatusResultDTO> getReportStatusResult() {
|
||||||
|
List<TestCaseReportStatusResultDTO> reportStatusResult = new ArrayList<>();
|
||||||
|
addToReportStatusResultList(reportStatusResult, TestPlanTestCaseStatus.Pass.name());
|
||||||
|
addToReportStatusResultList(reportStatusResult, TestPlanTestCaseStatus.Failure.name());
|
||||||
|
addToReportStatusResultList(reportStatusResult, TestPlanTestCaseStatus.Blocking.name());
|
||||||
|
addToReportStatusResultList(reportStatusResult, TestPlanTestCaseStatus.Skip.name());
|
||||||
|
addToReportStatusResultList(reportStatusResult, TestPlanTestCaseStatus.Underway.name());
|
||||||
|
addToReportStatusResultList(reportStatusResult, TestPlanTestCaseStatus.Prepare.name());
|
||||||
|
return reportStatusResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addToReportStatusResultList(List<TestCaseReportStatusResultDTO> reportStatusResultList, String status) {
|
||||||
|
if (reportStatusResultMap.get(status) != null) {
|
||||||
|
reportStatusResultList.add(reportStatusResultMap.get(status));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getStatusResultMap(Map<String, TestCaseReportStatusResultDTO> reportStatusResultMap, TestPlanCaseDTO testCase) {
|
private void getStatusResultMap(Map<String, TestCaseReportStatusResultDTO> reportStatusResultMap, TestPlanCaseDTO testCase) {
|
||||||
|
|
|
@ -19,4 +19,6 @@ public class QueryTestPlanRequest extends TestPlan {
|
||||||
private List<OrderRequest> orders;
|
private List<OrderRequest> orders;
|
||||||
|
|
||||||
private Map<String, List<String>> filters;
|
private Map<String, List<String>> filters;
|
||||||
|
|
||||||
|
private Map<String, Object> combine;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,11 +45,7 @@ public class TestCaseNodeService {
|
||||||
SqlSessionFactory sqlSessionFactory;
|
SqlSessionFactory sqlSessionFactory;
|
||||||
|
|
||||||
public String addNode(TestCaseNode node) {
|
public String addNode(TestCaseNode node) {
|
||||||
|
validateNode(node);
|
||||||
if(node.getLevel() > TestCaseConstants.MAX_NODE_DEPTH){
|
|
||||||
throw new RuntimeException(Translator.get("test_case_node_level_tip")
|
|
||||||
+ TestCaseConstants.MAX_NODE_DEPTH + Translator.get("test_case_node_level"));
|
|
||||||
}
|
|
||||||
node.setCreateTime(System.currentTimeMillis());
|
node.setCreateTime(System.currentTimeMillis());
|
||||||
node.setUpdateTime(System.currentTimeMillis());
|
node.setUpdateTime(System.currentTimeMillis());
|
||||||
node.setId(UUID.randomUUID().toString());
|
node.setId(UUID.randomUUID().toString());
|
||||||
|
@ -57,6 +53,34 @@ public class TestCaseNodeService {
|
||||||
return node.getId();
|
return node.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void validateNode(TestCaseNode node) {
|
||||||
|
if(node.getLevel() > TestCaseConstants.MAX_NODE_DEPTH){
|
||||||
|
throw new RuntimeException(Translator.get("test_case_node_level_tip")
|
||||||
|
+ TestCaseConstants.MAX_NODE_DEPTH + Translator.get("test_case_node_level"));
|
||||||
|
}
|
||||||
|
checkTestCaseNodeExist(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkTestCaseNodeExist(TestCaseNode node) {
|
||||||
|
if (node.getName() != null) {
|
||||||
|
TestCaseNodeExample example = new TestCaseNodeExample();
|
||||||
|
TestCaseNodeExample.Criteria criteria = example.createCriteria();
|
||||||
|
criteria.andNameEqualTo(node.getName())
|
||||||
|
.andProjectIdEqualTo(node.getProjectId());
|
||||||
|
if (StringUtils.isNotBlank(node.getParentId())) {
|
||||||
|
criteria.andParentIdEqualTo(node.getParentId());
|
||||||
|
} else {
|
||||||
|
criteria.andParentIdIsNull();
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(node.getId())) {
|
||||||
|
criteria.andIdNotEqualTo(node.getId());
|
||||||
|
}
|
||||||
|
if (testCaseNodeMapper.selectByExample(example).size() > 0) {
|
||||||
|
MSException.throwException(Translator.get("test_case_module_already_exists"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<TestCaseNodeDTO> getNodeTreeByProjectId(String projectId) {
|
public List<TestCaseNodeDTO> getNodeTreeByProjectId(String projectId) {
|
||||||
TestCaseNodeExample testCaseNodeExample = new TestCaseNodeExample();
|
TestCaseNodeExample testCaseNodeExample = new TestCaseNodeExample();
|
||||||
testCaseNodeExample.createCriteria().andProjectIdEqualTo(projectId);
|
testCaseNodeExample.createCriteria().andProjectIdEqualTo(projectId);
|
||||||
|
@ -119,7 +143,7 @@ public class TestCaseNodeService {
|
||||||
|
|
||||||
public int editNode(DragNodeRequest request) {
|
public int editNode(DragNodeRequest request) {
|
||||||
request.setUpdateTime(System.currentTimeMillis());
|
request.setUpdateTime(System.currentTimeMillis());
|
||||||
|
checkTestCaseNodeExist(request);
|
||||||
List<TestCaseDTO> testCases = QueryTestCaseByNodeIds(request.getNodeIds());
|
List<TestCaseDTO> testCases = QueryTestCaseByNodeIds(request.getNodeIds());
|
||||||
|
|
||||||
testCases.forEach(testCase -> {
|
testCases.forEach(testCase -> {
|
||||||
|
@ -376,7 +400,7 @@ public class TestCaseNodeService {
|
||||||
|
|
||||||
public void dragNode(DragNodeRequest request) {
|
public void dragNode(DragNodeRequest request) {
|
||||||
|
|
||||||
// editNode(request);
|
checkTestCaseNodeExist(request);
|
||||||
|
|
||||||
List<String> nodeIds = request.getNodeIds();
|
List<String> nodeIds = request.getNodeIds();
|
||||||
|
|
||||||
|
|
|
@ -73,14 +73,7 @@ public class TestCaseService {
|
||||||
|
|
||||||
public void addTestCase(TestCaseWithBLOBs testCase) {
|
public void addTestCase(TestCaseWithBLOBs testCase) {
|
||||||
testCase.setName(testCase.getName());
|
testCase.setName(testCase.getName());
|
||||||
TestCaseExample testCaseExample = new TestCaseExample();
|
checkTestCaseExist(testCase);
|
||||||
testCaseExample.createCriteria()
|
|
||||||
.andProjectIdEqualTo(testCase.getProjectId())
|
|
||||||
.andNameEqualTo(testCase.getName());
|
|
||||||
List<TestCase> testCases = testCaseMapper.selectByExample(testCaseExample);
|
|
||||||
if (testCases.size() > 0) {
|
|
||||||
MSException.throwException(Translator.get("test_case_exist") + testCase.getName());
|
|
||||||
}
|
|
||||||
testCase.setId(UUID.randomUUID().toString());
|
testCase.setId(UUID.randomUUID().toString());
|
||||||
testCase.setCreateTime(System.currentTimeMillis());
|
testCase.setCreateTime(System.currentTimeMillis());
|
||||||
testCase.setUpdateTime(System.currentTimeMillis());
|
testCase.setUpdateTime(System.currentTimeMillis());
|
||||||
|
@ -107,10 +100,12 @@ public class TestCaseService {
|
||||||
private void checkTestCaseExist(TestCaseWithBLOBs testCase) {
|
private void checkTestCaseExist(TestCaseWithBLOBs testCase) {
|
||||||
if (testCase.getName() != null) {
|
if (testCase.getName() != null) {
|
||||||
TestCaseExample example = new TestCaseExample();
|
TestCaseExample example = new TestCaseExample();
|
||||||
example.createCriteria()
|
TestCaseExample.Criteria criteria = example.createCriteria();
|
||||||
.andNameEqualTo(testCase.getName())
|
criteria.andNameEqualTo(testCase.getName())
|
||||||
.andProjectIdEqualTo(testCase.getProjectId())
|
.andProjectIdEqualTo(testCase.getProjectId());
|
||||||
.andIdNotEqualTo(testCase.getId());
|
if (StringUtils.isNotBlank(testCase.getId())) {
|
||||||
|
criteria.andIdNotEqualTo(testCase.getId());
|
||||||
|
}
|
||||||
if (testCaseMapper.selectByExample(example).size() > 0) {
|
if (testCaseMapper.selectByExample(example).size() > 0) {
|
||||||
MSException.throwException(Translator.get("test_case_already_exists"));
|
MSException.throwException(Translator.get("test_case_already_exists"));
|
||||||
}
|
}
|
||||||
|
@ -366,7 +361,7 @@ public class TestCaseService {
|
||||||
data.setStepResult("");
|
data.setStepResult("");
|
||||||
data.setRemark(t.getPerformName());
|
data.setRemark(t.getPerformName());
|
||||||
}
|
}
|
||||||
data.setMaintainer(user.getId());
|
data.setMaintainer(t.getMaintainer());
|
||||||
list.add(data);
|
list.add(data);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,33 +1,36 @@
|
||||||
INSERT INTO user (id, name, email, password, status, create_time, update_time, language, last_workspace_id, last_organization_id, phone)
|
INSERT INTO user (id, name, email, password, status, create_time, update_time, language, last_workspace_id, last_organization_id, phone)
|
||||||
VALUES ('admin', 'Administrator', 'admin@metersphere.io', md5('metersphere'), '1', 1582597567455, 1582597567455, null, '', null, null);
|
VALUES ('admin', 'Administrator', 'admin@metersphere.io', md5('metersphere'), '1', unix_timestamp() * 1000, unix_timestamp() * 1000, NULL, '', NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
INSERT INTO user_role (id, user_id, role_id, source_id, create_time, update_time)
|
INSERT INTO user_role (id, user_id, role_id, source_id, create_time, update_time)
|
||||||
VALUES (uuid(), 'admin', 'admin', '1', 1581576575948, 1581576575948);
|
VALUES (uuid(), 'admin', 'admin', '1', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||||
|
|
||||||
INSERT INTO role (id, name, description, type, create_time, update_time)
|
INSERT INTO role (id, name, description, type, create_time, update_time)
|
||||||
VALUES ('admin', '系统管理员', NULL, NULL, 1581576575948, 1581576575948);
|
VALUES ('admin', '系统管理员', NULL, NULL, unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||||
INSERT INTO role (id, name, description, type, create_time, update_time)
|
INSERT INTO role (id, name, description, type, create_time, update_time)
|
||||||
VALUES ('org_admin', '组织管理员', NULL, NULL, 1581576575948, 1581576575948);
|
VALUES ('org_admin', '组织管理员', NULL, NULL, unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||||
INSERT INTO role (id, name, description, type, create_time, update_time)
|
INSERT INTO role (id, name, description, type, create_time, update_time)
|
||||||
VALUES ('test_manager', '测试经理', NULL, NULL, 1581576575948, 1581576575948);
|
VALUES ('test_manager', '测试经理', NULL, NULL, unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||||
INSERT INTO role (id, name, description, type, create_time, update_time)
|
INSERT INTO role (id, name, description, type, create_time, update_time)
|
||||||
VALUES ('test_user', '测试人员', NULL, NULL, 1581576575948, 1581576575948);
|
VALUES ('test_user', '测试人员', NULL, NULL, unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||||
INSERT INTO role (id, name, description, type, create_time, update_time)
|
INSERT INTO role (id, name, description, type, create_time, update_time)
|
||||||
VALUES ('test_viewer', 'Viewer', NULL, NULL, 1581576575948, 1581576575948);
|
VALUES ('test_viewer', 'Viewer', NULL, NULL, unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||||
|
|
||||||
INSERT INTO organization (id, name, description, create_time, update_time)
|
INSERT INTO organization (id, name, description, create_time, update_time)
|
||||||
VALUES (uuid(), '默认组织', '系统默认创建的组织', 1581576575948, 1581576575948);
|
VALUES (uuid(), '默认组织', '系统默认创建的组织', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||||
INSERT INTO workspace (id, organization_id, name, description, create_time, update_time)
|
INSERT INTO workspace (id, organization_id, name, description, create_time, update_time)
|
||||||
VALUES (uuid(), (select id from organization where name like '默认组织'), '默认工作空间', '系统默认创建的工作空间', 1581576575948, 1581576575948);
|
VALUES (uuid(), (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认工作空间', '系统默认创建的工作空间', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||||
INSERT INTO user_role (id, user_id, role_id, source_id, create_time, update_time)
|
INSERT INTO user_role (id, user_id, role_id, source_id, create_time, update_time)
|
||||||
VALUES (uuid(), 'admin', 'org_admin', (select id from organization where name like '默认组织'), 1581576575948, 1581576575948);
|
VALUES (uuid(), 'admin', 'org_admin', (SELECT id FROM organization WHERE name LIKE '默认组织'), unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||||
INSERT INTO user_role (id, user_id, role_id, source_id, create_time, update_time)
|
INSERT INTO user_role (id, user_id, role_id, source_id, create_time, update_time)
|
||||||
VALUES (uuid(), 'admin', 'test_manager', (select id from workspace where name like '默认工作空间'), 1581576575948, 1581576575948);
|
VALUES (uuid(), 'admin', 'test_manager', (SELECT id FROM workspace WHERE name LIKE '默认工作空间'), unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||||
|
|
||||||
INSERT INTO test_resource_pool (id, name, type, description, status, create_time, update_time)
|
INSERT INTO test_resource_pool (id, name, type, description, status, create_time, update_time)
|
||||||
VALUES (uuid(), 'LOCAL', 'NODE', '系统默认创建的本地资源池', 'VALID', 1581576575948, 1581576575948);
|
VALUES (uuid(), 'LOCAL', 'NODE', '系统默认创建的本地资源池', 'VALID', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||||
INSERT INTO test_resource (id, test_resource_pool_id, configuration, status, create_time, update_time)
|
INSERT INTO test_resource (id, test_resource_pool_id, configuration, status, create_time, update_time)
|
||||||
VALUES (uuid(), (select id from test_resource_pool where name like 'LOCAL'), 'GgC8aAZVAsiNDdnvp4gobdv1iwAvloLCAaeqb7Ms1VaLzW+iXHsFhGg8ZaPEk53W6xA5A6g+UUUxbKvU2s7yZw==', 'VALID', 1581576575948, 1581576575948);
|
VALUES (uuid(), (SELECT id FROM test_resource_pool WHERE name LIKE 'LOCAL'),
|
||||||
|
'GgC8aAZVAsiNDdnvp4gobdv1iwAvloLCAaeqb7Ms1VaLzW+iXHsFhGg8ZaPEk53W6xA5A6g+UUUxbKvU2s7yZw==', 'VALID', unix_timestamp() * 1000,
|
||||||
|
unix_timestamp() * 1000);
|
||||||
|
|
||||||
INSERT INTO test_case_report_template (id, name, content)
|
INSERT INTO test_case_report_template (id, name, content)
|
||||||
VALUES (uuid(), 'default', '{\"components\": [1,2,3,4,5]}');
|
VALUES (uuid(), 'default', '{\"components\": [1,2,3,4,5]}');
|
||||||
|
|
|
@ -115,6 +115,7 @@ please_input_workspace_member=Please input workspace merber
|
||||||
test_case_report_template_repeat=The workspace has the same name template
|
test_case_report_template_repeat=The workspace has the same name template
|
||||||
plan_name_already_exists=Test plan name already exists
|
plan_name_already_exists=Test plan name already exists
|
||||||
test_case_already_exists_excel=There are duplicate test cases in the import file
|
test_case_already_exists_excel=There are duplicate test cases in the import file
|
||||||
|
test_case_module_already_exists=The module name already exists at the same level
|
||||||
api_test_name_already_exists=Test name already exists
|
api_test_name_already_exists=Test name already exists
|
||||||
|
|
||||||
#ldap
|
#ldap
|
||||||
|
|
|
@ -46,7 +46,7 @@ max_thread_insufficient=并发用户数超额
|
||||||
related_case_del_fail_prefix=已关联到
|
related_case_del_fail_prefix=已关联到
|
||||||
related_case_del_fail_suffix=测试用例,请先解除关联
|
related_case_del_fail_suffix=测试用例,请先解除关联
|
||||||
jmx_content_valid=JMX 内容无效,请检查
|
jmx_content_valid=JMX 内容无效,请检查
|
||||||
container_delete_fail=容器停止失败,请重试
|
container_delete_fail=容器由于网络原因停止失败,请重试
|
||||||
#workspace
|
#workspace
|
||||||
workspace_name_is_null=工作空间名不能为空
|
workspace_name_is_null=工作空间名不能为空
|
||||||
workspace_name_already_exists=工作空间名已存在
|
workspace_name_already_exists=工作空间名已存在
|
||||||
|
@ -115,6 +115,7 @@ please_input_workspace_member=请填写该工作空间相关人员
|
||||||
test_case_report_template_repeat=同一工作空间下不能存在同名模版
|
test_case_report_template_repeat=同一工作空间下不能存在同名模版
|
||||||
plan_name_already_exists=测试计划名称已存在
|
plan_name_already_exists=测试计划名称已存在
|
||||||
test_case_already_exists_excel=导入文件中存在重复用例
|
test_case_already_exists_excel=导入文件中存在重复用例
|
||||||
|
test_case_module_already_exists=同层级下已存在该模块名称
|
||||||
api_test_name_already_exists=测试名称已经存在
|
api_test_name_already_exists=测试名称已经存在
|
||||||
|
|
||||||
#ldap
|
#ldap
|
||||||
|
|
|
@ -46,7 +46,7 @@ max_thread_insufficient=並發用戶數超額
|
||||||
related_case_del_fail_prefix=已關聯到
|
related_case_del_fail_prefix=已關聯到
|
||||||
related_case_del_fail_suffix=測試用例,請先解除關聯
|
related_case_del_fail_suffix=測試用例,請先解除關聯
|
||||||
jmx_content_valid=JMX 內容無效,請檢查
|
jmx_content_valid=JMX 內容無效,請檢查
|
||||||
container_delete_fail=容器停止失敗,請重試
|
container_delete_fail=容器由於網絡原因停止失敗,請重試
|
||||||
#workspace
|
#workspace
|
||||||
workspace_name_is_null=工作空間名不能為空
|
workspace_name_is_null=工作空間名不能為空
|
||||||
workspace_name_already_exists=工作空間名已存在
|
workspace_name_already_exists=工作空間名已存在
|
||||||
|
@ -115,6 +115,7 @@ please_input_workspace_member=請填寫該工作空間相關人員
|
||||||
test_case_report_template_repeat=同壹工作空間下不能存在同名模版
|
test_case_report_template_repeat=同壹工作空間下不能存在同名模版
|
||||||
plan_name_already_exists=測試計劃名稱已存在
|
plan_name_already_exists=測試計劃名稱已存在
|
||||||
test_case_already_exists_excel=導入文件中存在重復用例
|
test_case_already_exists_excel=導入文件中存在重復用例
|
||||||
|
test_case_module_already_exists=同層級下已存在該模塊名稱
|
||||||
api_test_name_already_exists=測試名稱已經存在
|
api_test_name_already_exists=測試名稱已經存在
|
||||||
|
|
||||||
#ldap
|
#ldap
|
||||||
|
|
|
@ -161,6 +161,8 @@
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/api/test/edit?id=' + this.test.id
|
path: '/api/test/edit?id=' + this.test.id
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
this.$router.push({path: '/api/test/list/all'})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
@ -80,6 +80,16 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
projectId() {
|
||||||
|
this.initScenarioEnvironment();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
activated() {
|
||||||
|
this.initScenarioEnvironment();
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
createScenario: function () {
|
createScenario: function () {
|
||||||
this.scenarios.push(new Scenario());
|
this.scenarios.push(new Scenario());
|
||||||
|
@ -119,6 +129,22 @@
|
||||||
this.activeName = 0;
|
this.activeName = 0;
|
||||||
this.select(this.scenarios[0]);
|
this.select(this.scenarios[0]);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
initScenarioEnvironment: function () {
|
||||||
|
if (this.projectId) {
|
||||||
|
this.result = this.$get('/api/environment/list/' + this.projectId, response => {
|
||||||
|
let environments = response.data;
|
||||||
|
let environmentMap = new Map();
|
||||||
|
environments.forEach(environment => {
|
||||||
|
environmentMap.set(environment.id, environment);
|
||||||
|
});
|
||||||
|
this.scenarios.forEach(scenario => {
|
||||||
|
if (scenario.environmentId) {
|
||||||
|
scenario.environment = environmentMap.get(scenario.environmentId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,6 @@
|
||||||
for (let i in this.environments) {
|
for (let i in this.environments) {
|
||||||
if (this.environments[i].id === this.scenario.environmentId) {
|
if (this.environments[i].id === this.scenario.environmentId) {
|
||||||
this.scenario.environment = this.environments[i];
|
this.scenario.environment = this.environments[i];
|
||||||
this.setRequestEnvironments();
|
|
||||||
hasEnvironment = true;
|
hasEnvironment = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +123,6 @@
|
||||||
for (let i in this.environments) {
|
for (let i in this.environments) {
|
||||||
if (this.environments[i].id === value) {
|
if (this.environments[i].id === value) {
|
||||||
this.scenario.environment = this.environments[i];
|
this.scenario.environment = this.environments[i];
|
||||||
this.setRequestEnvironments();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,11 +142,6 @@
|
||||||
},
|
},
|
||||||
environmentConfigClose() {
|
environmentConfigClose() {
|
||||||
this.getEnvironments();
|
this.getEnvironments();
|
||||||
},
|
|
||||||
setRequestEnvironments() {
|
|
||||||
this.scenario.requests.forEach(request => {
|
|
||||||
request.environment = this.scenario.environment;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<div class="kv-row" v-for="(item, index) in items" :key="index">
|
<div class="kv-row" v-for="(item, index) in items" :key="index">
|
||||||
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
|
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
|
||||||
<el-col>
|
<el-col>
|
||||||
<ms-api-variable-input :is-read-only="isReadOnly" v-model="item.name" size="small" maxlength="100" @change="change"
|
<ms-api-variable-input :show-variable="showVariable" :is-read-only="isReadOnly" v-model="item.name" size="small" maxlength="100" @change="change"
|
||||||
:placeholder="$t('api_test.variable_name')" show-word-limit/>
|
:placeholder="$t('api_test.variable_name')" show-word-limit/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col>
|
<el-col>
|
||||||
|
@ -35,7 +35,11 @@
|
||||||
isReadOnly: {
|
isReadOnly: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
}
|
},
|
||||||
|
showVariable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="variable-input">
|
<div class="variable-input">
|
||||||
<el-input :disabled="isReadOnly" :value="value" v-bind="$attrs" :size="size" @change="change" @input="input"/>
|
<el-input :disabled="isReadOnly" :value="value" v-bind="$attrs" :size="size" @change="change" @input="input"/>
|
||||||
<div class="variable-combine" v-if="value">
|
<div :class="{'hidden': !showVariable}" class="variable-combine" v-if="value">
|
||||||
<div class="variable">{{variable}}</div>
|
<div class="variable">{{variable}}</div>
|
||||||
<el-tooltip :content="$t('api_test.copied')" manual v-model="visible" placement="top" :visible-arrow="false">
|
<el-tooltip :content="$t('api_test.copied')" manual v-model="visible" placement="top" :visible-arrow="false">
|
||||||
<i class="el-icon-copy-document copy" @click="copy"/>
|
<i class="el-icon-copy-document copy" @click="copy"/>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
@ -20,7 +20,11 @@
|
||||||
isReadOnly: {
|
isReadOnly: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
}
|
},
|
||||||
|
showVariable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
@ -93,4 +97,9 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: #1E90FF;
|
color: #1E90FF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<span>{{$t('api_test.environment.globalVariable')}}</span>
|
<span>{{$t('api_test.environment.globalVariable')}}</span>
|
||||||
<ms-api-scenario-variables :items="environment.variables"/>
|
<ms-api-scenario-variables :show-variable="false" :items="environment.variables"/>
|
||||||
|
|
||||||
<span>{{$t('api_test.request.headers')}}</span>
|
<span>{{$t('api_test.request.headers')}}</span>
|
||||||
<ms-api-key-value :items="environment.headers" :suggestions="headerSuggestions"/>
|
<ms-api-key-value :items="environment.headers" :suggestions="headerSuggestions"/>
|
||||||
|
|
|
@ -280,8 +280,8 @@ export class HTTPSamplerProxy extends DefaultTestElement {
|
||||||
this.request = request || {};
|
this.request = request || {};
|
||||||
|
|
||||||
if (request.useEnvironment) {
|
if (request.useEnvironment) {
|
||||||
this.stringProp("HTTPSampler.domain", this.request.environment.domain);
|
this.stringProp("HTTPSampler.domain", request.domain);
|
||||||
this.stringProp("HTTPSampler.protocol", this.request.environment.protocol);
|
this.stringProp("HTTPSampler.protocol", request.protocol);
|
||||||
this.stringProp("HTTPSampler.path", this.request.path);
|
this.stringProp("HTTPSampler.path", this.request.path);
|
||||||
} else {
|
} else {
|
||||||
this.stringProp("HTTPSampler.domain", this.request.hostname);
|
this.stringProp("HTTPSampler.domain", this.request.hostname);
|
||||||
|
|
|
@ -161,6 +161,7 @@ export class Scenario extends BaseConfig {
|
||||||
this.requests = [];
|
this.requests = [];
|
||||||
this.environmentId = undefined;
|
this.environmentId = undefined;
|
||||||
this.dubboConfig = undefined;
|
this.dubboConfig = undefined;
|
||||||
|
this.environment = undefined;
|
||||||
|
|
||||||
this.set(options);
|
this.set(options);
|
||||||
this.sets({variables: KeyValue, headers: KeyValue, requests: RequestFactory}, options);
|
this.sets({variables: KeyValue, headers: KeyValue, requests: RequestFactory}, options);
|
||||||
|
@ -179,7 +180,7 @@ export class Scenario extends BaseConfig {
|
||||||
|
|
||||||
isValid() {
|
isValid() {
|
||||||
for (let i = 0; i < this.requests.length; i++) {
|
for (let i = 0; i < this.requests.length; i++) {
|
||||||
let validator = this.requests[i].isValid();
|
let validator = this.requests[i].isValid(this.environmentId);
|
||||||
if (!validator.isValid) {
|
if (!validator.isValid) {
|
||||||
return validator;
|
return validator;
|
||||||
}
|
}
|
||||||
|
@ -257,9 +258,9 @@ export class HttpRequest extends Request {
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
isValid() {
|
isValid(environmentId) {
|
||||||
if (this.useEnvironment) {
|
if (this.useEnvironment){
|
||||||
if (!this.environment) {
|
if (!environmentId) {
|
||||||
return {
|
return {
|
||||||
isValid: false,
|
isValid: false,
|
||||||
info: 'api_test.request.please_configure_environment_in_scenario'
|
info: 'api_test.request.please_configure_environment_in_scenario'
|
||||||
|
@ -613,7 +614,7 @@ const JMX_ASSERTION_CONDITION = {
|
||||||
}
|
}
|
||||||
|
|
||||||
class JMXHttpRequest {
|
class JMXHttpRequest {
|
||||||
constructor(request) {
|
constructor(request, environment) {
|
||||||
if (request && request instanceof HttpRequest && (request.url || request.path)) {
|
if (request && request instanceof HttpRequest && (request.url || request.path)) {
|
||||||
this.useEnvironment = request.useEnvironment;
|
this.useEnvironment = request.useEnvironment;
|
||||||
this.method = request.method;
|
this.method = request.method;
|
||||||
|
@ -625,10 +626,12 @@ class JMXHttpRequest {
|
||||||
this.protocol = url.protocol.split(":")[0];
|
this.protocol = url.protocol.split(":")[0];
|
||||||
this.pathname = this.getPostQueryParameters(request, this.pathname);
|
this.pathname = this.getPostQueryParameters(request, this.pathname);
|
||||||
} else {
|
} else {
|
||||||
this.environment = request.environment;
|
if (environment) {
|
||||||
this.port = request.environment.port;
|
this.port = environment.port;
|
||||||
this.path = decodeURIComponent(request.path);
|
this.protocol = environment.protocol;
|
||||||
this.path = this.getPostQueryParameters(request, this.path);
|
this.domain = environment.domain;
|
||||||
|
}
|
||||||
|
this.path = this.getPostQueryParameters(request, decodeURIComponent(request.path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -723,7 +726,7 @@ class JMXGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request instanceof HttpRequest) {
|
if (request instanceof HttpRequest) {
|
||||||
sampler = new HTTPSamplerProxy(request.name || "", new JMXHttpRequest(request));
|
sampler = new HTTPSamplerProxy(request.name || "", new JMXHttpRequest(request, scenario.environment));
|
||||||
this.addRequestHeader(sampler, request);
|
this.addRequestHeader(sampler, request);
|
||||||
if (request.method.toUpperCase() === 'GET') {
|
if (request.method.toUpperCase() === 'GET') {
|
||||||
this.addRequestArguments(sampler, request);
|
this.addRequestArguments(sampler, request);
|
||||||
|
|
|
@ -51,9 +51,11 @@
|
||||||
callback(new Error(this.$t('commons.input_content')));
|
callback(new Error(this.$t('commons.input_content')));
|
||||||
} else if (!cronValidate(cronValue)) {
|
} else if (!cronValidate(cronValue)) {
|
||||||
callback(new Error(this.$t('schedule.cron_expression_format_error')));
|
callback(new Error(this.$t('schedule.cron_expression_format_error')));
|
||||||
} else if(!this.intervalShortValidate()) {
|
}
|
||||||
callback(new Error(this.$t('schedule.cron_expression_interval_short_error')));
|
// else if(!this.intervalShortValidate()) {
|
||||||
} else if (!customValidate.pass){
|
// callback(new Error(this.$t('schedule.cron_expression_interval_short_error')));
|
||||||
|
// }
|
||||||
|
else if (!customValidate.pass){
|
||||||
callback(new Error(customValidate.info));
|
callback(new Error(customValidate.info));
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
|
@ -87,6 +89,7 @@
|
||||||
saveCron () {
|
saveCron () {
|
||||||
this.$refs['from'].validate((valid) => {
|
this.$refs['from'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
this.intervalShortValidate();
|
||||||
this.save(this.form.cronValue);
|
this.save(this.form.cronValue);
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -103,8 +106,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
intervalShortValidate() {
|
intervalShortValidate() {
|
||||||
if (this.getIntervalTime() < 5*60*1000) {
|
if (this.getIntervalTime() < 3*60*1000) {
|
||||||
return false;
|
// return false;
|
||||||
|
this.$info(this.$t('schedule.cron_expression_interval_short_error'));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
|
@ -220,8 +220,72 @@ export const MODULE = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const PRINCIPAL = {
|
||||||
|
key: "principal",
|
||||||
|
name: 'MsTableSearchSelect',
|
||||||
|
label: 'test_track.plan.plan_principal',
|
||||||
|
operator: {
|
||||||
|
options: [OPERATORS.IN, OPERATORS.NOT_IN, OPERATORS.CURRENT_USER],
|
||||||
|
change: function (component, value) { // 运算符change事件
|
||||||
|
if (value === OPERATORS.CURRENT_USER.value) {
|
||||||
|
component.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
options: { // 异步获取候选项
|
||||||
|
url: "/user/list",
|
||||||
|
labelKey: "name",
|
||||||
|
valueKey: "id",
|
||||||
|
showLabel: option => {
|
||||||
|
return option.label + "(" + option.value + ")";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
multiple: true
|
||||||
|
},
|
||||||
|
isShow: operator => {
|
||||||
|
return operator !== OPERATORS.CURRENT_USER.value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const STAGE = {
|
||||||
|
key: "stage",
|
||||||
|
name: 'MsTableSearchSelect',
|
||||||
|
label: "test_track.plan.plan_stage",
|
||||||
|
operator: {
|
||||||
|
options: [OPERATORS.IN, OPERATORS.NOT_IN]
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{label: 'test_track.plan.smoke_test', value: 'smoke'},
|
||||||
|
{label: 'test_track.plan.regression_test', value: 'regression'},
|
||||||
|
{label: 'test_track.plan.system_test', value: 'system'}
|
||||||
|
],
|
||||||
|
props: {
|
||||||
|
multiple: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const TEST_PLAN_STATUS = {
|
||||||
|
key: "status",
|
||||||
|
name: 'MsTableSearchSelect',
|
||||||
|
label: "test_track.plan.plan_status",
|
||||||
|
operator: {
|
||||||
|
options: [OPERATORS.IN, OPERATORS.NOT_IN]
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{label: 'test_track.plan.plan_status_prepare', value: 'Prepare'},
|
||||||
|
{label: 'test_track.plan.plan_status_running', value: 'Underway'},
|
||||||
|
{label: 'test_track.plan.plan_status_completed', value: 'Completed'}
|
||||||
|
],
|
||||||
|
props: {
|
||||||
|
multiple: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const TEST_CONFIGS = [NAME, UPDATE_TIME, PROJECT_NAME, CREATE_TIME, STATUS, CREATOR];
|
export const TEST_CONFIGS = [NAME, UPDATE_TIME, PROJECT_NAME, CREATE_TIME, STATUS, CREATOR];
|
||||||
|
|
||||||
export const REPORT_CONFIGS = [NAME, TEST_NAME, PROJECT_NAME, CREATE_TIME, STATUS, CREATOR, TRIGGER_MODE];
|
export const REPORT_CONFIGS = [NAME, TEST_NAME, PROJECT_NAME, CREATE_TIME, STATUS, CREATOR, TRIGGER_MODE];
|
||||||
|
|
||||||
export const TEST_CASE_CONFIGS = [NAME, MODULE, PRIORITY, CREATE_TIME, TYPE, UPDATE_TIME, METHOD, CREATOR];
|
export const TEST_CASE_CONFIGS = [NAME, MODULE, PRIORITY, CREATE_TIME, TYPE, UPDATE_TIME, METHOD, CREATOR];
|
||||||
|
|
||||||
|
export const TEST_PLAN_CONFIGS = [NAME, UPDATE_TIME, PROJECT_NAME, CREATE_TIME, PRINCIPAL, TEST_PLAN_STATUS, STAGE];
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<el-input :disabled="isReadOnly" :placeholder="$t('load_test.input_name')" v-model="testPlan.name" class="input-with-select"
|
<el-input :disabled="isReadOnly" :placeholder="$t('load_test.input_name')" v-model="testPlan.name" class="input-with-select"
|
||||||
maxlength="30"
|
maxlength="30" show-word-limit
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<el-select :disabled="isReadOnly" v-model="testPlan.projectId" :placeholder="$t('load_test.select_project')">
|
<el-select :disabled="isReadOnly" v-model="testPlan.projectId" :placeholder="$t('load_test.select_project')">
|
||||||
|
|
|
@ -101,7 +101,7 @@
|
||||||
rule: {
|
rule: {
|
||||||
name: [
|
name: [
|
||||||
{required: true, message: this.$t('member.input_name'), trigger: 'blur'},
|
{required: true, message: this.$t('member.input_name'), trigger: 'blur'},
|
||||||
{min: 2, max: 10, message: this.$t('commons.input_limit', [2, 10]), trigger: 'blur'},
|
{min: 2, max: 20, message: this.$t('commons.input_limit', [2, 20]), trigger: 'blur'},
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
|
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
|
||||||
|
|
|
@ -72,12 +72,7 @@
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
formInline: {
|
formInline: {
|
||||||
/*host: 'smtp.163.com',
|
|
||||||
port: '465',
|
|
||||||
account: 'xjj0608@163.com',
|
|
||||||
password: '2345678',*/
|
|
||||||
},
|
},
|
||||||
|
|
||||||
input: '',
|
input: '',
|
||||||
visible: true,
|
visible: true,
|
||||||
result: {},
|
result: {},
|
||||||
|
@ -113,7 +108,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
activated() {
|
created() {
|
||||||
this.query()
|
this.query()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -129,6 +124,9 @@
|
||||||
this.$set(this.formInline, "SSL", JSON.parse(response.data[4].paramValue));
|
this.$set(this.formInline, "SSL", JSON.parse(response.data[4].paramValue));
|
||||||
this.$set(this.formInline, "TLS", JSON.parse(response.data[5].paramValue));
|
this.$set(this.formInline, "TLS", JSON.parse(response.data[5].paramValue));
|
||||||
this.$set(this.formInline, "SMTP", JSON.parse(response.data[6].paramValue));
|
this.$set(this.formInline, "SMTP", JSON.parse(response.data[6].paramValue));
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.formInline.clearValidate();
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
change() {
|
change() {
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<ms-table-operator @editClick="edit(scope.row)" @deleteClick="del(scope.row)">
|
<ms-table-operator @editClick="edit(scope.row)" @deleteClick="del(scope.row)">
|
||||||
<template v-slot:behind>
|
<template v-slot:behind>
|
||||||
<ms-table-operator-button :tip="$t('member.edit_password')" icon="el-icon-s-tools"
|
<ms-table-operator-button :tip="$t('member.edit_password')" icon="el-icon-s-tools"
|
||||||
type="success" @exec="editPassword(scope.row)"/>
|
type="success" @exec="editPassword(scope.row)" v-if="!scope.row.isLdapUser"/>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-operator>
|
</ms-table-operator>
|
||||||
</template>
|
</template>
|
||||||
|
@ -163,7 +163,7 @@
|
||||||
|
|
||||||
<!--Modify user information in system settings-->
|
<!--Modify user information in system settings-->
|
||||||
<el-dialog :title="$t('user.modify')" :visible.sync="updateVisible" width="35%" :destroy-on-close="true"
|
<el-dialog :title="$t('user.modify')" :visible.sync="updateVisible" width="35%" :destroy-on-close="true"
|
||||||
@close="handleClose">
|
@close="handleClose" v-loading="result.loading">
|
||||||
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="updateUserForm">
|
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="updateUserForm">
|
||||||
<el-form-item label="ID" prop="id">
|
<el-form-item label="ID" prop="id">
|
||||||
<el-input v-model="form.id" autocomplete="off" :disabled="true"/>
|
<el-input v-model="form.id" autocomplete="off" :disabled="true"/>
|
||||||
|
@ -172,7 +172,7 @@
|
||||||
<el-input v-model="form.name" autocomplete="off"/>
|
<el-input v-model="form.name" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('commons.email')" prop="email">
|
<el-form-item :label="$t('commons.email')" prop="email">
|
||||||
<el-input v-model="form.email" autocomplete="off"/>
|
<el-input v-model="form.email" autocomplete="off" :disabled="form.source === 'LDAP' ? true : false"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('commons.phone')" prop="phone">
|
<el-form-item :label="$t('commons.phone')" prop="phone">
|
||||||
<el-input v-model="form.phone" autocomplete="off"/>
|
<el-input v-model="form.phone" autocomplete="off"/>
|
||||||
|
@ -488,6 +488,7 @@
|
||||||
let roles = data.roles;
|
let roles = data.roles;
|
||||||
// let userRoles = result.userRoles;
|
// let userRoles = result.userRoles;
|
||||||
this.$set(this.tableData[i], "roles", roles);
|
this.$set(this.tableData[i], "roles", roles);
|
||||||
|
this.$set(this.tableData[i], "isLdapUser", this.tableData[i].source === 'LDAP' ? true : false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -259,7 +259,7 @@
|
||||||
maintainer: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
|
maintainer: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
|
||||||
priority: [{required: true, message: this.$t('test_track.case.input_priority'), trigger: 'change'}],
|
priority: [{required: true, message: this.$t('test_track.case.input_priority'), trigger: 'change'}],
|
||||||
type: [{required: true, message: this.$t('test_track.case.input_type'), trigger: 'change'}],
|
type: [{required: true, message: this.$t('test_track.case.input_type'), trigger: 'change'}],
|
||||||
testId: [{required: true, message: '请选择测试', trigger: 'change'}],
|
testId: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}],
|
||||||
method: [{required: true, message: this.$t('test_track.case.input_method'), trigger: 'change'}],
|
method: [{required: true, message: this.$t('test_track.case.input_method'), trigger: 'change'}],
|
||||||
prerequisite: [{max: 300, message: this.$t('test_track.length_less_than') + '300', trigger: 'blur'}],
|
prerequisite: [{max: 300, message: this.$t('test_track.length_less_than') + '300', trigger: 'blur'}],
|
||||||
remark: [{max: 300, message: this.$t('test_track.length_less_than') + '300', trigger: 'blur'}]
|
remark: [{max: 300, message: this.$t('test_track.length_less_than') + '300', trigger: 'blur'}]
|
||||||
|
|
|
@ -130,7 +130,8 @@
|
||||||
import MsTableOperator from "../../../common/components/MsTableOperator";
|
import MsTableOperator from "../../../common/components/MsTableOperator";
|
||||||
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
|
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
|
||||||
import MsTableButton from "../../../common/components/MsTableButton";
|
import MsTableButton from "../../../common/components/MsTableButton";
|
||||||
import {_filter, _sort, downloadFile, humpToLine} from "../../../../../common/js/utils";
|
import {_filter, _sort} from "../../../../../common/js/utils";
|
||||||
|
import {TEST_CASE_CONFIGS} from "../../../common/components/search/search-components";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestCaseList",
|
name: "TestCaseList",
|
||||||
|
@ -147,7 +148,9 @@
|
||||||
return {
|
return {
|
||||||
result: {},
|
result: {},
|
||||||
deletePath: "/test/case/delete",
|
deletePath: "/test/case/delete",
|
||||||
condition: {},
|
condition: {
|
||||||
|
components: TEST_CASE_CONFIGS
|
||||||
|
},
|
||||||
tableData: [],
|
tableData: [],
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
@ -193,11 +196,20 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initTableData() {
|
initTableData(combine) {
|
||||||
this.condition.nodeIds = this.selectNodeIds;
|
// 只有在点击高级搜索的查询按钮时combine才有值
|
||||||
|
let condition = combine ? {combine: combine} : this.condition;
|
||||||
|
if (this.planId) {
|
||||||
|
// param.planId = this.planId;
|
||||||
|
condition.planId = this.planId;
|
||||||
|
}
|
||||||
|
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
|
||||||
|
// param.nodeIds = this.selectNodeIds;
|
||||||
|
condition.nodeIds = this.selectNodeIds;
|
||||||
|
}
|
||||||
if (this.currentProject) {
|
if (this.currentProject) {
|
||||||
this.condition.projectId = this.currentProject.id;
|
condition.projectId = this.currentProject.id;
|
||||||
this.result = this.$post(this.buildPagePath('/test/case/list'), this.condition, response => {
|
this.result = this.$post(this.buildPagePath('/test/case/list'), condition, response => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
this.total = data.itemCount;
|
this.total = data.itemCount;
|
||||||
this.tableData = data.listObject;
|
this.tableData = data.listObject;
|
||||||
|
@ -252,7 +264,7 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
refresh() {
|
refresh() {
|
||||||
this.condition = {};
|
this.condition = {components: TEST_CASE_CONFIGS};
|
||||||
this.selectIds.clear();
|
this.selectIds.clear();
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
},
|
},
|
||||||
|
|
|
@ -109,6 +109,8 @@ export default {
|
||||||
handleDragEnd(draggingNode, dropNode, dropType, ev) {
|
handleDragEnd(draggingNode, dropNode, dropType, ev) {
|
||||||
let param = {};
|
let param = {};
|
||||||
param.id = draggingNode.data.id;
|
param.id = draggingNode.data.id;
|
||||||
|
param.name = draggingNode.data.name;
|
||||||
|
param.projectId = draggingNode.data.projectId;
|
||||||
if (dropType === "inner") {
|
if (dropType === "inner") {
|
||||||
param.parentId = dropNode.data.id;
|
param.parentId = dropNode.data.id;
|
||||||
param.level = dropNode.data.level + 1;
|
param.level = dropNode.data.level + 1;
|
||||||
|
|
|
@ -118,6 +118,7 @@
|
||||||
import TestReportTemplateList from "../view/comonents/TestReportTemplateList";
|
import TestReportTemplateList from "../view/comonents/TestReportTemplateList";
|
||||||
import TestCaseReportView from "../view/comonents/report/TestCaseReportView";
|
import TestCaseReportView from "../view/comonents/report/TestCaseReportView";
|
||||||
import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm";
|
import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm";
|
||||||
|
import {TEST_PLAN_CONFIGS} from "../../../common/components/search/search-components";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestPlanList",
|
name: "TestPlanList",
|
||||||
|
@ -133,7 +134,9 @@
|
||||||
result: {},
|
result: {},
|
||||||
queryPath: "/test/plan/list",
|
queryPath: "/test/plan/list",
|
||||||
deletePath: "/test/plan/delete",
|
deletePath: "/test/plan/delete",
|
||||||
condition: {},
|
condition: {
|
||||||
|
components: TEST_PLAN_CONFIGS
|
||||||
|
},
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
isTestManagerOrTestUser: false,
|
isTestManagerOrTestUser: false,
|
||||||
|
@ -164,8 +167,18 @@
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initTableData() {
|
initTableData(combine) {
|
||||||
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
|
// 只有在点击高级搜索的查询按钮时combine才有值
|
||||||
|
let condition = combine ? {combine: combine} : this.condition;
|
||||||
|
if (this.planId) {
|
||||||
|
// param.planId = this.planId;
|
||||||
|
condition.planId = this.planId;
|
||||||
|
}
|
||||||
|
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
|
||||||
|
// param.nodeIds = this.selectNodeIds;
|
||||||
|
condition.nodeIds = this.selectNodeIds;
|
||||||
|
}
|
||||||
|
this.result = this.$post(this.buildPagePath(this.queryPath), condition, response => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
this.total = data.itemCount;
|
this.total = data.itemCount;
|
||||||
this.tableData = data.listObject;
|
this.tableData = data.listObject;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<el-dialog :title="$t('test_track.plan_view.relevance_test_case')"
|
<el-dialog :title="$t('test_track.plan_view.relevance_test_case')"
|
||||||
:visible.sync="dialogFormVisible"
|
:visible.sync="dialogFormVisible"
|
||||||
@close="close"
|
@close="close"
|
||||||
width="60%"
|
width="60%" v-loading="result.loading"
|
||||||
top="50px">
|
top="50px">
|
||||||
|
|
||||||
<el-container class="main-content">
|
<el-container class="main-content">
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
</el-aside>
|
</el-aside>
|
||||||
|
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-main class="case-content" v-loading="result.loading">
|
<el-main class="case-content">
|
||||||
<ms-table-header :condition.sync="condition" @search="getCaseNames" title="" :show-create="false"/>
|
<ms-table-header :condition.sync="condition" @search="getCaseNames" title="" :show-create="false"/>
|
||||||
<el-table
|
<el-table
|
||||||
:data="testCases"
|
:data="testCases"
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
row-key="id"
|
row-key="id"
|
||||||
@select-all="handleSelectAll"
|
@select-all="handleSelectAll"
|
||||||
@select="handleSelectionChange"
|
@select="handleSelectionChange"
|
||||||
height="70vh"
|
height="50vh"
|
||||||
ref="table">
|
ref="table">
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
|
@ -145,7 +145,7 @@
|
||||||
let param = {};
|
let param = {};
|
||||||
param.planId = this.planId;
|
param.planId = this.planId;
|
||||||
param.testCaseIds = [...this.selectIds];
|
param.testCaseIds = [...this.selectIds];
|
||||||
this.$post('/test/plan/relevance', param, () => {
|
this.result = this.$post('/test/plan/relevance', param, () => {
|
||||||
this.selectIds.clear();
|
this.selectIds.clear();
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
this.dialogFormVisible = false;
|
this.dialogFormVisible = false;
|
||||||
|
|
|
@ -88,6 +88,10 @@
|
||||||
<span class="cast_label">{{$t('test_track.case.module')}}:</span>
|
<span class="cast_label">{{$t('test_track.case.module')}}:</span>
|
||||||
<span class="cast_item">{{testCase.nodePath}}</span>
|
<span class="cast_item">{{testCase.nodePath}}</span>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="4" :offset="1">
|
||||||
|
<span class="cast_label">{{$t('test_track.case.prerequisite')}}:</span>
|
||||||
|
<span class="cast_item">{{testCase.prerequisite}}</span>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row v-if="testCase.method == 'auto' && testCase.testId">
|
<el-row v-if="testCase.method == 'auto' && testCase.testId">
|
||||||
|
@ -121,17 +125,18 @@
|
||||||
:default-sort="{prop: 'num', order: 'ascending'}"
|
:default-sort="{prop: 'num', order: 'ascending'}"
|
||||||
highlight-current-row>
|
highlight-current-row>
|
||||||
<el-table-column :label="$t('test_track.case.number')" prop="num" min-width="5%"></el-table-column>
|
<el-table-column :label="$t('test_track.case.number')" prop="num" min-width="5%"></el-table-column>
|
||||||
<el-table-column :label="$t('test_track.case.step_desc')" prop="desc" min-width="29%">
|
|
||||||
|
<el-table-column :label="$t('test_track.case.step_desc')" prop="desc" min-width="21%">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span>{{scope.row.desc}}</span>
|
<span>{{scope.row.desc}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('test_track.case.expected_results')" prop="result" min-width="28%">
|
<el-table-column :label="$t('test_track.case.expected_results')" prop="result" min-width="21%">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span>{{scope.row.result}}</span>
|
<span>{{scope.row.result}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('test_track.plan_view.actual_result')" min-width="29%">
|
<el-table-column :label="$t('test_track.plan_view.actual_result')" min-width="21%">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<el-input
|
<el-input
|
||||||
size="mini"
|
size="mini"
|
||||||
|
@ -145,7 +150,7 @@
|
||||||
<span>{{scope.row.actualResult}}</span>
|
<span>{{scope.row.actualResult}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('test_track.plan_view.step_result')" min-width="9%">
|
<el-table-column :label="$t('test_track.plan_view.step_result')" min-width="12%">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<el-select
|
<el-select
|
||||||
:disabled="isReadOnly"
|
:disabled="isReadOnly"
|
||||||
|
@ -297,15 +302,6 @@
|
||||||
+ this.$t('test_track.length_less_than') + '300');
|
+ this.$t('test_track.length_less_than') + '300');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.testCase.method != 'auto') {
|
|
||||||
if (!result.executeResult) {
|
|
||||||
this.$warning(this.testCase.steptResults[i].desc + this.$t('test_track.execution_result')
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
param.results.push(result);
|
param.results.push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,8 @@
|
||||||
priorityFilters: [
|
priorityFilters: [
|
||||||
{text: 'P0', value: 'P0'},
|
{text: 'P0', value: 'P0'},
|
||||||
{text: 'P1', value: 'P1'},
|
{text: 'P1', value: 'P1'},
|
||||||
{text: 'P2', value: 'P2'}
|
{text: 'P2', value: 'P2'},
|
||||||
|
{text: 'P3', value: 'P3'}
|
||||||
],
|
],
|
||||||
methodFilters: [
|
methodFilters: [
|
||||||
{text: this.$t('test_track.case.manual'), value: 'manual'},
|
{text: this.$t('test_track.case.manual'), value: 'manual'},
|
||||||
|
|
|
@ -19,12 +19,12 @@
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<span>{{$t('report.test_start_time')}}:</span>
|
<span>{{$t('report.test_start_time')}}:</span>
|
||||||
<span v-if="!isReport">{{reportInfo.startTime}}</span>
|
<span v-if="!isReport">{{reportInfo.startTime}}</span>
|
||||||
<el-date-picker v-if="isReport" size="mini" type="date" :placeholder="$t('commons.select_date')" v-model="reportInfo.startTime"/>
|
<el-date-picker @change="startTimeChange" v-if="isReport" size="mini" type="date" :placeholder="$t('commons.select_date')" v-model="reportInfo.startTime"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<span>{{$t('report.test_end_time')}}:</span>
|
<span>{{$t('report.test_end_time')}}:</span>
|
||||||
<span v-if="!isReport">{{reportInfo.endTime}}</span>
|
<span v-if="!isReport">{{reportInfo.endTime}}</span>
|
||||||
<el-date-picker v-if="isReport" size="mini" type="date" :placeholder="$t('commons.select_date')" v-model="reportInfo.endTime"/>
|
<el-date-picker @change="endTimeChange" v-if="isReport" size="mini" type="date" :placeholder="$t('commons.select_date')" v-model="reportInfo.endTime"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
principal: 'Michael',
|
principal: 'Michael',
|
||||||
executors: ['Michael','Tom','Jiessie'],
|
executors: ['Michael','Tom','Jiessie'],
|
||||||
startTime: '2020-6-18',
|
startTime: '2020-6-18',
|
||||||
endTime: '2020-6-18'
|
endTime: '2020-6-19'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -63,6 +63,20 @@
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
startTimeChange(value) {
|
||||||
|
if (!!this.reportInfo.endTime && this.reportInfo.endTime - this.reportInfo.startTime < 0) {
|
||||||
|
this.reportInfo.startTime = undefined;
|
||||||
|
this.$warning(this.$t('commons.date.data_time_error'));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
endTimeChange(value) {
|
||||||
|
if (!!this.reportInfo.startTime && this.reportInfo.endTime - this.reportInfo.startTime < 0) {
|
||||||
|
this.reportInfo.endTime = undefined;
|
||||||
|
this.$warning(this.$t('commons.date.data_time_error'));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
return {
|
return {
|
||||||
dataMap: new Map([
|
dataMap: new Map([
|
||||||
["Pass", {name: this.$t('test_track.plan_view.pass'), itemStyle: {color: '#67C23A'}}],
|
["Pass", {name: this.$t('test_track.plan_view.pass'), itemStyle: {color: '#67C23A'}}],
|
||||||
|
["Failure", {name: this.$t('test_track.plan_view.failure'), itemStyle: {color: '#F56C6C'}}],
|
||||||
["Blocking", {name: this.$t('test_track.plan_view.blocking'), itemStyle: {color: '#E6A23C'}}],
|
["Blocking", {name: this.$t('test_track.plan_view.blocking'), itemStyle: {color: '#E6A23C'}}],
|
||||||
["Skip", {name: this.$t('test_track.plan_view.skip'), itemStyle: {color: '#909399'}}],
|
["Skip", {name: this.$t('test_track.plan_view.skip'), itemStyle: {color: '#909399'}}],
|
||||||
["Prepare", {name: this.$t('test_track.plan.plan_status_prepare'), itemStyle: {color: '#DEDE10'}}],
|
["Underway", {name: this.$t('test_track.plan.plan_status_running'), itemStyle: {color: 'lightskyblue'}}],
|
||||||
["Failure", {name: this.$t('test_track.plan_view.failure'), itemStyle: {color: '#F56C6C'}}],
|
["Prepare", {name: this.$t('test_track.plan.plan_status_prepare'), itemStyle: {color: '#DEDE10'}}]
|
||||||
["Underway", {name: this.$t('test_track.plan.plan_status_running'), itemStyle: {color: 'lightskyblue'}}]
|
|
||||||
]),
|
]),
|
||||||
charData: [],
|
charData: [],
|
||||||
isShow: true
|
isShow: true
|
||||||
|
@ -40,11 +40,11 @@
|
||||||
default() {
|
default() {
|
||||||
return [
|
return [
|
||||||
{status: 'Pass', count: '235'},
|
{status: 'Pass', count: '235'},
|
||||||
|
{status: 'Failure', count: '310'},
|
||||||
{status: 'Blocking', count: '274'},
|
{status: 'Blocking', count: '274'},
|
||||||
{status: 'Skip', count: '335'},
|
{status: 'Skip', count: '335'},
|
||||||
{status: 'Prepare', count: '265'},
|
|
||||||
{status: 'Failure', count: '310'},
|
|
||||||
{status: 'Underway', count: '245'},
|
{status: 'Underway', count: '245'},
|
||||||
|
{status: 'Prepare', count: '265'},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,12 +219,16 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleSave() {
|
handleSave() {
|
||||||
|
let pattern = new RegExp("[`~!@#$^&*=|{}':;',<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]");
|
||||||
if (this.template.name == null || this.template.name == '') {
|
if (this.template.name == null || this.template.name == '') {
|
||||||
this.$warning(this.$t('test_track.plan_view.input_template_name'));
|
this.$warning(this.$t('test_track.plan_view.input_template_name'));
|
||||||
return;
|
return;
|
||||||
} else if (this.template.name.length > 64) {
|
} else if (this.template.name.length > 64) {
|
||||||
this.$warning(this.$t('commons.name') + this.$t('test_track.length_less_than') + '64');
|
this.$warning(this.$t('commons.name') + this.$t('test_track.length_less_than') + '64');
|
||||||
return;
|
return;
|
||||||
|
} else if (pattern.test(this.template.name)) {
|
||||||
|
this.$warning(this.$t('test_track.plan_view.template_special_characters'));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
let param = {};
|
let param = {};
|
||||||
this.buildParam(param);
|
this.buildParam(param);
|
||||||
|
|
|
@ -114,6 +114,7 @@ export default {
|
||||||
start_date_time: 'Start date and time',
|
start_date_time: 'Start date and time',
|
||||||
end_date_time: 'End date time',
|
end_date_time: 'End date time',
|
||||||
range_separator: "To",
|
range_separator: "To",
|
||||||
|
data_time_error: "Start date cannot be later than the end date",
|
||||||
},
|
},
|
||||||
trigger_mode: {
|
trigger_mode: {
|
||||||
name: "Trigger Mode",
|
name: "Trigger Mode",
|
||||||
|
@ -231,7 +232,7 @@ export default {
|
||||||
org_admin: 'Org_Admin',
|
org_admin: 'Org_Admin',
|
||||||
test_manager: 'Test Manager',
|
test_manager: 'Test Manager',
|
||||||
test_user: 'Test User',
|
test_user: 'Test User',
|
||||||
test_viewer: 'Test Viewer',
|
test_viewer: 'Read-only User',
|
||||||
add: 'Add Role',
|
add: 'Add Role',
|
||||||
},
|
},
|
||||||
report: {
|
report: {
|
||||||
|
@ -611,6 +612,7 @@ export default {
|
||||||
component_library_tip: "Drag and drop the component from the component library, add to the right, preview the report effect, only one can be added per system component.",
|
component_library_tip: "Drag and drop the component from the component library, add to the right, preview the report effect, only one can be added per system component.",
|
||||||
delete_component_tip: "Please reserve at least one component",
|
delete_component_tip: "Please reserve at least one component",
|
||||||
input_template_name: "Input template name",
|
input_template_name: "Input template name",
|
||||||
|
template_special_characters: 'Template name does not support special characters',
|
||||||
case_count: "Case count",
|
case_count: "Case count",
|
||||||
issues_count: "Issues count",
|
issues_count: "Issues count",
|
||||||
result_statistics: "Result statistics",
|
result_statistics: "Result statistics",
|
||||||
|
@ -693,7 +695,7 @@ export default {
|
||||||
please_input_cron_expression: "Please Input Cron Expression",
|
please_input_cron_expression: "Please Input Cron Expression",
|
||||||
generate_expression: "Generate Expression",
|
generate_expression: "Generate Expression",
|
||||||
cron_expression_format_error: "Cron Expression Format Error",
|
cron_expression_format_error: "Cron Expression Format Error",
|
||||||
cron_expression_interval_short_error: "Interval Time Should Longer than 5 Minutes",
|
cron_expression_interval_short_error: "Interval time shorter than 3 minutes, please avoid running tests that take too long",
|
||||||
cron: {
|
cron: {
|
||||||
seconds: "Seconds",
|
seconds: "Seconds",
|
||||||
minutes: "Minutes",
|
minutes: "Minutes",
|
||||||
|
|
|
@ -114,6 +114,7 @@ export default {
|
||||||
start_date_time: '开始日期时间',
|
start_date_time: '开始日期时间',
|
||||||
end_date_time: '结束日期时间',
|
end_date_time: '结束日期时间',
|
||||||
range_separator: "至",
|
range_separator: "至",
|
||||||
|
data_time_error: "开始日期不能大于结束日期",
|
||||||
},
|
},
|
||||||
trigger_mode: {
|
trigger_mode: {
|
||||||
name: "触发方式",
|
name: "触发方式",
|
||||||
|
@ -229,7 +230,7 @@ export default {
|
||||||
org_admin: '组织管理员',
|
org_admin: '组织管理员',
|
||||||
test_manager: '测试经理',
|
test_manager: '测试经理',
|
||||||
test_user: '测试人员',
|
test_user: '测试人员',
|
||||||
test_viewer: 'Viewer',
|
test_viewer: '只读用户',
|
||||||
add: '添加角色',
|
add: '添加角色',
|
||||||
},
|
},
|
||||||
report: {
|
report: {
|
||||||
|
@ -427,10 +428,10 @@ export default {
|
||||||
file_size_limit: "文件大小不超过 20 M",
|
file_size_limit: "文件大小不超过 20 M",
|
||||||
tip: "说明",
|
tip: "说明",
|
||||||
export_tip: "导出方法",
|
export_tip: "导出方法",
|
||||||
ms_tip: "支持 MeterSphere json 格式",
|
ms_tip: "支持 Metersphere json 格式",
|
||||||
ms_export_tip: "通过 MeterSphere Api 测试页面或者浏览器插件导出 json 格式文件",
|
ms_export_tip: "通过 Metersphere 接口测试页面或者浏览器插件导出 json 格式文件",
|
||||||
postman_tip: "只支持 Postman Collection v2.1 格式的 json 文件",
|
postman_tip: "只支持 Postman Collection v2.1 格式的 json 文件",
|
||||||
swagger_tip: "只支持 Swagger2.x 版本的 json 文件",
|
swagger_tip: "只支持 Swagger 2.x 版本的 json 文件",
|
||||||
post_export_tip: "通过 Postman 导出测试集合",
|
post_export_tip: "通过 Postman 导出测试集合",
|
||||||
swagger_export_tip: "通过 Swagger 页面导出",
|
swagger_export_tip: "通过 Swagger 页面导出",
|
||||||
suffixFormatErr: "文件格式不符合要求",
|
suffixFormatErr: "文件格式不符合要求",
|
||||||
|
@ -612,6 +613,7 @@ export default {
|
||||||
component_library_tip: "拖拽组件库中组件,添加至右侧,预览报告效果,每个系统组件只能添加一个。",
|
component_library_tip: "拖拽组件库中组件,添加至右侧,预览报告效果,每个系统组件只能添加一个。",
|
||||||
delete_component_tip: "请至少保留一个组件",
|
delete_component_tip: "请至少保留一个组件",
|
||||||
input_template_name: "输入模版名称",
|
input_template_name: "输入模版名称",
|
||||||
|
template_special_characters: '模版名称不支持特殊字符',
|
||||||
case_count: "用例数",
|
case_count: "用例数",
|
||||||
issues_count: "缺陷数",
|
issues_count: "缺陷数",
|
||||||
result_statistics: "测试结果统计",
|
result_statistics: "测试结果统计",
|
||||||
|
@ -693,7 +695,7 @@ export default {
|
||||||
please_input_cron_expression: "请输入 Cron 表达式",
|
please_input_cron_expression: "请输入 Cron 表达式",
|
||||||
generate_expression: "生成表达式",
|
generate_expression: "生成表达式",
|
||||||
cron_expression_format_error: "Cron 表达式格式错误",
|
cron_expression_format_error: "Cron 表达式格式错误",
|
||||||
cron_expression_interval_short_error: "间隔时间请大于 5 分钟",
|
cron_expression_interval_short_error: "间隔时间小于 3 分钟, 请避免执行耗时过长的测试",
|
||||||
cron: {
|
cron: {
|
||||||
seconds: "秒",
|
seconds: "秒",
|
||||||
minutes: "分钟",
|
minutes: "分钟",
|
||||||
|
|
|
@ -112,6 +112,7 @@ export default {
|
||||||
start_date_time: '開始日期時間',
|
start_date_time: '開始日期時間',
|
||||||
end_date_time: '結束日期時間',
|
end_date_time: '結束日期時間',
|
||||||
range_separator: "至",
|
range_separator: "至",
|
||||||
|
data_time_error: "開始日期不能大於結束日期",
|
||||||
},
|
},
|
||||||
trigger_mode: {
|
trigger_mode: {
|
||||||
name: "觸發方式",
|
name: "觸發方式",
|
||||||
|
@ -228,7 +229,7 @@ export default {
|
||||||
org_admin: '組織管理員',
|
org_admin: '組織管理員',
|
||||||
test_manager: '測試經理',
|
test_manager: '測試經理',
|
||||||
test_user: '測試人員',
|
test_user: '測試人員',
|
||||||
test_viewer: 'Viewer',
|
test_viewer: '只讀用戶',
|
||||||
add: '添加角色',
|
add: '添加角色',
|
||||||
},
|
},
|
||||||
report: {
|
report: {
|
||||||
|
@ -610,6 +611,7 @@ export default {
|
||||||
component_library_tip: "拖拽組件庫中組件,添加至右側,預覽報告效果,每個系統組件只能添加壹個。",
|
component_library_tip: "拖拽組件庫中組件,添加至右側,預覽報告效果,每個系統組件只能添加壹個。",
|
||||||
delete_component_tip: "請至少保留壹個組件",
|
delete_component_tip: "請至少保留壹個組件",
|
||||||
input_template_name: "輸入模版名稱",
|
input_template_name: "輸入模版名稱",
|
||||||
|
template_special_characters: '模版名稱不支持特殊字符',
|
||||||
case_count: "用例數",
|
case_count: "用例數",
|
||||||
issues_count: "缺陷數",
|
issues_count: "缺陷數",
|
||||||
result_statistics: "測試結果統計",
|
result_statistics: "測試結果統計",
|
||||||
|
@ -691,7 +693,7 @@ export default {
|
||||||
please_input_cron_expression: "請輸入 Cron 表達式",
|
please_input_cron_expression: "請輸入 Cron 表達式",
|
||||||
generate_expression: "生成表達式",
|
generate_expression: "生成表達式",
|
||||||
cron_expression_format_error: "Cron 表達式格式錯誤",
|
cron_expression_format_error: "Cron 表達式格式錯誤",
|
||||||
cron_expression_interval_short_error: "間隔時間請大於 5 分鐘",
|
cron_expression_interval_short_error: "間隔時間小於 3 分鐘, 請避免執行耗時過長的測試",
|
||||||
cron: {
|
cron: {
|
||||||
seconds: "秒",
|
seconds: "秒",
|
||||||
minutes: "分鐘",
|
minutes: "分鐘",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
<link rel="icon" href="<%= BASE_URL %>favicon.png">
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
<title>MeterSphere</title>
|
<title>MeterSphere</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Reference in New Issue