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) {
|
||||
Body body = new Body();
|
||||
JSONObject postmanBody = requestDesc.getBody();
|
||||
if (postmanBody == null) {
|
||||
return null;
|
||||
}
|
||||
String bodyMode = postmanBody.getString("mode");
|
||||
if (StringUtils.equals(bodyMode, PostmanRequestBodyMode.RAW.value())) {
|
||||
body.setRaw(postmanBody.getString(bodyMode));
|
||||
|
|
|
@ -142,9 +142,20 @@
|
|||
<select id="list" resultType="io.metersphere.track.dto.TestCaseDTO">
|
||||
select test_case.* from test_case
|
||||
<where>
|
||||
<if test="request.name != null">
|
||||
and test_case.name like CONCAT('%', #{request.name},'%')
|
||||
</if>
|
||||
<choose>
|
||||
<!--高级-->
|
||||
<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">
|
||||
and test_case.node_id in
|
||||
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
|
||||
|
|
|
@ -6,15 +6,114 @@
|
|||
extends="io.metersphere.base.mapper.TestPlanMapper.BaseResultMap">
|
||||
<result column="project_name" property="projectName"/>
|
||||
</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 test_plan.*, project.name as project_name
|
||||
from test_plan
|
||||
left join project on test_plan.project_id = project.id
|
||||
<where>
|
||||
<if test="request.name != null">
|
||||
and test_plan.name like CONCAT('%', #{request.name},'%')
|
||||
</if>
|
||||
<choose>
|
||||
<!--高级-->
|
||||
<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">
|
||||
AND project.workspace_id = #{request.workspaceId}
|
||||
</if>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
</resultMap>
|
||||
|
||||
<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
|
||||
from `user` u
|
||||
<where>
|
||||
|
|
|
@ -2,9 +2,13 @@ package io.metersphere.controller;
|
|||
|
||||
import io.metersphere.base.domain.SystemParameter;
|
||||
import io.metersphere.commons.constants.ParamConstants;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.ldap.domain.LdapInfo;
|
||||
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 javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -16,11 +20,13 @@ public class SystemParameterController {
|
|||
private SystemParameterService SystemParameterService;
|
||||
|
||||
@PostMapping("/edit/email")
|
||||
@RequiresRoles(value = {RoleConstants.ADMIN})
|
||||
public void editMail(@RequestBody List<SystemParameter> systemParameter) {
|
||||
SystemParameterService.editMail(systemParameter);
|
||||
}
|
||||
|
||||
@PostMapping("/testConnection")
|
||||
@RequiresRoles(value = {RoleConstants.ADMIN})
|
||||
public void testConnection(@RequestBody HashMap<String, String> hashMap) {
|
||||
SystemParameterService.testConnection(hashMap);
|
||||
}
|
||||
|
@ -31,16 +37,19 @@ public class SystemParameterController {
|
|||
}
|
||||
|
||||
@GetMapping("/mail/info")
|
||||
@RequiresRoles(value = {RoleConstants.ADMIN})
|
||||
public Object mailInfo() {
|
||||
return SystemParameterService.mailInfo(ParamConstants.Classify.MAIL.getValue());
|
||||
}
|
||||
|
||||
@PostMapping("/save/ldap")
|
||||
@RequiresRoles(value = {RoleConstants.ADMIN})
|
||||
public void saveLdap(@RequestBody List<SystemParameter> systemParameter) {
|
||||
SystemParameterService.saveLdap(systemParameter);
|
||||
}
|
||||
|
||||
@GetMapping("/ldap/info")
|
||||
@RequiresRoles(value = {RoleConstants.ADMIN})
|
||||
public LdapInfo getLdapInfo() {
|
||||
return SystemParameterService.getLdapInfo(ParamConstants.Classify.LDAP.getValue());
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package io.metersphere.controller;
|
||||
|
||||
import io.metersphere.base.domain.UserKey;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.security.ApiKeyHandler;
|
||||
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.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
@ -16,6 +19,7 @@ import java.util.List;
|
|||
|
||||
@RestController
|
||||
@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 {
|
||||
|
||||
@Resource
|
||||
|
|
|
@ -109,7 +109,7 @@ public class DockerTestEngine extends AbstractEngine {
|
|||
restTemplateWithTimeOut.getForObject(uri, String.class);
|
||||
} catch (Exception 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")
|
||||
@RestController
|
||||
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
|
||||
public class TestCaseController {
|
||||
|
||||
@Resource
|
||||
|
|
|
@ -10,10 +10,11 @@ import org.apache.shiro.authz.annotation.RequiresRoles;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
@RequestMapping("/case/node")
|
||||
@RestController
|
||||
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
|
||||
public class TestCaseNodeController {
|
||||
|
||||
@Resource
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.track.domain;
|
||||
|
||||
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
|
||||
import io.metersphere.track.dto.TestCaseReportMetricDTO;
|
||||
import io.metersphere.track.dto.TestCaseReportStatusResultDTO;
|
||||
import io.metersphere.track.dto.TestPlanCaseDTO;
|
||||
|
@ -7,6 +8,7 @@ import io.metersphere.track.dto.TestPlanDTO;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ReportResultChartComponent extends ReportComponent {
|
||||
|
@ -25,7 +27,24 @@ public class ReportResultChartComponent extends ReportComponent {
|
|||
|
||||
@Override
|
||||
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) {
|
||||
|
|
|
@ -19,4 +19,6 @@ public class QueryTestPlanRequest extends TestPlan {
|
|||
private List<OrderRequest> orders;
|
||||
|
||||
private Map<String, List<String>> filters;
|
||||
|
||||
private Map<String, Object> combine;
|
||||
}
|
||||
|
|
|
@ -45,11 +45,7 @@ public class TestCaseNodeService {
|
|||
SqlSessionFactory sqlSessionFactory;
|
||||
|
||||
public String addNode(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"));
|
||||
}
|
||||
validateNode(node);
|
||||
node.setCreateTime(System.currentTimeMillis());
|
||||
node.setUpdateTime(System.currentTimeMillis());
|
||||
node.setId(UUID.randomUUID().toString());
|
||||
|
@ -57,6 +53,34 @@ public class TestCaseNodeService {
|
|||
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) {
|
||||
TestCaseNodeExample testCaseNodeExample = new TestCaseNodeExample();
|
||||
testCaseNodeExample.createCriteria().andProjectIdEqualTo(projectId);
|
||||
|
@ -119,7 +143,7 @@ public class TestCaseNodeService {
|
|||
|
||||
public int editNode(DragNodeRequest request) {
|
||||
request.setUpdateTime(System.currentTimeMillis());
|
||||
|
||||
checkTestCaseNodeExist(request);
|
||||
List<TestCaseDTO> testCases = QueryTestCaseByNodeIds(request.getNodeIds());
|
||||
|
||||
testCases.forEach(testCase -> {
|
||||
|
@ -376,7 +400,7 @@ public class TestCaseNodeService {
|
|||
|
||||
public void dragNode(DragNodeRequest request) {
|
||||
|
||||
// editNode(request);
|
||||
checkTestCaseNodeExist(request);
|
||||
|
||||
List<String> nodeIds = request.getNodeIds();
|
||||
|
||||
|
|
|
@ -73,14 +73,7 @@ public class TestCaseService {
|
|||
|
||||
public void addTestCase(TestCaseWithBLOBs testCase) {
|
||||
testCase.setName(testCase.getName());
|
||||
TestCaseExample testCaseExample = new TestCaseExample();
|
||||
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());
|
||||
}
|
||||
checkTestCaseExist(testCase);
|
||||
testCase.setId(UUID.randomUUID().toString());
|
||||
testCase.setCreateTime(System.currentTimeMillis());
|
||||
testCase.setUpdateTime(System.currentTimeMillis());
|
||||
|
@ -107,10 +100,12 @@ public class TestCaseService {
|
|||
private void checkTestCaseExist(TestCaseWithBLOBs testCase) {
|
||||
if (testCase.getName() != null) {
|
||||
TestCaseExample example = new TestCaseExample();
|
||||
example.createCriteria()
|
||||
.andNameEqualTo(testCase.getName())
|
||||
.andProjectIdEqualTo(testCase.getProjectId())
|
||||
.andIdNotEqualTo(testCase.getId());
|
||||
TestCaseExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andNameEqualTo(testCase.getName())
|
||||
.andProjectIdEqualTo(testCase.getProjectId());
|
||||
if (StringUtils.isNotBlank(testCase.getId())) {
|
||||
criteria.andIdNotEqualTo(testCase.getId());
|
||||
}
|
||||
if (testCaseMapper.selectByExample(example).size() > 0) {
|
||||
MSException.throwException(Translator.get("test_case_already_exists"));
|
||||
}
|
||||
|
@ -366,7 +361,7 @@ public class TestCaseService {
|
|||
data.setStepResult("");
|
||||
data.setRemark(t.getPerformName());
|
||||
}
|
||||
data.setMaintainer(user.getId());
|
||||
data.setMaintainer(t.getMaintainer());
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
VALUES (uuid(), '默认组织', '系统默认创建的组织', 1581576575948, 1581576575948);
|
||||
VALUES (uuid(), '默认组织', '系统默认创建的组织', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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
|
||||
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_module_already_exists=The module name already exists at the same level
|
||||
api_test_name_already_exists=Test name already exists
|
||||
|
||||
#ldap
|
||||
|
|
|
@ -46,7 +46,7 @@ max_thread_insufficient=并发用户数超额
|
|||
related_case_del_fail_prefix=已关联到
|
||||
related_case_del_fail_suffix=测试用例,请先解除关联
|
||||
jmx_content_valid=JMX 内容无效,请检查
|
||||
container_delete_fail=容器停止失败,请重试
|
||||
container_delete_fail=容器由于网络原因停止失败,请重试
|
||||
#workspace
|
||||
workspace_name_is_null=工作空间名不能为空
|
||||
workspace_name_already_exists=工作空间名已存在
|
||||
|
@ -115,6 +115,7 @@ please_input_workspace_member=请填写该工作空间相关人员
|
|||
test_case_report_template_repeat=同一工作空间下不能存在同名模版
|
||||
plan_name_already_exists=测试计划名称已存在
|
||||
test_case_already_exists_excel=导入文件中存在重复用例
|
||||
test_case_module_already_exists=同层级下已存在该模块名称
|
||||
api_test_name_already_exists=测试名称已经存在
|
||||
|
||||
#ldap
|
||||
|
|
|
@ -46,7 +46,7 @@ max_thread_insufficient=並發用戶數超額
|
|||
related_case_del_fail_prefix=已關聯到
|
||||
related_case_del_fail_suffix=測試用例,請先解除關聯
|
||||
jmx_content_valid=JMX 內容無效,請檢查
|
||||
container_delete_fail=容器停止失敗,請重試
|
||||
container_delete_fail=容器由於網絡原因停止失敗,請重試
|
||||
#workspace
|
||||
workspace_name_is_null=工作空間名不能為空
|
||||
workspace_name_already_exists=工作空間名已存在
|
||||
|
@ -115,6 +115,7 @@ please_input_workspace_member=請填寫該工作空間相關人員
|
|||
test_case_report_template_repeat=同壹工作空間下不能存在同名模版
|
||||
plan_name_already_exists=測試計劃名稱已存在
|
||||
test_case_already_exists_excel=導入文件中存在重復用例
|
||||
test_case_module_already_exists=同層級下已存在該模塊名稱
|
||||
api_test_name_already_exists=測試名稱已經存在
|
||||
|
||||
#ldap
|
||||
|
|
|
@ -161,6 +161,8 @@
|
|||
this.$router.push({
|
||||
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: {
|
||||
createScenario: function () {
|
||||
this.scenarios.push(new Scenario());
|
||||
|
@ -119,6 +129,22 @@
|
|||
this.activeName = 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) {
|
||||
if (this.environments[i].id === this.scenario.environmentId) {
|
||||
this.scenario.environment = this.environments[i];
|
||||
this.setRequestEnvironments();
|
||||
hasEnvironment = true;
|
||||
break;
|
||||
}
|
||||
|
@ -124,7 +123,6 @@
|
|||
for (let i in this.environments) {
|
||||
if (this.environments[i].id === value) {
|
||||
this.scenario.environment = this.environments[i];
|
||||
this.setRequestEnvironments();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -144,11 +142,6 @@
|
|||
},
|
||||
environmentConfigClose() {
|
||||
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">
|
||||
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
|
||||
<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/>
|
||||
</el-col>
|
||||
<el-col>
|
||||
|
@ -35,7 +35,11 @@
|
|||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
showVariable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<div class="variable-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="variable">{{variable}}</div>
|
||||
<div :class="{'hidden': !showVariable}" class="variable-combine" v-if="value">
|
||||
<div class="variable">{{variable}}</div>
|
||||
<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"/>
|
||||
</el-tooltip>
|
||||
|
@ -20,7 +20,11 @@
|
|||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
showVariable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
|
@ -93,4 +97,9 @@
|
|||
cursor: pointer;
|
||||
color: #1E90FF;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
</el-form-item>
|
||||
|
||||
<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>
|
||||
<ms-api-key-value :items="environment.headers" :suggestions="headerSuggestions"/>
|
||||
|
|
|
@ -280,8 +280,8 @@ export class HTTPSamplerProxy extends DefaultTestElement {
|
|||
this.request = request || {};
|
||||
|
||||
if (request.useEnvironment) {
|
||||
this.stringProp("HTTPSampler.domain", this.request.environment.domain);
|
||||
this.stringProp("HTTPSampler.protocol", this.request.environment.protocol);
|
||||
this.stringProp("HTTPSampler.domain", request.domain);
|
||||
this.stringProp("HTTPSampler.protocol", request.protocol);
|
||||
this.stringProp("HTTPSampler.path", this.request.path);
|
||||
} else {
|
||||
this.stringProp("HTTPSampler.domain", this.request.hostname);
|
||||
|
|
|
@ -161,6 +161,7 @@ export class Scenario extends BaseConfig {
|
|||
this.requests = [];
|
||||
this.environmentId = undefined;
|
||||
this.dubboConfig = undefined;
|
||||
this.environment = undefined;
|
||||
|
||||
this.set(options);
|
||||
this.sets({variables: KeyValue, headers: KeyValue, requests: RequestFactory}, options);
|
||||
|
@ -179,7 +180,7 @@ export class Scenario extends BaseConfig {
|
|||
|
||||
isValid() {
|
||||
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) {
|
||||
return validator;
|
||||
}
|
||||
|
@ -257,9 +258,9 @@ export class HttpRequest extends Request {
|
|||
return options;
|
||||
}
|
||||
|
||||
isValid() {
|
||||
if (this.useEnvironment) {
|
||||
if (!this.environment) {
|
||||
isValid(environmentId) {
|
||||
if (this.useEnvironment){
|
||||
if (!environmentId) {
|
||||
return {
|
||||
isValid: false,
|
||||
info: 'api_test.request.please_configure_environment_in_scenario'
|
||||
|
@ -613,7 +614,7 @@ const JMX_ASSERTION_CONDITION = {
|
|||
}
|
||||
|
||||
class JMXHttpRequest {
|
||||
constructor(request) {
|
||||
constructor(request, environment) {
|
||||
if (request && request instanceof HttpRequest && (request.url || request.path)) {
|
||||
this.useEnvironment = request.useEnvironment;
|
||||
this.method = request.method;
|
||||
|
@ -625,10 +626,12 @@ class JMXHttpRequest {
|
|||
this.protocol = url.protocol.split(":")[0];
|
||||
this.pathname = this.getPostQueryParameters(request, this.pathname);
|
||||
} else {
|
||||
this.environment = request.environment;
|
||||
this.port = request.environment.port;
|
||||
this.path = decodeURIComponent(request.path);
|
||||
this.path = this.getPostQueryParameters(request, this.path);
|
||||
if (environment) {
|
||||
this.port = environment.port;
|
||||
this.protocol = environment.protocol;
|
||||
this.domain = environment.domain;
|
||||
}
|
||||
this.path = this.getPostQueryParameters(request, decodeURIComponent(request.path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -723,7 +726,7 @@ class JMXGenerator {
|
|||
}
|
||||
|
||||
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);
|
||||
if (request.method.toUpperCase() === 'GET') {
|
||||
this.addRequestArguments(sampler, request);
|
||||
|
|
|
@ -51,9 +51,11 @@
|
|||
callback(new Error(this.$t('commons.input_content')));
|
||||
} else if (!cronValidate(cronValue)) {
|
||||
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 (!customValidate.pass){
|
||||
}
|
||||
// else if(!this.intervalShortValidate()) {
|
||||
// callback(new Error(this.$t('schedule.cron_expression_interval_short_error')));
|
||||
// }
|
||||
else if (!customValidate.pass){
|
||||
callback(new Error(customValidate.info));
|
||||
} else {
|
||||
callback();
|
||||
|
@ -87,6 +89,7 @@
|
|||
saveCron () {
|
||||
this.$refs['from'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.intervalShortValidate();
|
||||
this.save(this.form.cronValue);
|
||||
this.dialogVisible = false;
|
||||
} else {
|
||||
|
@ -103,8 +106,9 @@
|
|||
}
|
||||
},
|
||||
intervalShortValidate() {
|
||||
if (this.getIntervalTime() < 5*60*1000) {
|
||||
return false;
|
||||
if (this.getIntervalTime() < 3*60*1000) {
|
||||
// return false;
|
||||
this.$info(this.$t('schedule.cron_expression_interval_short_error'));
|
||||
}
|
||||
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 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_PLAN_CONFIGS = [NAME, UPDATE_TIME, PROJECT_NAME, CREATE_TIME, PRINCIPAL, TEST_PLAN_STATUS, STAGE];
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<el-row>
|
||||
<el-col :span="10">
|
||||
<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>
|
||||
<el-select :disabled="isReadOnly" v-model="testPlan.projectId" :placeholder="$t('load_test.select_project')">
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
rule: {
|
||||
name: [
|
||||
{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,
|
||||
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
|
||||
|
|
|
@ -72,12 +72,7 @@
|
|||
data() {
|
||||
return {
|
||||
formInline: {
|
||||
/*host: 'smtp.163.com',
|
||||
port: '465',
|
||||
account: 'xjj0608@163.com',
|
||||
password: '2345678',*/
|
||||
},
|
||||
|
||||
input: '',
|
||||
visible: true,
|
||||
result: {},
|
||||
|
@ -113,7 +108,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
activated() {
|
||||
created() {
|
||||
this.query()
|
||||
},
|
||||
methods: {
|
||||
|
@ -129,6 +124,9 @@
|
|||
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, "SMTP", JSON.parse(response.data[6].paramValue));
|
||||
this.$nextTick(() => {
|
||||
this.$refs.formInline.clearValidate();
|
||||
})
|
||||
})
|
||||
},
|
||||
change() {
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<ms-table-operator @editClick="edit(scope.row)" @deleteClick="del(scope.row)">
|
||||
<template v-slot:behind>
|
||||
<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>
|
||||
</ms-table-operator>
|
||||
</template>
|
||||
|
@ -163,7 +163,7 @@
|
|||
|
||||
<!--Modify user information in system settings-->
|
||||
<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-item label="ID" prop="id">
|
||||
<el-input v-model="form.id" autocomplete="off" :disabled="true"/>
|
||||
|
@ -172,7 +172,7 @@
|
|||
<el-input v-model="form.name" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<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 :label="$t('commons.phone')" prop="phone">
|
||||
<el-input v-model="form.phone" autocomplete="off"/>
|
||||
|
@ -488,6 +488,7 @@
|
|||
let roles = data.roles;
|
||||
// let userRoles = result.userRoles;
|
||||
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'}],
|
||||
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'}],
|
||||
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'}],
|
||||
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'}]
|
||||
|
|
|
@ -130,7 +130,8 @@
|
|||
import MsTableOperator from "../../../common/components/MsTableOperator";
|
||||
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
|
||||
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 {
|
||||
name: "TestCaseList",
|
||||
|
@ -147,7 +148,9 @@
|
|||
return {
|
||||
result: {},
|
||||
deletePath: "/test/case/delete",
|
||||
condition: {},
|
||||
condition: {
|
||||
components: TEST_CASE_CONFIGS
|
||||
},
|
||||
tableData: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
|
@ -193,11 +196,20 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
this.condition.nodeIds = this.selectNodeIds;
|
||||
initTableData(combine) {
|
||||
// 只有在点击高级搜索的查询按钮时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) {
|
||||
this.condition.projectId = this.currentProject.id;
|
||||
this.result = this.$post(this.buildPagePath('/test/case/list'), this.condition, response => {
|
||||
condition.projectId = this.currentProject.id;
|
||||
this.result = this.$post(this.buildPagePath('/test/case/list'), condition, response => {
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
|
@ -252,7 +264,7 @@
|
|||
});
|
||||
},
|
||||
refresh() {
|
||||
this.condition = {};
|
||||
this.condition = {components: TEST_CASE_CONFIGS};
|
||||
this.selectIds.clear();
|
||||
this.$emit('refresh');
|
||||
},
|
||||
|
|
|
@ -109,6 +109,8 @@ export default {
|
|||
handleDragEnd(draggingNode, dropNode, dropType, ev) {
|
||||
let param = {};
|
||||
param.id = draggingNode.data.id;
|
||||
param.name = draggingNode.data.name;
|
||||
param.projectId = draggingNode.data.projectId;
|
||||
if (dropType === "inner") {
|
||||
param.parentId = dropNode.data.id;
|
||||
param.level = dropNode.data.level + 1;
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
import TestReportTemplateList from "../view/comonents/TestReportTemplateList";
|
||||
import TestCaseReportView from "../view/comonents/report/TestCaseReportView";
|
||||
import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm";
|
||||
import {TEST_PLAN_CONFIGS} from "../../../common/components/search/search-components";
|
||||
|
||||
export default {
|
||||
name: "TestPlanList",
|
||||
|
@ -133,7 +134,9 @@
|
|||
result: {},
|
||||
queryPath: "/test/plan/list",
|
||||
deletePath: "/test/plan/delete",
|
||||
condition: {},
|
||||
condition: {
|
||||
components: TEST_PLAN_CONFIGS
|
||||
},
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
isTestManagerOrTestUser: false,
|
||||
|
@ -164,8 +167,18 @@
|
|||
this.initTableData();
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
|
||||
initTableData(combine) {
|
||||
// 只有在点击高级搜索的查询按钮时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;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<el-dialog :title="$t('test_track.plan_view.relevance_test_case')"
|
||||
:visible.sync="dialogFormVisible"
|
||||
@close="close"
|
||||
width="60%"
|
||||
width="60%" v-loading="result.loading"
|
||||
top="50px">
|
||||
|
||||
<el-container class="main-content">
|
||||
|
@ -18,7 +18,7 @@
|
|||
</el-aside>
|
||||
|
||||
<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"/>
|
||||
<el-table
|
||||
:data="testCases"
|
||||
|
@ -26,7 +26,7 @@
|
|||
row-key="id"
|
||||
@select-all="handleSelectAll"
|
||||
@select="handleSelectionChange"
|
||||
height="70vh"
|
||||
height="50vh"
|
||||
ref="table">
|
||||
|
||||
<el-table-column
|
||||
|
@ -145,7 +145,7 @@
|
|||
let param = {};
|
||||
param.planId = this.planId;
|
||||
param.testCaseIds = [...this.selectIds];
|
||||
this.$post('/test/plan/relevance', param, () => {
|
||||
this.result = this.$post('/test/plan/relevance', param, () => {
|
||||
this.selectIds.clear();
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.dialogFormVisible = false;
|
||||
|
|
|
@ -88,6 +88,10 @@
|
|||
<span class="cast_label">{{$t('test_track.case.module')}}:</span>
|
||||
<span class="cast_item">{{testCase.nodePath}}</span>
|
||||
</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 v-if="testCase.method == 'auto' && testCase.testId">
|
||||
|
@ -121,17 +125,18 @@
|
|||
:default-sort="{prop: 'num', order: 'ascending'}"
|
||||
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.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">
|
||||
<span>{{scope.row.desc}}</span>
|
||||
</template>
|
||||
</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">
|
||||
<span>{{scope.row.result}}</span>
|
||||
</template>
|
||||
</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">
|
||||
<el-input
|
||||
size="mini"
|
||||
|
@ -145,7 +150,7 @@
|
|||
<span>{{scope.row.actualResult}}</span>
|
||||
</template>
|
||||
</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">
|
||||
<el-select
|
||||
:disabled="isReadOnly"
|
||||
|
@ -297,15 +302,6 @@
|
|||
+ this.$t('test_track.length_less_than') + '300');
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -206,7 +206,8 @@
|
|||
priorityFilters: [
|
||||
{text: 'P0', value: 'P0'},
|
||||
{text: 'P1', value: 'P1'},
|
||||
{text: 'P2', value: 'P2'}
|
||||
{text: 'P2', value: 'P2'},
|
||||
{text: 'P3', value: 'P3'}
|
||||
],
|
||||
methodFilters: [
|
||||
{text: this.$t('test_track.case.manual'), value: 'manual'},
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
<el-col :span="12">
|
||||
<span>{{$t('report.test_start_time')}}:</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 :span="12">
|
||||
<span>{{$t('report.test_end_time')}}:</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-row>
|
||||
|
||||
|
@ -55,7 +55,7 @@
|
|||
principal: 'Michael',
|
||||
executors: ['Michael','Tom','Jiessie'],
|
||||
startTime: '2020-6-18',
|
||||
endTime: '2020-6-18'
|
||||
endTime: '2020-6-19'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -63,6 +63,20 @@
|
|||
type: Boolean,
|
||||
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>
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
return {
|
||||
dataMap: new Map([
|
||||
["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'}}],
|
||||
["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'}}],
|
||||
["Failure", {name: this.$t('test_track.plan_view.failure'), itemStyle: {color: '#F56C6C'}}],
|
||||
["Underway", {name: this.$t('test_track.plan.plan_status_running'), itemStyle: {color: 'lightskyblue'}}]
|
||||
["Underway", {name: this.$t('test_track.plan.plan_status_running'), itemStyle: {color: 'lightskyblue'}}],
|
||||
["Prepare", {name: this.$t('test_track.plan.plan_status_prepare'), itemStyle: {color: '#DEDE10'}}]
|
||||
]),
|
||||
charData: [],
|
||||
isShow: true
|
||||
|
@ -40,11 +40,11 @@
|
|||
default() {
|
||||
return [
|
||||
{status: 'Pass', count: '235'},
|
||||
{status: 'Failure', count: '310'},
|
||||
{status: 'Blocking', count: '274'},
|
||||
{status: 'Skip', count: '335'},
|
||||
{status: 'Prepare', count: '265'},
|
||||
{status: 'Failure', count: '310'},
|
||||
{status: 'Underway', count: '245'},
|
||||
{status: 'Prepare', count: '265'},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -219,12 +219,16 @@
|
|||
});
|
||||
},
|
||||
handleSave() {
|
||||
let pattern = new RegExp("[`~!@#$^&*=|{}':;',<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]");
|
||||
if (this.template.name == null || this.template.name == '') {
|
||||
this.$warning(this.$t('test_track.plan_view.input_template_name'));
|
||||
return;
|
||||
} else if (this.template.name.length > 64) {
|
||||
this.$warning(this.$t('commons.name') + this.$t('test_track.length_less_than') + '64');
|
||||
return;
|
||||
} else if (pattern.test(this.template.name)) {
|
||||
this.$warning(this.$t('test_track.plan_view.template_special_characters'));
|
||||
return;
|
||||
}
|
||||
let param = {};
|
||||
this.buildParam(param);
|
||||
|
|
|
@ -114,6 +114,7 @@ export default {
|
|||
start_date_time: 'Start date and time',
|
||||
end_date_time: 'End date time',
|
||||
range_separator: "To",
|
||||
data_time_error: "Start date cannot be later than the end date",
|
||||
},
|
||||
trigger_mode: {
|
||||
name: "Trigger Mode",
|
||||
|
@ -231,7 +232,7 @@ export default {
|
|||
org_admin: 'Org_Admin',
|
||||
test_manager: 'Test Manager',
|
||||
test_user: 'Test User',
|
||||
test_viewer: 'Test Viewer',
|
||||
test_viewer: 'Read-only User',
|
||||
add: 'Add Role',
|
||||
},
|
||||
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.",
|
||||
delete_component_tip: "Please reserve at least one component",
|
||||
input_template_name: "Input template name",
|
||||
template_special_characters: 'Template name does not support special characters',
|
||||
case_count: "Case count",
|
||||
issues_count: "Issues count",
|
||||
result_statistics: "Result statistics",
|
||||
|
@ -693,7 +695,7 @@ export default {
|
|||
please_input_cron_expression: "Please Input Cron Expression",
|
||||
generate_expression: "Generate Expression",
|
||||
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: {
|
||||
seconds: "Seconds",
|
||||
minutes: "Minutes",
|
||||
|
|
|
@ -114,6 +114,7 @@ export default {
|
|||
start_date_time: '开始日期时间',
|
||||
end_date_time: '结束日期时间',
|
||||
range_separator: "至",
|
||||
data_time_error: "开始日期不能大于结束日期",
|
||||
},
|
||||
trigger_mode: {
|
||||
name: "触发方式",
|
||||
|
@ -229,7 +230,7 @@ export default {
|
|||
org_admin: '组织管理员',
|
||||
test_manager: '测试经理',
|
||||
test_user: '测试人员',
|
||||
test_viewer: 'Viewer',
|
||||
test_viewer: '只读用户',
|
||||
add: '添加角色',
|
||||
},
|
||||
report: {
|
||||
|
@ -427,10 +428,10 @@ export default {
|
|||
file_size_limit: "文件大小不超过 20 M",
|
||||
tip: "说明",
|
||||
export_tip: "导出方法",
|
||||
ms_tip: "支持 MeterSphere json 格式",
|
||||
ms_export_tip: "通过 MeterSphere Api 测试页面或者浏览器插件导出 json 格式文件",
|
||||
ms_tip: "支持 Metersphere json 格式",
|
||||
ms_export_tip: "通过 Metersphere 接口测试页面或者浏览器插件导出 json 格式文件",
|
||||
postman_tip: "只支持 Postman Collection v2.1 格式的 json 文件",
|
||||
swagger_tip: "只支持 Swagger2.x 版本的 json 文件",
|
||||
swagger_tip: "只支持 Swagger 2.x 版本的 json 文件",
|
||||
post_export_tip: "通过 Postman 导出测试集合",
|
||||
swagger_export_tip: "通过 Swagger 页面导出",
|
||||
suffixFormatErr: "文件格式不符合要求",
|
||||
|
@ -612,6 +613,7 @@ export default {
|
|||
component_library_tip: "拖拽组件库中组件,添加至右侧,预览报告效果,每个系统组件只能添加一个。",
|
||||
delete_component_tip: "请至少保留一个组件",
|
||||
input_template_name: "输入模版名称",
|
||||
template_special_characters: '模版名称不支持特殊字符',
|
||||
case_count: "用例数",
|
||||
issues_count: "缺陷数",
|
||||
result_statistics: "测试结果统计",
|
||||
|
@ -693,7 +695,7 @@ export default {
|
|||
please_input_cron_expression: "请输入 Cron 表达式",
|
||||
generate_expression: "生成表达式",
|
||||
cron_expression_format_error: "Cron 表达式格式错误",
|
||||
cron_expression_interval_short_error: "间隔时间请大于 5 分钟",
|
||||
cron_expression_interval_short_error: "间隔时间小于 3 分钟, 请避免执行耗时过长的测试",
|
||||
cron: {
|
||||
seconds: "秒",
|
||||
minutes: "分钟",
|
||||
|
|
|
@ -112,6 +112,7 @@ export default {
|
|||
start_date_time: '開始日期時間',
|
||||
end_date_time: '結束日期時間',
|
||||
range_separator: "至",
|
||||
data_time_error: "開始日期不能大於結束日期",
|
||||
},
|
||||
trigger_mode: {
|
||||
name: "觸發方式",
|
||||
|
@ -228,7 +229,7 @@ export default {
|
|||
org_admin: '組織管理員',
|
||||
test_manager: '測試經理',
|
||||
test_user: '測試人員',
|
||||
test_viewer: 'Viewer',
|
||||
test_viewer: '只讀用戶',
|
||||
add: '添加角色',
|
||||
},
|
||||
report: {
|
||||
|
@ -610,6 +611,7 @@ export default {
|
|||
component_library_tip: "拖拽組件庫中組件,添加至右側,預覽報告效果,每個系統組件只能添加壹個。",
|
||||
delete_component_tip: "請至少保留壹個組件",
|
||||
input_template_name: "輸入模版名稱",
|
||||
template_special_characters: '模版名稱不支持特殊字符',
|
||||
case_count: "用例數",
|
||||
issues_count: "缺陷數",
|
||||
result_statistics: "測試結果統計",
|
||||
|
@ -691,7 +693,7 @@ export default {
|
|||
please_input_cron_expression: "請輸入 Cron 表達式",
|
||||
generate_expression: "生成表達式",
|
||||
cron_expression_format_error: "Cron 表達式格式錯誤",
|
||||
cron_expression_interval_short_error: "間隔時間請大於 5 分鐘",
|
||||
cron_expression_interval_short_error: "間隔時間小於 3 分鐘, 請避免執行耗時過長的測試",
|
||||
cron: {
|
||||
seconds: "秒",
|
||||
minutes: "分鐘",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
|
|
Loading…
Reference in New Issue