Merge remote-tracking branch 'origin/master'

# Conflicts:
#	frontend/src/business/components/api/definition/components/module/ApiModuleHeader.vue
#	frontend/src/i18n/en-US.js
#	frontend/src/i18n/zh-CN.js
#	frontend/src/i18n/zh-TW.js
This commit is contained in:
song.tianyang 2021-03-23 17:28:07 +08:00
commit dc1ef10180
76 changed files with 619 additions and 376 deletions

View File

@ -80,8 +80,8 @@ public class ApiAutomationController {
}
@PostMapping("/reduction")
public void reduction(@RequestBody List<SaveApiScenarioRequest> requests) {
apiAutomationService.reduction(requests);
public void reduction(@RequestBody List<String> ids) {
apiAutomationService.reduction(ids);
}
@GetMapping("/getApiScenario/{id}")

View File

@ -133,8 +133,8 @@ public class ApiDefinitionController {
}
@PostMapping("/reduction")
public void reduction(@RequestBody List<SaveApiDefinitionRequest> requests) {
apiDefinitionService.reduction(requests);
public void reduction(@RequestBody ApiBatchRequest request) {
apiDefinitionService.reduction(request);
}
@GetMapping("/get/{id}")

View File

@ -40,4 +40,7 @@ public class ApiTestBatchRequest extends ApiTestCaseWithBLOBs {
private String protocol;
private String status;
private String envId;
}

View File

@ -58,6 +58,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
ApiModule parentNode = ApiDefinitionImportUtil.getSelectModule(importRequest.getModuleId());
String basePath = swagger.getBasePath();
for (String pathName : pathNames) {
Path path = paths.get(pathName);
Map<HttpMethod, Operation> operationMap = path.getOperationMap();
@ -68,6 +69,10 @@ public class Swagger2Parser extends SwaggerAbstractParser {
ApiDefinitionWithBLOBs apiDefinition = buildApiDefinition(request.getId(), operation, pathName, method.name(),importRequest);
parseParameters(operation, request);
addBodyHeader(request);
if (StringUtils.isNotBlank(basePath)) {
apiDefinition.setPath(basePath + apiDefinition.getPath());
request.setPath(basePath + request.getPath());
}
apiDefinition.setRequest(JSON.toJSONString(request));
apiDefinition.setResponse(JSON.toJSONString(parseResponse(operation, operation.getResponses())));
buildModule(parentNode, apiDefinition, operation.getTags());

View File

@ -17,6 +17,8 @@ import org.apache.jmeter.control.LoopController;
import org.apache.jmeter.control.RunTime;
import org.apache.jmeter.control.WhileController;
import org.apache.jmeter.modifiers.CounterConfig;
import org.apache.jmeter.modifiers.JSR223PreProcessor;
import org.apache.jmeter.protocol.java.sampler.JSR223Sampler;
import org.apache.jmeter.reporters.ResultAction;
import org.apache.jmeter.save.SaveService;
import org.apache.jmeter.testelement.TestElement;
@ -24,6 +26,7 @@ import org.apache.jmeter.timers.ConstantTimer;
import org.apache.jorphan.collections.HashTree;
import java.util.List;
import java.util.UUID;
@Data
@EqualsAndHashCode(callSuper = true)
@ -42,6 +45,9 @@ public class MsLoopController extends MsTestElement {
@JSONField(ordinal = 23)
private MsWhileController whileController;
private String ms_current_timer = UUID.randomUUID().toString();
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
// 非导出操作且不是启用状态则跳过执行
@ -122,7 +128,8 @@ public class MsLoopController extends MsTestElement {
operator = "";
value = "";
}
return "${__jexl3(" + variable + operator + value + ")}";
ms_current_timer = UUID.randomUUID().toString();
return "${__jexl3(" + variable + operator + value + " && \"${" + ms_current_timer + "}\" !=\"stop\")}";
}
private WhileController initWhileController() {
@ -151,6 +158,32 @@ public class MsLoopController extends MsTestElement {
return controller;
}
private String script() {
String script = "\n" +
"import java.util.*;\n" +
"import java.text.SimpleDateFormat;\n" +
"import org.apache.jmeter.threads.JMeterContextService;\n" +
"\n" +
"// 循环控制器超时后结束循环\n" +
"try{\n" +
"\tString ms_current_timer = vars.get(\"" + ms_current_timer + "\");\n" +
"\tlong _nowTime = System.currentTimeMillis(); \n" +
"\tif(ms_current_timer == null ){\n" +
"\t\tvars.put(\"" + ms_current_timer + "\",_nowTime.toString());\n" +
"\t}\n" +
"\tlong time = Long.parseLong(vars.get(\"" + ms_current_timer + "\"));\n" +
"\t if((_nowTime - time) > " + this.whileController.getTimeout() + " ){\n" +
"\t \tvars.put(\"" + ms_current_timer + "\", \"stop\");\n" +
"\t \tlog.info( \"结束循环\");\n" +
"\t }\n" +
"}catch (Exception e){\n" +
"\tlog.info( e.getMessage());\n" +
"\tvars.put(\"" + ms_current_timer + "\", \"stop\");\n" +
"}\n";
return script;
}
private HashTree controller(HashTree tree) {
if (StringUtils.equals(this.loopType, LoopConstants.WHILE.name()) && this.whileController != null) {
RunTime runTime = new RunTime();
@ -162,9 +195,17 @@ public class MsLoopController extends MsTestElement {
timeout = 1;
}
runTime.setRuntime(timeout);
HashTree hashTree = tree.add(initWhileController());
// 添加超时处理防止死循环
HashTree hashTree = tree.add(runTime);
return hashTree.add(initWhileController());
JSR223PreProcessor jsr223PreProcessor = new JSR223PreProcessor();
jsr223PreProcessor.setName("循环超时处理");
jsr223PreProcessor.setProperty(TestElement.TEST_CLASS, JSR223Sampler.class.getName());
jsr223PreProcessor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
jsr223PreProcessor.setProperty("cacheKey", "true");
jsr223PreProcessor.setProperty("scriptLanguage", "beanshell");
jsr223PreProcessor.setProperty("script", script());
hashTree.add(jsr223PreProcessor);
return hashTree;
}
if (StringUtils.equals(this.loopType, LoopConstants.FOREACH.name()) && this.forEachController != null) {
return tree.add(initForeachController());

View File

@ -34,10 +34,10 @@ public class MsExtract extends MsTestElement {
if (!config.isOperating() && !this.isEnable()) {
return;
}
addRequestExtractors(tree);
addRequestExtractors(tree, config);
}
private void addRequestExtractors(HashTree samplerHashTree) {
private void addRequestExtractors(HashTree samplerHashTree, ParameterConfig config) {
StringJoiner extract = new StringJoiner(";");
if (CollectionUtils.isNotEmpty(this.getRegex())) {
@ -55,7 +55,7 @@ public class MsExtract extends MsTestElement {
samplerHashTree.add(jsonPostProcessor(extractJSONPath, extract))
);
}
if (Optional.ofNullable(extract).orElse(extract).length() > 0) {
if (Optional.ofNullable(extract).orElse(extract).length() > 0 && !config.isOperating()) {
JSR223PostProcessor shell = new JSR223PostProcessor();
shell.setEnabled(true);
shell.setName(StringUtils.isEmpty(this.getName()) ? "JSR223PostProcessor" : this.getName());

View File

@ -114,9 +114,13 @@ public class ApiAutomationService {
Map<String, String> map = d.getEnvironmentMap();
if (map != null) {
if (map.isEmpty()) {
List<String> ids = (List<String>) JSONPath.read(definition, "$..projectId");
if (CollectionUtils.isNotEmpty(ids)) {
idList.addAll(new HashSet<>(ids));
try {
List<String> ids = (List<String>) JSONPath.read(definition, "$..projectId");
if (CollectionUtils.isNotEmpty(ids)) {
idList.addAll(new HashSet<>(ids));
}
} catch (Exception e) {
LogUtil.error("JSONPath.read projectId fail.");
}
} else {
Set<String> set = d.getEnvironmentMap().keySet();
@ -316,13 +320,8 @@ public class ApiAutomationService {
}
}
public void reduction(List<SaveApiScenarioRequest> requests) {
List<String> apiIds = new ArrayList<>();
requests.forEach(item -> {
checkNameExist(item);
apiIds.add(item.getId());
});
extApiScenarioMapper.reduction(apiIds);
public void reduction(List<String> ids) {
extApiScenarioMapper.reduction(ids);
}
private void checkNameExist(SaveApiScenarioRequest request) {

View File

@ -137,10 +137,11 @@ public class ApiDefinitionService {
public ApiDefinitionWithBLOBs getBLOBs(String id) {
return apiDefinitionMapper.selectByPrimaryKey(id);
}
public List<ApiDefinitionWithBLOBs> getBLOBs(List<String> idList) {
if(idList == null || idList.isEmpty()){
return new ArrayList<>(0);
}else{
if (idList == null || idList.isEmpty()) {
return new ArrayList<>(0);
} else {
ApiDefinitionExample example = new ApiDefinitionExample();
example.createCriteria().andIdIn(idList);
example.setOrderByClause("create_time DESC ");
@ -190,13 +191,8 @@ public class ApiDefinitionService {
extApiDefinitionMapper.removeToGc(apiIds);
}
public void reduction(List<SaveApiDefinitionRequest> requests) {
List<String> apiIds = new ArrayList<>();
requests.forEach(item -> {
checkNameExist(item);
apiIds.add(item.getId());
});
extApiDefinitionMapper.reduction(apiIds);
public void reduction(ApiBatchRequest request) {
extApiDefinitionMapper.reduction(request.getIds());
}
public void deleteBodyFiles(String apiId) {
@ -244,7 +240,7 @@ public class ApiDefinitionService {
private ApiDefinition updateTest(SaveApiDefinitionRequest request) {
checkNameExist(request);
if(StringUtils.equals(request.getMethod(),"ESB")){
if (StringUtils.equals(request.getMethod(), "ESB")) {
//ESB的接口类型数据采用TCP方式去发送并将方法类型改为TCP 并修改发送数据
request = esbApiParamService.handleEsbRequest(request);
}
@ -273,7 +269,7 @@ public class ApiDefinitionService {
private ApiDefinition createTest(SaveApiDefinitionRequest request) {
checkNameExist(request);
if(StringUtils.equals(request.getMethod(),"ESB")){
if (StringUtils.equals(request.getMethod(), "ESB")) {
//ESB的接口类型数据采用TCP方式去发送并将方法类型改为TCP 并修改发送数据
request = esbApiParamService.handleEsbRequest(request);
}
@ -764,6 +760,7 @@ public class ApiDefinitionService {
calculateResult(resList);
return resList;
}
public List<ApiDefinitionResult> listRelevanceReview(ApiDefinitionRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
List<ApiDefinitionResult> resList = extApiDefinitionMapper.listRelevanceReview(request);
@ -795,7 +792,7 @@ public class ApiDefinitionService {
res.setCaseStatus("-");
}
if(StringUtils.equals("ESB",res.getMethod())){
if (StringUtils.equals("ESB", res.getMethod())) {
esbApiParamService.handleApiEsbParams(res);
}
}
@ -882,8 +879,7 @@ public class ApiDefinitionService {
((MsApiExportResult) apiExportResult).setProtocol(request.getProtocol());
((MsApiExportResult) apiExportResult).setProjectId(request.getProjectId());
((MsApiExportResult) apiExportResult).setVersion(System.getenv("MS_VERSION"));
}
else { // 导出为 Swagger 格式
} else { // 导出为 Swagger 格式
Swagger3Parser swagger3Parser = new Swagger3Parser();
System.out.println(apiDefinitionMapper.selectByExampleWithBLOBs(example));
apiExportResult = swagger3Parser.swagger3Export(apiDefinitionMapper.selectByExampleWithBLOBs(example));

View File

@ -50,7 +50,7 @@ public class ApiTestCaseService {
@Resource
TestPlanMapper testPlanMapper;
@Resource
TestCaseReviewMapper testCaseReviewMapper;
TestCaseReviewMapper testCaseReviewMapper;
@Resource
private ApiTestCaseMapper apiTestCaseMapper;
@Resource
@ -82,12 +82,12 @@ public class ApiTestCaseService {
public List<ApiTestCaseResult> list(ApiTestCaseRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
List<ApiTestCaseResult> returnList = extApiTestCaseMapper.list(request);
List<ApiTestCaseResult> returnList = extApiTestCaseMapper.list(request);
for (ApiTestCaseResult res : returnList) {
esbApiParamService.handleApiEsbParams(res);
}
return returnList;
return returnList;
}
public List<ApiTestCaseDTO> listSimple(ApiTestCaseRequest request) {
@ -230,7 +230,7 @@ public class ApiTestCaseService {
private ApiTestCase updateTest(SaveApiTestCaseRequest request) {
checkNameExist(request);
if(StringUtils.isNotEmpty(request.getEsbDataStruct())){
if (StringUtils.isNotEmpty(request.getEsbDataStruct())) {
request = esbApiParamService.handleEsbRequest(request);
}
@ -253,7 +253,7 @@ public class ApiTestCaseService {
request.setId(UUID.randomUUID().toString());
checkNameExist(request);
if(StringUtils.isNotEmpty(request.getEsbDataStruct())||StringUtils.isNotEmpty(request.getBackEsbDataStruct())){
if (StringUtils.isNotEmpty(request.getEsbDataStruct()) || StringUtils.isNotEmpty(request.getBackEsbDataStruct())) {
request = esbApiParamService.handleEsbRequest(request);
}
@ -332,7 +332,8 @@ public class ApiTestCaseService {
List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(example);
relevance(apiTestCases, request);
}
public void relevanceByApiByReview(ApiCaseRelevanceRequest request){
public void relevanceByApiByReview(ApiCaseRelevanceRequest request) {
List<String> ids = request.getSelectIds();
if (CollectionUtils.isEmpty(ids)) {
return;
@ -342,6 +343,7 @@ public class ApiTestCaseService {
List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(example);
relevanceByReview(apiTestCases, request);
}
public void relevanceByCase(ApiCaseRelevanceRequest request) {
List<String> ids = request.getSelectIds();
if (CollectionUtils.isEmpty(ids)) {
@ -391,7 +393,7 @@ public class ApiTestCaseService {
TestCaseReviewApiCase.setUpdateTime(System.currentTimeMillis());
batchMapper.insertIfNotExists(TestCaseReviewApiCase);
});
TestCaseReview testCaseReview=testCaseReviewMapper.selectByPrimaryKey(request.getReviewId());
TestCaseReview testCaseReview = testCaseReviewMapper.selectByPrimaryKey(request.getReviewId());
if (StringUtils.equals(testCaseReview.getStatus(), TestPlanStatus.Prepare.name())
|| StringUtils.equals(testCaseReview.getStatus(), TestPlanStatus.Completed.name())) {
testCaseReview.setStatus(TestPlanStatus.Underway.name());
@ -399,11 +401,13 @@ public class ApiTestCaseService {
}
sqlSession.flushStatements();
}
public List<String> selectIdsNotExistsInPlan(String projectId, String planId) {
return extApiTestCaseMapper.selectIdsNotExistsInPlan(projectId, planId);
}
public List<String> selectIdsNotExistsInReview(String projectId,String reviewId){
return extApiTestCaseMapper.selectIdsNotExistsInReview(projectId,reviewId);
public List<String> selectIdsNotExistsInReview(String projectId, String reviewId) {
return extApiTestCaseMapper.selectIdsNotExistsInReview(projectId, reviewId);
}
public List<ApiDataCountResult> countProtocolByProjectID(String projectId) {
@ -497,7 +501,22 @@ public class ApiTestCaseService {
sqlSession.flushStatements();
}
if (StringUtils.isNotEmpty(request.getEnvId())) {
List<ApiTestCaseWithBLOBs> bloBs = apiTestCaseMapper.selectByExampleWithBLOBs(apiDefinitionExample);
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
ApiTestCaseMapper batchMapper = sqlSession.getMapper(ApiTestCaseMapper.class);
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
bloBs.forEach(apiTestCase -> {
JSONObject req = JSON.parseObject(apiTestCase.getRequest());
req.put("useEnvironment", request.getEnvId());
String requestStr = JSON.toJSONString(req);
apiTestCase.setRequest(requestStr);
batchMapper.updateByPrimaryKeySelective(apiTestCase);
});
sqlSession.flushStatements();
}
}
private List<String> getAllApiCaseIdsByFontedSelect(Map<String, List<String>> filters, List<String> moduleIds, String name, String projectId, String protocol, List<String> unSelectIds, String status) {

View File

@ -306,9 +306,12 @@
or test_case.num like CONCAT('%', #{request.name},'%')
or test_case.tags like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.createTime >0">
<if test="request.relevanceCreateTime >0">
and test_case.id in (select test_case_id from test_case_test where test_case_test.create_time >= #{request.createTime})
</if>
<if test="request.createTime >0">
and test_case.create_time >= #{request.createTime}
</if>
<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=")">

View File

@ -137,7 +137,7 @@
<select id="list" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select test_plan_test_case.id as id, test_case.id as caseId, test_case.name, test_case.priority,
test_case.type,test_case.test_id as testId,test_case.node_id, test_case.tags,
test_case.type,test_case.test_id as testId,test_case.node_id, test_case.tags, test_case.maintainer,
test_case.node_path, test_case.method, test_case.num, test_plan_test_case.executor, test_plan_test_case.status,
test_plan_test_case.update_time, test_case_node.name as model, project.name as projectName,
test_plan_test_case.plan_id as planId
@ -200,6 +200,12 @@
#{value}
</foreach>
</when>
<when test="key=='maintainer'">
and test_case.maintainer in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='executor'">
and test_plan_test_case.executor in
<foreach collection="values" item="value" separator="," open="(" close=")">

View File

@ -52,6 +52,7 @@ public class ShiroUtils {
filterChainDefinitionMap.put("/", "apikey, authc"); // 跳转到 / 不用校验 csrf
filterChainDefinitionMap.put("/language", "apikey, authc");// 跳转到 /language 不用校验 csrf
filterChainDefinitionMap.put("/document", "apikey, authc"); // 跳转到 /document 不用校验 csrf
filterChainDefinitionMap.put("/test/case/file/preview/**", "apikey, authc"); // 预览测试用例附件 不用校验 csrf
}
public static Cookie getSessionIdCookie(){

View File

@ -7,7 +7,6 @@ import io.metersphere.commons.utils.SessionUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.ExpiredCredentialsException;
import org.apache.shiro.web.filter.authc.AnonymousFilter;
import org.apache.shiro.web.util.WebUtils;
import org.springframework.core.env.Environment;
@ -75,18 +74,6 @@ public class CsrfFilter extends AnonymousFilter {
if (signatureArray.length != 3) {
throw new RuntimeException("invalid token");
}
long signatureTime;
try {
signatureTime = Long.parseLong(signatureArray[2]);
} catch (Exception e) {
throw new RuntimeException(e);
}
Environment env = CommonBeanFactory.getBean(Environment.class);
long timeout = env.getProperty("session.timeout", Long.class, 43200L);
if (Math.abs(System.currentTimeMillis() - signatureTime) > timeout * 1000) {
throw new ExpiredCredentialsException("expired token");
}
if (!StringUtils.equals(SessionUtils.getUserId(), signatureArray[0])) {
throw new RuntimeException("Please check csrf token.");
}

View File

@ -74,6 +74,7 @@ public class TestResourcePoolService {
if (StringUtils.isNotBlank(testResourcePoolDTO.getId())) {
criteria.andIdNotEqualTo(testResourcePoolDTO.getId());
}
criteria.andStatusNotEqualTo(DELETE.name());
if (testResourcePoolMapper.countByExample(example) > 0) {
MSException.throwException(Translator.get("test_resource_pool_name_already_exists"));

View File

@ -23,7 +23,8 @@ public class ReportFailureAdvanceResultComponent extends ReportComponent {
@Override
public void readRecord(TestPlanCaseDTO testCase) {
if (StringUtils.equals(testCase.getStatus(), TestPlanTestCaseStatus.Failure.name())) {
if (StringUtils.equals(testCase.getStatus(), TestPlanTestCaseStatus.Failure.name()) ||
StringUtils.equals(testCase.getStatus(), TestPlanTestCaseStatus.Blocking.name())) {
this.functionalTestCases.add(testCase);
}
}

View File

@ -4,6 +4,8 @@ import io.metersphere.base.domain.TestCaseWithBLOBs;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class TestReviewCaseDTO extends TestCaseWithBLOBs {
@ -16,4 +18,5 @@ public class TestReviewCaseDTO extends TestCaseWithBLOBs {
private String issues;
private String model;
private String projectName;
private List<TestCaseTestDTO> list;
}

View File

@ -24,8 +24,10 @@ public class QueryTestCaseRequest extends BaseQueryRequest {
private String reviewId;
private boolean isSelectThisWeedData = false;
private boolean isSelectThisWeedRelevanceData = false;
private String caseCoverage;
private long createTime = 0;
private long relevanceCreateTime = 0;
}

View File

@ -10,5 +10,6 @@ import java.util.List;
@Setter
public class TestCaseMinderEditRequest {
private String projectId;
private List<String> ids;
List<TestCaseWithBLOBs> data;
}

View File

@ -6,7 +6,7 @@ public class TrackCount {
public static final String P2 = "P2";
public static final String P3 = "P3";
public static final String API = "api";
public static final String TESTCASE = "testcase";
public static final String PERFORMANCE = "performance";
public static final String AUTOMATION = "automation";
}

View File

@ -145,7 +145,7 @@ public class TrackStatisticsDTO {
public void countRelevance(List<TrackCountResult> relevanceResults) {
for (TrackCountResult countResult : relevanceResults) {
switch (countResult.getGroupField()){
case TrackCount.API:
case TrackCount.TESTCASE:
this.apiCaseCount += countResult.getCountNumber();
this.allRelevanceCaseCount += countResult.getCountNumber();
break;

View File

@ -210,13 +210,19 @@ public class TestCaseService {
*/
private void initRequest(QueryTestCaseRequest request, boolean checkThisWeekData) {
if (checkThisWeekData) {
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
if (request.isSelectThisWeedData()) {
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
if (weekFirstTime != null) {
request.setCreateTime(weekFirstTime.getTime());
}
}
if (request.isSelectThisWeedRelevanceData()) {
if (weekFirstTime != null) {
request.setRelevanceCreateTime(weekFirstTime.getTime());
}
}
}
}
@ -780,6 +786,12 @@ public class TestCaseService {
editTestCase(item);
}
});
List<String> ids = request.getIds();
if (CollectionUtils.isNotEmpty(ids)) {
TestCaseBatchRequest deleteRequest = new TestCaseBatchRequest();
deleteRequest.setIds(ids);
deleteTestCaseBath(deleteRequest);
}
}
public List<TestCase> getTestCaseByProjectId(String projectId) {

View File

@ -206,7 +206,7 @@ public class TestPlanService {
}
else { // 有修改字段的调用为保证将某些时间置null的情况使用updateByPrimaryKey
extScheduleMapper.updateNameByResourceID(testPlan.getId(), testPlan.getName());// 同步更新该测试的定时任务的name
i = testPlanMapper.updateByPrimaryKey(testPlan); // 更新
i = testPlanMapper.updateByPrimaryKeyWithBLOBs(testPlan); // 更新
}
if (!StringUtils.isBlank(testPlan.getStatus())) {
BeanUtils.copyBean(testPlans, getTestPlan(testPlan.getId()));

View File

@ -1,16 +1,16 @@
package io.metersphere.track.service;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.TestCaseMapper;
import io.metersphere.base.mapper.TestCaseReviewMapper;
import io.metersphere.base.mapper.TestCaseReviewTestCaseMapper;
import io.metersphere.base.mapper.TestCaseReviewUsersMapper;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestReviewCaseMapper;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.service.UserService;
import io.metersphere.track.dto.TestCaseTestDTO;
import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.dto.TestReviewCaseDTO;
import io.metersphere.track.request.testplancase.TestReviewCaseBatchRequest;
import io.metersphere.track.request.testreview.DeleteRelevanceRequest;
@ -29,7 +29,14 @@ import java.util.stream.Collectors;
@Service
@Transactional(rollbackFor = Exception.class)
public class TestReviewTestCaseService {
@Resource
private TestCaseTestMapper testCaseTestMapper;
@Resource
private LoadTestMapper loadTestMapper;
@Resource
private ApiTestCaseMapper apiTestCaseMapper;
@Resource
private ApiScenarioMapper apiScenarioMapper;
@Resource
ExtTestReviewCaseMapper extTestReviewCaseMapper;
@Resource
@ -44,6 +51,8 @@ public class TestReviewTestCaseService {
TestCaseReviewService testCaseReviewService;
@Resource
TestCaseMapper testCaseMapper;
@Resource
ExtTestPlanTestCaseMapper extTestPlanTestCaseMapper;
public List<TestReviewCaseDTO> list(QueryCaseReviewRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
@ -128,7 +137,40 @@ public class TestReviewTestCaseService {
}
public TestReviewCaseDTO get(String reviewId) {
return extTestReviewCaseMapper.get(reviewId);
TestReviewCaseDTO testReviewCaseDTO=extTestReviewCaseMapper.get(reviewId);
List<TestCaseTestDTO> testCaseTestDTOS = extTestPlanTestCaseMapper.listTestCaseTest(testReviewCaseDTO.getCaseId());
testCaseTestDTOS.forEach(dto -> {
setTestName(dto);
});
testReviewCaseDTO.setList(testCaseTestDTOS);
return testReviewCaseDTO;
}
private void setTestName(TestCaseTestDTO dto) {
String type = dto.getTestType();
String id = dto.getTestId();
switch (type) {
case "performance":
LoadTest loadTest = loadTestMapper.selectByPrimaryKey(id);
if (loadTest != null) {
dto.setTestName(loadTest.getName());
}
break;
case "testcase":
ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = apiTestCaseMapper.selectByPrimaryKey(id);
if (apiTestCaseWithBLOBs != null) {
dto.setTestName(apiTestCaseWithBLOBs.getName());
}
break;
case "automation":
ApiScenarioWithBLOBs apiScenarioWithBLOBs = apiScenarioMapper.selectByPrimaryKey(id);
if (apiScenarioWithBLOBs != null) {
dto.setTestName(apiScenarioWithBLOBs.getName());
}
break;
default:
break;
}
}
public void editTestCaseBatchStatus(TestReviewCaseBatchRequest request) {

View File

@ -49,7 +49,7 @@
"xml-js": "^1.6.11",
"yan-progress": "^1.0.3",
"jsonpath": "^1.1.0",
"vue-minder-editor-plus": "^1.0.18",
"vue-minder-editor-plus": "^1.0.19",
"jsencrypt": "^3.1.0"
},
"devDependencies": {

View File

@ -24,7 +24,7 @@
<el-table-column v-if="!referenced" width="30" min-width="30" :resizable="false" align="center">
<template v-slot:default="scope">
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts" v-tester/>
<show-more-btn :is-show="scope.row.showMore" :buttons="trashEnable ? trashButtons: buttons" :size="selectDataCounts" v-tester/>
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
@ -69,7 +69,7 @@
<el-table-column v-if="item.id == 'tags'" prop="tags" min-width="120px"
:label="$t('api_test.automation.tag')" :key="index">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" :show-tooltip="true" tooltip style="margin-left: 5px"/>
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" :show-tooltip="true" tooltip style="margin-left: 0px; margin-right: 2px"/>
</template>
</el-table-column>
<el-table-column v-if="item.id == 'userId'" prop="userId" min-width="120px"
@ -244,7 +244,7 @@
return {
type: API_SCENARIO_LIST,
headerItems: Api_Scenario_List,
tableLabel: [],
tableLabel: Api_Scenario_List,
loading: false,
screenHeight: document.documentElement.clientHeight - 280,//,
condition: {
@ -286,6 +286,12 @@
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
],
trashButtons: [
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
{
name: "批量恢复", handleClick: this.handleBatchRestore
},
],
isSelectAllDate: false,
selectRows: new Set(),
selectDataCounts: 0,
@ -419,6 +425,9 @@
});
this.loading = false;
this.unSelection = data.listObject.map(s => s.id);
if (this.$refs.scenarioTable) {
this.$refs.scenarioTable.doLayout()
}
});
}
getLabel(this, API_SCENARIO_LIST);
@ -589,10 +598,14 @@
this.$emit('edit', data);
},
reductionApi(row) {
row.scenarioDefinition = null;
row.tags = null;
let rows = [row];
this.$post("/api/automation/reduction", rows, response => {
this.$post("/api/automation/reduction", [row.id], response => {
this.$success(this.$t('commons.save_success'));
this.search();
})
},
handleBatchRestore() {
let ids = Array.from(this.selectRows).map(row => row.id);
this.$post("/api/automation/reduction", ids, response => {
this.$success(this.$t('commons.save_success'));
this.search();
})

View File

@ -135,7 +135,6 @@
}
//
this.getApiInfo();
console.log(JSON.stringify(this.request));
if (this.request.protocol === 'HTTP') {
this.setUrl(this.request.url);
this.setUrl(this.request.path);

View File

@ -23,7 +23,7 @@
<el-button :disabled="scenarioDefinition.length < 1" size="mini" type="primary" v-prevent-re-click @click="runDebug">{{$t('api_test.request.debug')}}</el-button>
<font-awesome-icon class="alt-ico" :icon="['fa', 'compress-alt']" size="lg" @click="unFullScreen"/>
<font-awesome-icon class="ms-alt-ico" :icon="['fa', 'compress-alt']" size="lg" @click="unFullScreen"/>
<i class="el-icon-close alt-ico-close" @click="close"/>
</div>
@ -124,14 +124,12 @@
.ms-header-right {
float: right;
width: 420px;
margin-top: 2px;
position: fixed;
right: 20px;
z-index: 1;
}
.alt-ico {
.ms-alt-ico {
font-size: 16px;
margin: 10px 10px 0px;
}
@ -146,7 +144,7 @@
cursor: pointer;
}
.alt-ico:hover {
.ms-alt-ico:hover {
color: black;
cursor: pointer;
}

View File

@ -140,7 +140,7 @@ import MsRunTestHttpPage from "./components/runtest/RunTestHTTPPage";
import MsRunTestTcpPage from "./components/runtest/RunTestTCPPage";
import MsRunTestSqlPage from "./components/runtest/RunTestSQLPage";
import MsRunTestDubboPage from "./components/runtest/RunTestDubboPage";
import {checkoutTestManagerOrTestUser, getCurrentProjectID, getCurrentUser, getUUID} from "@/common/js/utils";
import {checkoutTestManagerOrTestUser, getCurrentUser, getUUID} from "@/common/js/utils";
import MsApiModule from "./components/module/ApiModule";
import ApiCaseSimpleList from "./components/list/ApiCaseSimpleList";
@ -159,7 +159,10 @@ import MsTabButton from "@/business/components/common/components/MsTabButton";
},
isReadOnly(){
return !checkoutTestManagerOrTestUser();
}
},
projectId() {
return this.$store.state.projectId
},
},
components: {
MsTabButton,
@ -211,13 +214,9 @@ import MsTabButton from "@/business/components/common/components/MsTabButton";
}],
activeDom: "left",
syncTabs: [],
projectId: "",
nodeTree: []
}
},
mounted() {
this.projectId = getCurrentProjectID();
},
watch: {
currentProtocol() {
this.handleCommand("CLOSE_ALL");

View File

@ -59,7 +59,7 @@
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
import {WORKSPACE_ID} from '../../../../../../common/js/constants';
import {REQ_METHOD} from "../../model/JsonData";
import {getCurrentProjectID, getCurrentUser} from "../../../../../../common/js/utils";
import {getCurrentUser} from "../../../../../../common/js/utils";
import {createComponent, Request} from "../jmeter/components";
export default {
@ -94,8 +94,12 @@
value: REQ_METHOD[0].id,
options: REQ_METHOD,
}
}
,
},
computed: {
projectId() {
return this.$store.state.projectId
},
},
methods: {
saveApi(saveAs) {
this.$refs['httpForm'].validate((valid) => {
@ -137,7 +141,7 @@
break;
}
this.httpForm.bodyUploadIds = [];
this.httpForm.projectId = getCurrentProjectID();
this.httpForm.projectId = this.projectId;
this.httpForm.id = this.httpForm.request.id;
this.httpForm.protocol = this.currentProtocol;

View File

@ -36,7 +36,6 @@
<script>
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
import {parseEnvironment} from "@/business/components/api/test/model/EnvironmentModel";
import {getUUID, getCurrentProjectID} from "@/common/js/utils";
export default {
name: "MsSetEnvironment",
@ -64,6 +63,11 @@ export default {
this.environmentChange(this.environmentId);
},
},
computed: {
projectId() {
return this.$store.state.projectId
},
},
methods: {
environmentChange(value) {
for (let i in this.environments) {
@ -74,7 +78,7 @@ export default {
}
},
getEnvironments() {
let selectProjectId = getCurrentProjectID();
let selectProjectId = this.projectId;
if (selectProjectId) {
this.$get('/api/environment/list/' + selectProjectId, response => {
this.environments = response.data;

View File

@ -230,7 +230,8 @@
}
data.message = true;
data.request.useEnvironment = this.environment;
this.saveTestCase(data);
//this.saveTestCase(data);
this.$emit('singleRun', data);
},
copyCase(data) {

View File

@ -50,7 +50,7 @@
import ApiCaseHeader from "./ApiCaseHeader";
import ApiCaseItem from "./ApiCaseItem";
import MsRun from "../Run";
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
import {getUUID} from "@/common/js/utils";
import MsDrawer from "../../../../common/components/MsDrawer";
import {CASE_ORDER} from "../../model/JsonData";
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
@ -89,7 +89,6 @@
runData: [],
selectdCases: [],
reportId: "",
projectId: "",
testCaseId: "",
checkedCases: new Set(),
visible: false,
@ -128,7 +127,6 @@
},
created() {
this.api = this.currentApi;
this.projectId = getCurrentProjectID();
if (this.createCase) {
this.sysAddition();
}
@ -136,7 +134,10 @@
computed: {
isCaseEdit() {
return this.testCaseId ? true : false;
}
},
projectId() {
return this.$store.state.projectId
},
},
methods: {
open(api, testCaseId) {
@ -181,7 +182,7 @@
this.visible = false;
},
runRefresh(data) {
runRefresh() {
this.batchLoadingIds = [];
this.singleLoading = false;
this.singleRunId = "";
@ -192,12 +193,9 @@
this.$set(item, 'selected', false);
})
}
//
let cases = this.apiCaseList[0];
cases.request.useEnvironment = this.environment;
cases.message = true;
this.$refs.apiCaseItem[0].saveCase(cases);
this.refresh();
//
let obj = {envId: this.environment, show: true};
this.batchEdit(obj);
this.$success(this.$t('organization.integration.successful_operation'));
},
@ -222,7 +220,7 @@
}
this.result = this.$post("/api/testcase/list", this.condition, response => {
if(response.data){
if (response.data) {
this.apiCaseList = response.data;
}
this.apiCaseList.forEach(apiCase => {
@ -260,7 +258,7 @@
if (!request.hashTree) {
request.hashTree = [];
}
if(request.backScript != null){
if (request.backScript != null) {
request.hashTree.push(request.backScript);
}
let uuid = getUUID();
@ -286,18 +284,17 @@
this.$warning(this.$t('api_test.environment.select_environment'));
return;
}
this.selectdCases = [];
this.selectdCases.push(row.id);
this.runData = [];
this.singleLoading = true;
this.singleRunId = row.id;
row.request.name = row.id;
this.$get('/api/definition/get/' + row.request.id, response => {
row.request.path = response.data.path; // pathpath
row.request.useEnvironment = this.environment;
row.request.projectId = getCurrentProjectID();
this.runData.push(row.request);
/*触发执行操作*/
this.reportId = getUUID().substring(0, 8);
});
row.request.useEnvironment = this.environment;
row.request.projectId = this.projectId;
this.runData.push(row.request);
/*触发执行操作*/
this.reportId = getUUID().substring(0, 8);
},
batchRun() {
@ -307,6 +304,7 @@
}
this.runData = [];
this.batchLoadingIds = [];
this.selectdCases = [];
if (this.apiCaseList.length > 0) {
this.apiCaseList.forEach(item => {
if (item.selected && item.id) {
@ -314,6 +312,7 @@
item.request.useEnvironment = this.environment;
this.runData.push(item.request);
this.batchLoadingIds.push(item.id);
this.selectdCases.push(item.id);
}
})
if (this.runData.length > 0) {
@ -353,17 +352,22 @@
},
batchEdit(form) {
let param = {};
param[form.type] = form.value;
param.ids = this.selectdCases;
param.projectId = getCurrentProjectID();
if (this.api) {
param.protocol = this.api.protocol;
if (form) {
param[form.type] = form.value;
param.ids = this.selectdCases;
param.projectId = this.projectId;
param.envId = form.envId;
if (this.api) {
param.protocol = this.api.protocol;
}
param.selectAllDate = this.isSelectAllDate;
param.unSelectIds = this.unSelection;
param = Object.assign(param, this.condition);
}
param.selectAllDate = this.isSelectAllDate;
param.unSelectIds = this.unSelection;
param = Object.assign(param, this.condition);
this.$post('/api/testcase/batch/editByParam', param, () => {
this.$success(this.$t('commons.save_success'));
if (!form.show) {
this.$success(this.$t('commons.save_success'));
}
this.selectdCases = [];
this.getApiTest();
});

View File

@ -100,7 +100,6 @@
<script>
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
import {getCurrentProjectID} from "../../../../../../common/js/utils";
import ScheduleImport from "@/business/components/api/definition/components/import/ImportScheduleEdit";
export default {
@ -232,7 +231,10 @@ export default {
},
isScenarioModel() {
return this.model === 'scenario';
}
},
projectId() {
return this.$store.state.projectId
},
},
methods: {
scheduleEdit() {
@ -318,7 +320,7 @@ export default {
})
param.modeId = this.formData.modeId
}
param.projectId = getCurrentProjectID();
param.projectId = this.projectId;
if (!this.swaggerUrlEnable) {
param.swaggerUrl = undefined;
}

View File

@ -71,7 +71,7 @@
<el-table-column v-if="item.id=='tags'" prop="tags" min-width="120px" :label="$t('commons.tag')"
:key="index">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" style="margin-left: 5px"/>
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" style="margin-left: 0px; margin-right: 2px"/>
</template>
</el-table-column>
@ -143,7 +143,7 @@ import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../basis/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
import {getBodyUploadFiles, getCurrentProjectID, getCurrentUser} from "@/common/js/utils";
import {getBodyUploadFiles} from "@/common/js/utils";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import MsApiCaseTableExtendBtns from "../reference/ApiCaseTableExtendBtns";
import MsReferenceView from "../reference/ReferenceView";
@ -186,7 +186,7 @@ export default {
return {
type: API_CASE_LIST,
headerItems: Api_Case_List,
tableLabel: [],
tableLabel: Api_Case_List,
condition: {
components: API_CASE_CONFIGS
},
@ -260,6 +260,10 @@ export default {
},
created: function () {
this.initTable();
this.$nextTick(() => {
this.$refs.caseTable.bodyWrapper.scrollTop = 5
})
},
watch: {
selectNodeIds() {
@ -277,31 +281,33 @@ export default {
this.initTable();
}
},
computed: {
//
isApiModel() {
return this.model === 'api'
},
computed: {
//
isApiModel() {
return this.model === 'api'
},
methods: {
customHeader() {
getLabel(this, API_CASE_LIST);
this.$refs.headerCustom.open(this.tableLabel)
},
initTable() {
projectId() {
return this.$store.state.projectId
},
},
methods: {
customHeader() {
getLabel(this, API_CASE_LIST);
this.$refs.headerCustom.open(this.tableLabel)
},
initTable() {
this.selectRows = new Set();
this.condition.status = "";
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
this.selectRows = new Set();
this.condition.status = "";
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
this.condition.status = "Trash";
this.condition.moduleIds = [];
}
this.selectAll = false;
this.unSelection = [];
this.selectDataCounts = 0;
this.condition.projectId = getCurrentProjectID();
this.condition.projectId = this.projectId;
if (this.currentProtocol != null) {
this.condition.protocol = this.currentProtocol;
@ -331,9 +337,13 @@ export default {
item.tags = JSON.parse(item.tags);
}
})
if (this.$refs.caseTable) {
this.$refs.caseTable.doLayout()
}
});
}
getLabel(this, API_CASE_LIST);
},
open() {
this.$refs.searchBar.open();
@ -401,7 +411,7 @@ export default {
callback: (action) => {
if (action === 'confirm') {
let obj = {};
obj.projectId = getCurrentProjectID();
obj.projectId = this.projectId;
obj.selectAllDate = this.isSelectAllDate;
obj.unSelectIds = this.unSelection;
obj.ids = Array.from(this.selectRows).map(row => row.id);
@ -448,7 +458,7 @@ export default {
let param = {};
param[form.type] = form.value;
param.ids = ids;
param.projectId = getCurrentProjectID();
param.projectId = this.projectId;
param.selectAllDate = this.isSelectAllDate;
param.unSelectIds = this.unSelection;
param = Object.assign(param, this.condition);
@ -520,7 +530,7 @@ export default {
},
showEnvironment(row) {
let projectID = getCurrentProjectID();
let projectID = this.projectId;
if (this.projectId) {
this.$get('/api/environment/list/' + this.projectId, response => {
this.environments = response.data;
@ -572,7 +582,7 @@ export default {
id: row.id,
testElement: testPlan,
name: row.name,
projectId: getCurrentProjectID(),
projectId: this.projectId,
};
let bodyFiles = getBodyUploadFiles(reqObj, runData);
reqObj.reportId = "run";
@ -636,4 +646,7 @@ export default {
top: -2px;
}
/deep/ .el-table__fixed {
height: 100% !important;
}
</style>

View File

@ -28,7 +28,7 @@
<el-table-column width="30" :resizable="false" align="center">
<template v-slot:default="scope">
<!-- 选中记录后浮现的按钮提供对记录的批量操作 -->
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts" v-tester/>
<show-more-btn :is-show="scope.row.showMore" :buttons="trashEnable ? trashButtons : buttons" :size="selectDataCounts" v-tester/>
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
@ -116,7 +116,7 @@
min-width="120px"
:key="index">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :show-tooltip="true" :content="itemName" style="margin-left: 5px"/>
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :show-tooltip="true" :content="itemName" style="margin-left: 0px; margin-right: 2px"/>
</template>
</el-table-column>
@ -225,7 +225,6 @@
import {API_METHOD_COLOUR, API_STATUS, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
import {checkoutTestManagerOrTestUser, downloadFile, getUUID} from "@/common/js/utils";
import {PROJECT_NAME} from '@/common/js/constants';
import {getCurrentProjectID, getCurrentUser} from "@/common/js/utils";
import {API_LIST, TEST_CASE_LIST, WORKSPACE_ID} from '@/common/js/constants';
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
import ApiStatus from "@/business/components/api/definition/components/list/ApiStatus";
@ -272,7 +271,7 @@
return {
type: API_LIST,
headerItems: Api_List,
tableLabel: [],
tableLabel: Api_List,
condition: {
components: API_DEFINITION_CONFIGS
},
@ -289,6 +288,12 @@
name: this.$t('api_test.definition.request.batch_move'), handleClick: this.handleBatchMove
}
],
trashButtons: [
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
{
name: "批量恢复", handleClick: this.handleBatchRestore
},
],
typeArr: [
{id: 'status', name: this.$t('api_test.definition.api_status')},
{id: 'method', name: this.$t('api_test.definition.api_type')},
@ -364,6 +369,11 @@
},
}
},
computed: {
projectId() {
return this.$store.state.projectId
},
},
created: function () {
if (this.trashEnable) {
this.condition.filters = {status: ["Trash"]};
@ -403,7 +413,7 @@
initCondition(this.condition);
this.selectDataCounts = 0;
this.condition.moduleIds = this.selectNodeIds;
this.condition.projectId = getCurrentProjectID();
this.condition.projectId = this.projectId;
if (this.currentProtocol != null) {
this.condition.protocol = this.currentProtocol;
}
@ -442,6 +452,10 @@
item.tags = JSON.parse(item.tags);
}
})
if (this.$refs.apiDefinitionTable) {
this.$refs.apiDefinitionTable.doLayout()
}
});
}
getLabel(this, API_LIST);
@ -560,17 +574,18 @@
},
reductionApi(row) {
let tmp = JSON.parse(JSON.stringify(row));
tmp.request = null;
tmp.response = null;
if (tmp.tags instanceof Array) {
tmp.tags = JSON.stringify(tmp.tags);
}
let rows = [tmp];
let rows = {ids: [tmp.id]};
this.$post('/api/definition/reduction/', rows, () => {
this.$success(this.$t('commons.save_success'));
this.search();
});
},
handleBatchRestore() {
this.$post('/api/definition/reduction/', buildBatchParam(this), () => {
this.$success(this.$t('commons.save_success'));
this.search();
});
},
handleDeleteBatch() {
if (this.trashEnable) {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "", '', {
@ -625,7 +640,7 @@
let arr = Array.from(this.selectRows);
let ids = arr.map(row => row.id);
param.ids = ids;
param.projectId = getCurrentProjectID();
param.projectId = this.projectId;
param.moduleId = param.nodeId;
param.condition = this.condition;
param.selectAllDate = this.isSelectAllDate;

View File

@ -38,7 +38,6 @@ import MsAddBasisApi from "../basis/AddBasisApi";
import SelectMenu from "../../../../track/common/SelectMenu";
import {OPTIONS} from "../../model/JsonData";
import ApiImport from "../import/ApiImport";
import {getCurrentProjectID} from "@/common/js/utils";
import MsNodeTree from "../../../../track/common/NodeTree";
import ApiModuleHeader from "./ApiModuleHeader";
import {buildNodePath} from "../../model/NodeTree";
@ -60,7 +59,6 @@ export default {
filterText: "",
trashEnable: false
},
projectId: "",
data: [],
currentModule: {},
}
@ -85,10 +83,12 @@ export default {
},
isReviewModel() {
return this.reviewId ? true : false;
}
},
projectId() {
return this.$store.state.projectId
},
},
mounted() {
this.projectId = getCurrentProjectID();
this.$emit('protocolChange', this.condition.protocol);
this.list();
},

View File

@ -58,7 +58,6 @@ import {OPTIONS} from "../../model/JsonData";
import MsAddBasisApi from "../basis/AddBasisApi";
import ApiImport from "../import/ApiImport";
import ModuleTrashButton from "./ModuleTrashButton";
import {getCurrentProjectID} from "../../../../../../common/js/utils";
import {buildNodePath} from "@/business/components/api/definition/model/NodeTree";
import TemplateComponent from "../../../../track/plan/view/comonents/report/TemplateComponent/TemplateComponent";
@ -91,6 +90,11 @@ export default {
}
},
},
computed: {
projectId() {
return this.$store.state.projectId
},
},
methods: {
handleCommand(e) {
@ -104,12 +108,12 @@ export default {
case "add-module":
break;
case "import":
if (!getCurrentProjectID()) {
if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
// this.protocol = "HTTP";
this.result = this.$get("/api/module/list/" + getCurrentProjectID() + "/" + this.condition.protocol, response => {
this.protocol = "HTTP";
this.result = this.$get("/api/module/list/" + this.projectId + "/" + this.condition.protocol, response => {
if (response.data != undefined && response.data != null) {
this.data = response.data;
let moduleOptions = [];
@ -124,7 +128,7 @@ export default {
}
},
chooseExportType(e) {
if (!getCurrentProjectID()) {
if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
@ -138,7 +142,7 @@ export default {
}
},
addApi() {
if (!getCurrentProjectID()) {
if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}

View File

@ -5,26 +5,26 @@
<el-col :span="14">
<el-menu class="header-menu" :unique-opened="true" mode="horizontal" router :default-active='$route.path'>
<el-menu-item v-show="$store.state.switch.value=='new'" :index="'/api/home'">
<el-menu-item v-show="isNewVersion" :index="'/api/home'">
{{ $t("i18n.home") }}
</el-menu-item>
<el-menu-item v-show="$store.state.switch.value=='old'" :index="'/api/home_obsolete'">
<el-menu-item v-show="isOldVersion" :index="'/api/home_obsolete'">
{{ $t("i18n.home") }}
</el-menu-item>
<el-menu-item v-show="$store.state.switch.value=='new'" :index="'/api/definition'">
<el-menu-item v-show="isNewVersion" :index="'/api/definition'">
{{ $t("i18n.definition") }}
</el-menu-item>
<el-menu-item v-show="$store.state.switch.value=='new'" :index="'/api/automation'">
<el-menu-item v-show="isNewVersion" :index="'/api/automation'">
{{ $t("i18n.automation") }}
</el-menu-item>
<el-menu-item v-show="$store.state.switch.value=='new'" :index="'/api/automation/report'">
<el-menu-item v-show="isNewVersion" :index="'/api/automation/report'">
{{ $t("i18n.report") }}
</el-menu-item>
<el-submenu v-show="$store.state.switch.value=='old'"
<el-submenu v-show="isOldVersion"
v-permission="['test_manager','test_user','test_viewer']" index="4">
<template v-slot:title>{{ $t('commons.test') }}</template>
<ms-recent-list ref="testRecent" :options="testRecent"/>
@ -35,7 +35,7 @@
:title="$t('load_test.create')"/>
</el-submenu>
<el-submenu v-show="$store.state.switch.value=='old'"
<el-submenu v-show="isOldVersion"
v-permission="['test_manager','test_user','test_viewer']" index="5">
<template v-slot:title>{{ $t('commons.report') }}</template>
<ms-recent-list ref="reportRecent" :options="reportRecent"/>
@ -44,7 +44,7 @@
</el-submenu>
<el-menu-item v-show="$store.state.switch.value=='old'"
<el-menu-item v-show="isOldVersion"
v-permission="['test_manager','test_user','test_viewer']" :index="'/api/monitor/view'">
{{ $t('commons.monitor') }}
</el-menu-item>
@ -64,6 +64,7 @@ import MsCreateTest from "../../common/head/CreateTest";
import {ApiEvent, LIST_CHANGE} from "@/business/components/common/head/ListEvent";
import SearchList from "@/business/components/common/head/SearchList";
import ProjectChange from "@/business/components/common/head/ProjectSwitch";
import {mapGetters} from "vuex";
export default {
name: "MsApiHeaderMenus",
@ -94,6 +95,12 @@ export default {
currentProject: ''
}
},
computed: {
...mapGetters([
'isNewVersion',
'isOldVersion',
])
},
methods: {
registerEvents() {
ApiEvent.$on(LIST_CHANGE, () => {

View File

@ -47,19 +47,12 @@ export default {
},
open(items) {
this.defaultCheckedKeys = []
this.dialogTableVisible = true
this.fieldSelected = items
if (items.size <= 0) {
this.optionalField = this.optionalFields
} else {
items.forEach(i => {
this.defaultCheckedKeys.push(i.id)
}
)
}
console.log(this.defaultCheckedKeys)
items.forEach(i => {
this.defaultCheckedKeys.push(i.id)
}
)
this.fieldSelected = items;
},
saveHeader() {
let param = {
@ -71,8 +64,8 @@ export default {
console.log(this.optionalFields)
console.log(this.fieldSelected)
this.$success(this.$t("commons.save_success"));
this.dialogTableVisible = false
this.initTableData()
this.close();
})
},
removeAt(idx) {
@ -83,7 +76,6 @@ export default {
},
// 穿transfer addressList
// changeMode() {
// if (this.mode == "transfer") {

View File

@ -30,6 +30,7 @@
<script>
import {LicenseKey} from '@/common/js/constants';
import {mapGetters} from "vuex";
const requireContext = require.context('@/business/components/xpack/', true, /router\.js$/)
const report = requireContext.keys().map(key => requireContext(key).report);
@ -62,15 +63,21 @@
this.isReport = false;
}
},
computed: {
...mapGetters([
'isNewVersion',
'isOldVersion',
])
},
methods: {
handleSelect(index) {
this.activeIndex = index
},
active() {
if (this.activeIndex === '/api') {
if (this.$store.state.switch.value == 'new') {
if (this.isNewVersion) {
window.location.href = "/#/api/home";
} else if (this.$store.state.switch.value == 'old') {
} else if (this.isOldVersion) {
window.location.href = "/#/api/home_obsolete";
}
}

View File

@ -9,10 +9,10 @@
<el-dropdown-item command="about">{{ $t('commons.about_us') }} <i class="el-icon-info"/></el-dropdown-item>
<el-dropdown-item command="help">{{ $t('commons.help_documentation') }}</el-dropdown-item>
<el-dropdown-item command="ApiHelp">{{ $t('commons.api_help_documentation') }}</el-dropdown-item>
<el-dropdown-item command="old" v-show=isReadOnly @click.native="changeBar('old')">
<el-dropdown-item command="old" v-show=isNewVersion @click.native="changeBar('old')">
{{ $t('commons.cut_back_old_version') }}
</el-dropdown-item>
<el-dropdown-item command="new" v-show=!isReadOnly @click.native="changeBar('new')">
<el-dropdown-item command="new" v-show=isOldVersion @click.native="changeBar('new')">
{{ $t('commons.cut_back_new_version') }}
</el-dropdown-item>
<el-dropdown-item command="logout">{{ $t('commons.exit_system') }}</el-dropdown-item>
@ -27,6 +27,7 @@
import {getCurrentUser} from "@/common/js/utils";
import AboutUs from "./AboutUs";
import axios from "axios";
import {mapGetters} from "vuex";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const auth = requireComponent.keys().length > 0 ? requireComponent("./auth/Auth.vue") : {};
@ -36,13 +37,16 @@ export default {
components: {AboutUs},
data() {
return {
isReadOnly: this.$store.state.isReadOnly.flag
}
},
computed: {
currentUser: () => {
return getCurrentUser();
}
},
...mapGetters([
'isNewVersion',
'isOldVersion',
])
},
methods: {
logout: function () {
@ -79,9 +83,7 @@ export default {
}
},
changeBar(item) {
this.isReadOnly = !this.isReadOnly
this.$store.commit('setFlag', this.isReadOnly);
this.$store.commit('setValue', item);
this.$store.commit('setVersionSwitch', item);
if (item == "old") {
window.location.href = "/#/api/home_obsolete";
} else {

View File

@ -28,6 +28,7 @@
<script>
import {getCurrentProjectID, getCurrentUser, hasRoles} from "@/common/js/utils";
import {PROJECT_ID, ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "@/common/js/constants";
import {mapGetters} from "vuex";
export default {
name: "SearchList",
@ -39,6 +40,10 @@ export default {
this.init();
},
computed: {
...mapGetters([
'isNewVersion',
'isOldVersion',
]),
currentProjectId() {
return localStorage.getItem(PROJECT_ID)
}
@ -70,7 +75,10 @@ export default {
let projectId = localStorage.getItem(PROJECT_ID);
if (!projectId || projectId != userLastProjectId) {
localStorage.setItem(PROJECT_ID, userLastProjectId);
this.$store.commit('setProjectId', userLastProjectId);
window.location.reload();
} else {
this.$store.commit('setProjectId', projectId);
}
}
}
@ -104,11 +112,12 @@ export default {
}
this.$post("/user/update/current", {id: this.userId, lastProjectId: projectId}, () => {
localStorage.setItem(PROJECT_ID, projectId);
this.$store.commit('setProjectId', projectId);
let path = this.$route.matched[0].path ? this.$route.matched[0].path : '/';
if (path === '/api') {
if (this.$store.state.switch.value === 'new') {
if (this.isNewVersion) {
path = "/api/home";
} else if (this.$store.state.switch.value === 'old') {
} else if (this.isOldVersion) {
path = "/api/home_obsolete";
} else {
path = '/';

View File

@ -109,6 +109,7 @@ export const Test_Plan_Function_Test_Case = [
{id: 'executorName', label: i18n.t('test_track.plan_view.executor')},
{id: 'status', label: i18n.t('test_track.plan_view.execute_result')},
{id: 'updateTime', label: i18n.t('commons.update_time')},
{id: 'maintainer', label: i18n.t('api_test.definition.request.responsible')}
]
//测试计划-api用例
export const Test_Plan_Api_Case = [

View File

@ -123,7 +123,7 @@ export default {
},
methods: {
importAPITest() {
let apiTest = this.$store.state.api.test;
let apiTest = this.$store.state.test;
if (apiTest && apiTest.name) {
this.$set(this.test, "name", apiTest.name);
let blob = new Blob([apiTest.jmx.xml], {type: "application/octet-stream"});

View File

@ -215,7 +215,7 @@ export default {
//
async function f() {
return await axios.post('/performance/file/' + getCurrentProjectID() + '/getMetadataByName', {filename: file.name})
return await axios.post('/performance/file/' + getCurrentProjectID() + '/getMetadataByName', {name: file.name})
}
await f().then(res => {

View File

@ -22,7 +22,7 @@
:label="$t('api_test.automation.tag')">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName"
style="margin-left: 5px"/>
style="margin-left: 0px; margin-right: 2px"/>
</template>
</el-table-column>
<el-table-column

View File

@ -26,6 +26,11 @@
row: Object,
size: Number
},
created() {
if (this.trashEnable) {
this.buttons.splice(1, 1);
}
},
methods: {
click(btn) {
if (btn.handleClick instanceof Function) {

View File

@ -105,13 +105,12 @@ export default {
this.testCaseForm.projectId = getCurrentProjectID();
this.testCaseForm.type = "";
this.testCaseForm.priority = "P0";
this.testCaseForm.method = "manual";
if(this.currentModule!==undefined){
if (this.currentModule !== undefined || this.currentModule !== null || this.currentModule !== 0 || this.currentModule !== "") {
this.testCaseForm.nodePath = this.currentModule.path;
this.testCaseForm.nodeId = this.currentModule.id;
}else{
this.testCaseForm.nodePath="/全部用例"
this.testCaseForm.nodeId="root"
} else {
this.testCaseForm.nodePath = "/全部用例"
this.testCaseForm.nodeId = "root"
}
this.result = this.$post(path, this.testCaseForm, response => {
this.testCaseForm.id=response.data.id

View File

@ -83,7 +83,6 @@
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
@ -98,17 +97,12 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item :label="$t('test_track.case.relate_test')" :label-width="formLabelWidth" prop="testId">
<el-cascader show-all-levels v-model="form.selected" :props="props" ></el-cascader>
</el-form-item>
</el-col>
<!-- <el-col :span="7" v-if="form.testId=='other'">
<el-form-item :label="$t('test_track.case.test_name')" :label-width="formLabelWidth" prop="testId">
<el-input v-model="form.otherTestName" :placeholder="$t('test_track.case.input_test_case')"></el-input>
<el-col :span="14">
<el-form-item :label="$t('test_track.case.relate_test')" :label-width="formLabelWidth">
<el-cascader filterable placeholder="请选择要关联的测试" show-all-levels v-model="form.selected" :props="props"
class="ms-case"></el-cascader>
</el-form-item>
</el-col>-->
</el-col>
</el-row>
<el-row>
@ -126,8 +120,9 @@
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="需求名称" :label-width="formLabelWidth" prop="demandName" v-if="form.demandId=='other'">
<el-col :span="10" :offset="1">
<el-form-item label="需求ID/名称" :label-width="formLabelWidth" prop="demandName"
v-if="form.demandId=='other'">
<el-input v-model="form.demandName"></el-input>
</el-form-item>
</el-col>
@ -341,7 +336,6 @@ export default {
}
if (this.projectId && this.form.type != '' && this.form.type != 'undefined') {
this.$get(url, response => {
response.data.unshift({id: 'other', name: this.$t('test_track.case.other')})
const nodes = response.data
.map(item => ({
value: item.id,
@ -445,6 +439,14 @@ export default {
if (this.type === 'edit' || this.type === 'copy') {
this.open(this.currentTestCaseInfo)
}
// Cascader : input
setInterval(function () {
document.querySelectorAll('.el-cascader-node__label').forEach(el => {
el.onclick = function () {
if (this.previousElementSibling) this.previousElementSibling.click();
};
});
}, 1000);
},
watch: {
treeNodes() {
@ -582,8 +584,10 @@ export default {
}
Object.assign(this.form, tmp);
this.form.module = testCase.nodeId;
this.form.testId=testCase.selected
console.log(this.form.testId)
/*
this.form.testId=testCase.selected
*/
console.log(this.form.selected)
this.getFileMetaData(testCase);
},
setTestCaseExtInfo(testCase) {
@ -678,8 +682,6 @@ export default {
}
this.dialogFormVisible = false;
this.$emit("refresh");
// 广 head
TrackEvent.$emit(LIST_CHANGE);
});
}
} else {
@ -779,7 +781,6 @@ export default {
});
},
getTestOptions(val) {
console.log(val)
this.projectId = getCurrentProjectID()
this.testOptions = [];
let url = '';
@ -999,6 +1000,10 @@ export default {
width: 100%;
}
.ms-case {
width: 100%;
}
/deep/ .el-button-group > .el-button:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;

View File

@ -29,6 +29,7 @@ export default {
},
methods: {
open(file) {
console.log(file)
this.file = file;
this.dialogVisible = true;
},

View File

@ -131,7 +131,7 @@
<el-table-column v-if="item.id=='tags'" prop="tags" :label="$t('commons.tag')" :key="index">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
:content="itemName" style="margin-left: 5px"/>
:content="itemName" style="margin-left: 0px; margin-right: 2px"/>
</template>
</el-table-column>
@ -259,7 +259,7 @@ export default {
return {
type: TEST_CASE_LIST,
headerItems: Track_Test_Case,
tableLabel: [],
tableLabel: Track_Test_Case,
result: {},
deletePath: "/test/case/delete",
condition: {
@ -409,11 +409,15 @@ export default {
getData() {
this.getSelectDataRange();
this.condition.selectThisWeedData = false;
this.condition.selectThisWeedRelevanceData = false;
this.condition.caseCoverage = null;
switch (this.selectDataRange) {
case 'thisWeekCount':
this.condition.selectThisWeedData = true;
break;
case 'thisWeekRelevanceCount':
this.condition.selectThisWeedRelevanceData = true;
break;
case 'uncoverage':
this.condition.caseCoverage = 'uncoverage';
break;
@ -443,6 +447,10 @@ export default {
item.tags = JSON.parse(item.tags);
}
})
if (this.$refs.table) {
this.$refs.table.doLayout()
}
});
}
},

View File

@ -49,26 +49,29 @@ name: "TestCaseMinder",
},
save(data) {
let saveCases = [];
this.buildSaveCase(data.root, saveCases, undefined);
let deleteCases = [];
this.buildSaveCase(data.root, saveCases, deleteCases, undefined);
let param = {
projectId: this.projectId,
data: saveCases
data: saveCases,
ids: deleteCases.map(item => item.id)
}
this.result = this.$post('/test/case/minder/edit', param, () => {
this.$success(this.$t('commons.save_success'));
});
},
buildSaveCase(root, saveCases, parent) {
buildSaveCase(root, saveCases, deleteCases, parent) {
let data = root.data;
if (data.resource && data.resource.indexOf(this.$t('api_test.definition.request.case')) > -1) {
if (root.parent) {
console.log(root.parent);
}
this._buildSaveCase(root, saveCases, parent);
} else {
let deleteChild = data.deleteChild;
if (deleteChild && deleteChild.length > 0) {
deleteCases.push(...deleteChild);
}
if (root.children) {
root.children.forEach((childNode) => {
this.buildSaveCase(childNode, saveCases, root.data);
this.buildSaveCase(childNode, saveCases, deleteCases, root.data);
})
}
}

View File

@ -9,18 +9,22 @@
<el-menu-item :index="'/track/home'">
{{ $t("i18n.home") }}
</el-menu-item>
<el-submenu v-permission="['test_manager','test_user','test_viewer']"
index="6" popper-class="submenu">
<template v-slot:title>{{ $t('test_track.case.test_case') }}</template>
<ms-recent-list ref="caseRecent" :options="caseRecent"/>
<el-divider/>
<ms-show-all :index="'/track/case/all'"/>
<el-menu-item :index="testCaseEditPath" class="blank_item"></el-menu-item>
<el-menu-item :index="testCaseProjectPath" class="blank_item"></el-menu-item>
<ms-create-button v-permission="['test_manager','test_user']" :index="'/track/case/create'"
:title="$t('test_track.case.create_case')"/>
</el-submenu>
<el-menu-item :index="'/track/case/all'">
{{ $t("test_track.case.test_case") }}
</el-menu-item>
<!--
<el-submenu v-permission="['test_manager','test_user','test_viewer']"
index="6" popper-class="submenu">
<template v-slot:title>{{ $t('test_track.case.test_case') }}</template>
<ms-recent-list ref="caseRecent" :options="caseRecent"/>
<el-divider/>
<ms-show-all :index="'/track/case/all'"/>
<el-menu-item :index="testCaseEditPath" class="blank_item"></el-menu-item>
<el-menu-item :index="testCaseProjectPath" class="blank_item"></el-menu-item>
<ms-create-button v-permission="['test_manager','test_user']" :index="'/track/case/create'"
:title="$t('test_track.case.create_case')"/>
</el-submenu>
-->
<el-submenu v-permission="['test_manager','test_user','test_viewer']"
index="8" popper-class="submenu">

View File

@ -169,7 +169,7 @@ export default {
type: 'bar',
itemStyle: {
normal: {
color: this.$store.state.theme.theme ? this.$store.state.theme.theme : COUNT_NUMBER
color: this.$store.state.theme ? this.$store.state.theme : COUNT_NUMBER
}
}
},
@ -179,7 +179,7 @@ export default {
type: 'bar',
itemStyle: {
normal: {
color: this.$store.state.theme.theme ? this.$store.state.theme.theme : COUNT_NUMBER_SHALLOW
color: this.$store.state.theme ? this.$store.state.theme : COUNT_NUMBER_SHALLOW
}
}
}]

View File

@ -40,7 +40,7 @@
<el-row>
<el-col>
{{$t('api_test.home_page.api_details_card.this_week_add')}}
<el-link type="info" @click="redirectPage('thisWeekCount')" target="_blank" style="color: #000000">{{relevanceCountData.thisWeekAddedCount}}
<el-link type="info" @click="redirectPage('thisWeekRelevanceCount')" target="_blank" style="color: #000000">{{relevanceCountData.thisWeekAddedCount}}
</el-link>
{{$t('api_test.home_page.unit_of_measurement')}}
</el-col>

View File

@ -96,7 +96,7 @@
:label="$t('api_test.automation.tag')" :key="index">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
:content="itemName" style="margin-left: 5px"></ms-tag>
:content="itemName" style="margin-left: 0px; margin-right: 2px"></ms-tag>
</template>
</el-table-column>
<el-table-column
@ -248,7 +248,7 @@ export default {
return {
type: TEST_PLAN_LIST,
headerItems: Test_Plan_List,
tableLabel: [],
tableLabel: Test_Plan_List,
result: {},
enableDeleteTip: false,
queryPath: "/test/plan/list",

View File

@ -31,7 +31,7 @@
</el-table-column>
<el-table-column prop="tagNames" :label="$t('api_test.automation.tag')" min-width="120">
<template v-slot:default="scope">
<ms-tag v-for="itemName in scope.row.tags" :key="itemName" type="success" effect="plain" :content="itemName" style="margin-left: 5px"/>
<ms-tag v-for="itemName in scope.row.tags" :key="itemName" type="success" effect="plain" :content="itemName" style="margin-left: 0px; margin-right: 2px"/>
</template>
</el-table-column>
<el-table-column prop="userId" :label="$t('api_test.automation.creator')" show-overflow-tooltip/>

View File

@ -80,7 +80,7 @@
:label="$t('commons.tag')"
:key="index">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" style="margin-left: 5px"/>
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" style="margin-left: 0px; margin-right: 2px"/>
</template>
</el-table-column>
@ -192,7 +192,7 @@ export default {
return {
type: TEST_PLAN_API_CASE,
headerItems: Test_Plan_Api_Case,
tableLabel: [],
tableLabel: Test_Plan_Api_Case,
condition: {},
selectCase: {},
result: {},
@ -453,15 +453,12 @@ export default {
this.initTable();
},
singleRun(row) {
if (!row.environmentId) {
this.$warning(this.$t('api_test.environment.select_environment'));
return;
}
this.runData = [];
this.rowLoading = row.id;
this.$get('/api/testcase/get/' + row.caseId, (response) => {
console.log(response.data)
let apiCase = response.data;
let request = JSON.parse(apiCase.request);
request.name = row.id;

View File

@ -38,7 +38,7 @@
width="200px" :key="index">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
:content="itemName" style="margin-left: 5px"/>
:content="itemName" style="margin-left: 0px; margin-right: 2px"/>
</template>
</el-table-column>
<el-table-column v-if="item.id == 'userId'" prop="userId" :label="$t('api_test.automation.creator')"
@ -148,7 +148,7 @@ export default {
return {
type: TEST_PLAN_SCENARIO_CASE,
headerItems: Test_Plan_Scenario_Case,
tableLabel: [],
tableLabel: Test_Plan_Scenario_Case,
loading: false,
condition: {},
currentScenario: {},

View File

@ -48,10 +48,8 @@
<span class="cast_item">{{ testCase.priority }}</span>
</el-col>
<el-col :span="5">
<span class="cast_label">{{ $t('test_track.case.case_type') }}</span>
<span class="cast_item" v-if="testCase.type === 'functional'">{{ $t('commons.functional') }}</span>
<span class="cast_item" v-if="testCase.type === 'performance'">{{ $t('commons.performance') }}</span>
<span class="cast_item" v-if="testCase.type === 'api'">{{ $t('commons.api') }}</span>
<span class="cast_label">{{ $t('test_track.case.module') }}</span>
<span class="cast_item">{{ testCase.nodePath }}</span>
</el-col>
<el-col :span="10">
<test-plan-test-case-status-button class="status-button"
@ -63,15 +61,6 @@
</el-row>
<el-row>
<el-col :span="4" :offset="1">
<span class="cast_label">{{ $t('test_track.case.method') }}</span>
<span v-if="testCase.method === 'manual'">{{ $t('test_track.case.manual') }}</span>
<span v-if="testCase.method === 'auto'">{{ $t('test_track.case.auto') }}</span>
</el-col>
<el-col :span="5">
<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.plan.plan_project') }}</span>
<span class="cast_item">{{ testCase.projectName }}</span>

View File

@ -4,9 +4,12 @@
<!-- <template v-slot:header>-->
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="initTableData"
:show-create="false" :tip="$t('commons.search_by_id_name_tag')">
<!-- 不显示 全部用例 标题,使标题为空 -->
<template v-slot:title>
<node-breadcrumb class="table-title" :nodes="selectParentNodes" @refresh="breadcrumbRefresh"/>
<span></span>
</template>
<template v-slot:button>
<ms-table-button :is-tester-permission="true" v-if="!showMyTestCase" icon="el-icon-s-custom"
:content="$t('test_track.plan_view.my_case')" @click="searchMyTestCase"/>
@ -15,8 +18,11 @@
<ms-table-button :is-tester-permission="true" icon="el-icon-connection"
:content="$t('test_track.plan_view.relevance_test_case')"
@click="$emit('openTestCaseRelevanceDialog')"/>
<ms-table-button :is-tester-permission="true" icon="el-icon-document-remove"
:content="$t('test_track.plan_view.cancel_all_relevance')" @click="handleDeleteBatch"/>
<!-- 删除 取消全部关联 按钮-->
<!-- <ms-table-button :is-tester-permission="true" icon="el-icon-document-remove"-->
<!-- :content="$t('test_track.plan_view.cancel_all_relevance')" @click="handleDeleteBatch"/>-->
</template>
</ms-table-header>
<!-- </template>-->
@ -27,6 +33,7 @@
:select-ids="new Set(Array.from(this.selectRows).map(row => row.id))" @refresh="initTableData"/>
<el-table
ref="table"
class="adjust-table"
border
@select-all="handleSelectAll"
@ -173,6 +180,16 @@
column-key="executor"
:label="$t('test_track.plan_view.executor')">
</el-table-column>
<!-- 责任人(创建该用例时所关联的责任人) -->
<el-table-column
v-if="item.id == 'maintainer'"
prop="maintainer"
:filters="maintainerFilters"
min-width="100px"
:key="index"
column-key="maintainer"
:label="$t('api_test.definition.request.responsible')">
</el-table-column>
<el-table-column
v-if="item.id == 'status'"
@ -312,7 +329,7 @@ export default {
return {
type: TEST_PLAN_FUNCTION_TEST_CASE,
headerItems: Test_Plan_Function_Test_Case,
tableLabel: [],
tableLabel: Test_Plan_Function_Test_Case,
result: {},
deletePath: "/test/case/delete",
condition: {
@ -352,6 +369,7 @@ export default {
{text: this.$t('test_track.plan.plan_status_running'), value: 'Underway'},
],
executorFilters: [],
maintainerFilters: [],
showMore: false,
buttons: [
{
@ -462,6 +480,9 @@ export default {
}
}
this.selectRows.clear();
if (this.$refs.table) {
this.$refs.table.doLayout()
}
});
}
getLabel(this, TEST_PLAN_FUNCTION_TEST_CASE);
@ -665,6 +686,9 @@ export default {
this.executorFilters = response.data.map(u => {
return {text: u.name, value: u.id}
});
this.maintainerFilters = response.data.map(u => {
return {text: u.id + '(' + u.name + ')', value: u.id};
});
});
}
}

View File

@ -154,7 +154,7 @@ export default {
return {
type: TEST_PLAN_LOAD_CASE,
headerItems: Test_Plan_Load_Case,
tableLabel: [],
tableLabel: Test_Plan_Load_Case,
condition: {},
result: {},
tableData: [],

View File

@ -20,7 +20,7 @@
<el-table-column prop="tags" :label="$t('api_test.automation.tag')" width="200px">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" style="margin-left: 5px"/>
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" style="margin-left: 0px; margin-right: 2px"/>
</template>
</el-table-column>

View File

@ -62,7 +62,7 @@
:label="$t('api_test.automation.tag')" :key="index">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
:content="itemName" style="margin-left: 5px"></ms-tag>
:content="itemName" style="margin-left: 0px; margin-right: 2px"></ms-tag>
</template>
</el-table-column>
<el-table-column

View File

@ -74,8 +74,12 @@
</el-row>
<el-row>
<el-col :offset="1">
<span class="cast_label">{{ $t('test_track.plan_view.relevance_test_case') }}</span>
<span class="cast_item">{{ testCase.prerequisite }}</span>
<span class="cast_label">关联测试</span>
<span v-for="(item,index) in testCase.list" :key="index">
<el-button @click="openTest(item)" type="text" style="margin-left: 7px;">{{
item.testName
}}</el-button>
</span>
</el-col>
</el-row>
<el-row>
@ -241,7 +245,7 @@ import PerformanceTestDetail from "../../../plan/view/comonents/test/Performance
import ApiTestResult from "../../../plan/view/comonents/test/ApiTestResult";
import ApiTestDetail from "../../../plan/view/comonents/test/ApiTestDetail";
import TestPlanTestCaseStatusButton from "../../../plan/common/TestPlanTestCaseStatusButton";
import {getCurrentProjectID, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import {getCurrentProjectID, getUUID, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import ReviewComment from "../../commom/ReviewComment";
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
import ApiCaseItem from "@/business/components/api/definition/components/case/ApiCaseItem";
@ -295,6 +299,35 @@ export default {
}
},
methods: {
openTest(item) {
const type = item.testType;
const id = item.testId;
switch (type) {
case "performance": {
let performanceData = this.$router.resolve({
path: '/performance/test/edit/' + id,
})
window.open(performanceData.href, '_blank');
break;
}
case "testcase": {
let caseData = this.$router.resolve({
name: 'ApiDefinition',
params: {redirectID: getUUID(), dataType: "apiTestCase", dataSelectRange: 'single:' + id}
});
window.open(caseData.href, '_blank');
break;
}
case "automation": {
let automationData = this.$router.resolve({
name: 'ApiAutomation',
params: {redirectID: getUUID(), dataType: "scenario", dataSelectRange: 'edit:' + id}
});
window.open(automationData.href, '_blank');
break;
}
}
},
handleClose() {
removeGoBackListener(this.handleClose);
this.showDialog = false;
@ -354,6 +387,7 @@ export default {
item.steptResults.push(item.steps[i]);
}
this.testCase = item;
console.log(this.testCase)
this.getRelatedTest();
this.getComments(item);
/* this.initTest();*/

@ -1 +1 @@
Subproject commit f63ebb68ebad78de42fd711f17e2671e34577a86
Subproject commit bc5735a2eb796640bde400ae6cafca6229672905

View File

@ -10,7 +10,7 @@ import router from "./components/common/router/router";
import YanProgress from 'yan-progress';
import './permission' // permission control
import i18n from "../i18n/i18n";
import store from "./store";
import store from "../store";
import {permission, roles, tester, xpack} from './permission'
import chart from "../common/js/chart";
import CalendarHeatmap from "../common/js/calendar-heatmap";

View File

@ -1,72 +0,0 @@
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex);
const Common = {
state: {
projectId: ""
},
mutations: {
setProjectId(state, projectId) {
state.projectId = projectId;
}
}
}
const API = {
state: {
test: {}
},
mutations: {
setTest(state, test) {
state.test = test;
},
clearTest(state) {
state.test = {};
}
}
}
const Switch = {
state: {
value: "new"
},
mutations: {
setValue(state, value) {
state.value = value;
}
}
}
const IsReadOnly = {
state: {
flag: true
},
mutations: {
setFlag(state, value) {
state.flag = value;
}
}
}
const Theme = {
state: {
theme: undefined
},
mutations: {
setTheme(state, value) {
state.theme = value;
}
}
}
export default new Vuex.Store({
modules: {
api: API,
common: Common,
switch: Switch,
isReadOnly: IsReadOnly,
theme: Theme
}
})

View File

@ -69,6 +69,10 @@ html,body {
border-right-color: white !important;
}
.adjust-table.ms-select-all-fixed th:first-child.el-table-column--selection {
border-right-color: #DCDFE6 !important;
}
.adjust-table {
border-color: white !important;
}

View File

@ -945,10 +945,10 @@ export default {
export_tip: "Export Tip",
ms_tip: "Support for MeterSphere JSON format",
ms_export_tip: "Export jSON-formatted files via MeterSphere website or browser plug-ins",
har_export_tip: "Export Har files by browser dev-tool",
har_export_tip: "Export HAR files by browser dev-tool",
esb_export_tip: "Can not export esb files now",
swagger_tip: "Swagger 2.0 and 3.0 json files are supported",
har_tip: "Only Har files are supported",
har_tip: "Only HAR files are supported",
esb_tip: "Only ESB xlsx files are supported",
postman_tip: "Only Postman Collection V2.1 json files are supported",
postman_export_tip: "Export the test collection by Postman",

View File

@ -948,11 +948,11 @@ export default {
export_tip: "导出方法",
ms_tip: "支持 MeterSphere json 格式",
ms_export_tip: "通过 MeterSphere 接口测试页面或者浏览器插件导出 json 格式文件",
har_export_tip: "通过 浏览器的开发者工具 导出 Har 格式文件",
har_export_tip: "通过 浏览器的开发者工具 导出 HAR 格式文件",
esb_export_tip: "暂时不支持ESB文件的导出",
postman_tip: "只支持 Postman Collection v2.1 格式的 json 文件",
swagger_tip: "支持 Swagger 2.0 与 3.0 版本的 json 文件",
har_tip: "只支持 Har 文件",
har_tip: "只支持 HAR 文件",
esb_tip: "只支持 ESB 模版的xlsx文件",
post_export_tip: "通过 Postman 导出测试集合",
swagger_export_tip: "通过 Swagger 页面导出",

View File

@ -947,11 +947,11 @@ export default {
export_tip: "導出方法",
ms_tip: "支持 MeterSphere json 格式",
ms_export_tip: "通過 MeterSphere 接口測試頁面或者瀏覽器插件導出 json 格式文件",
har_export_tip: "通过 瀏覽器到開發者工具 导出 Har 格式文件",
har_export_tip: "通过 瀏覽器到開發者工具 导出 HAR 格式文件",
esb_export_tip: "暫時不支持ESB文件的导出",
postman_tip: "只支持 Postman Collection v2.1 格式的 json 文件",
swagger_tip: "支持 Swagger 2.0 與 3.0 版本的 json 文件",
har_tip: "只支持 Har 文件",
har_tip: "只支持 HAR 文件",
esb_tip: "只支持 ESB 模板的xlsx文件",
post_export_tip: "通過 Postman 導出測試集合",
swagger_export_tip: "通過 Swagger 頁面導出",

View File

@ -0,0 +1,6 @@
const actions = {
// changeCount: ({
// commit
// }) => commit('changeCount'),
}
export default actions;

View File

@ -0,0 +1,6 @@
const getters = {
isNewVersion: state => state.versionSwitch === 'new',
isOldVersion: state => state.versionSwitch === 'old'
}
export default getters

View File

@ -0,0 +1,25 @@
import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import actions from './actions'
import mutations from './mutations'
Vue.use(Vuex)
const state = {
projectId: "",
test: {},
versionSwitch: "new",
isReadOnly: true,
theme: undefined
}
const store = new Vuex.Store({
state,
getters,
actions,
mutations
})
export default store

View File

@ -0,0 +1,9 @@
const mutations = {
setProjectId: (state, projectId) => state.projectId = projectId,
setTest: (state, test) => state.test = test,
clearTest: state => state.test = {},
setVersionSwitch: (state, value) => state.versionSwitch = value,
setTheme: (state, value) => state.theme = value
}
export default mutations;