refactor(接口测试): 同步相关问题优化
--user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001015900 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001015897 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001015882 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001015879 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001015859
This commit is contained in:
parent
d30624e3fa
commit
b28e9f2211
|
@ -233,4 +233,9 @@ public class ApiTestCaseController {
|
||||||
public void saveFollows(@PathVariable String testId, @RequestBody List<String> follows) {
|
public void saveFollows(@PathVariable String testId, @RequestBody List<String> follows) {
|
||||||
apiTestCaseService.saveFollows(testId, follows);
|
apiTestCaseService.saveFollows(testId, follows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/be/cited/scenario/{testId}")
|
||||||
|
public Integer getCitedScenarioCount(@PathVariable String testId) {
|
||||||
|
return apiTestCaseService.getCitedScenarioCount(testId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,6 +125,8 @@ public class ApiTestCaseService {
|
||||||
private ApiCaseBatchSyncService apiCaseSyncService;
|
private ApiCaseBatchSyncService apiCaseSyncService;
|
||||||
@Resource
|
@Resource
|
||||||
private ApiTestCaseSyncService apiTestCaseSyncService;
|
private ApiTestCaseSyncService apiTestCaseSyncService;
|
||||||
|
@Resource
|
||||||
|
private ApiScenarioReferenceIdMapper apiScenarioReferenceIdMapper;
|
||||||
|
|
||||||
|
|
||||||
private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR;
|
private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR;
|
||||||
|
@ -1299,7 +1301,7 @@ public class ApiTestCaseService {
|
||||||
if (!request.isToBeUpdated() || StringUtils.isBlank(request.getProjectId())) {
|
if (!request.isToBeUpdated() || StringUtils.isBlank(request.getProjectId())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Long toBeUpdatedTime = this.getToBeUpdatedTime(request.getProjectId());
|
Long toBeUpdatedTime = this.getToBeUpdatedTime(request.getProjectId());
|
||||||
if (toBeUpdatedTime != null) {
|
if (toBeUpdatedTime != null) {
|
||||||
request.setToBeUpdateTime(toBeUpdatedTime);
|
request.setToBeUpdateTime(toBeUpdatedTime);
|
||||||
|
@ -1310,4 +1312,15 @@ public class ApiTestCaseService {
|
||||||
}
|
}
|
||||||
request.setStatusList(syncRuleCaseStatus);
|
request.setStatusList(syncRuleCaseStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getCitedScenarioCount(String testId) {
|
||||||
|
ApiScenarioReferenceIdExample apiScenarioReferenceIdExample = new ApiScenarioReferenceIdExample();
|
||||||
|
apiScenarioReferenceIdExample.createCriteria().andDataTypeEqualTo(ReportTriggerMode.CASE.name()).andReferenceTypeEqualTo(MsTestElementConstants.REF.name()).andReferenceIdEqualTo(testId);
|
||||||
|
List<ApiScenarioReferenceId> apiScenarioReferenceIds = apiScenarioReferenceIdMapper.selectByExample(apiScenarioReferenceIdExample);
|
||||||
|
if (CollectionUtils.isEmpty(apiScenarioReferenceIds)) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return apiScenarioReferenceIds.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -362,6 +362,7 @@
|
||||||
t1.update_user_id,
|
t1.update_user_id,
|
||||||
t1.create_time,
|
t1.create_time,
|
||||||
t1.update_time,
|
t1.update_time,
|
||||||
|
t1.to_be_updated,
|
||||||
t1.num,
|
t1.num,
|
||||||
a.module_id,
|
a.module_id,
|
||||||
a.path,
|
a.path,
|
||||||
|
|
|
@ -29,5 +29,5 @@ public class ProjectConfig {
|
||||||
private String triggerUpdate;
|
private String triggerUpdate;
|
||||||
private Boolean openUpdateTime = false;
|
private Boolean openUpdateTime = false;
|
||||||
private String openUpdateRuleTime;
|
private String openUpdateRuleTime;
|
||||||
private Boolean openUpdateRule = false;
|
private Boolean openUpdateRule = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,7 +323,8 @@ export default {
|
||||||
caseSyncRuleRelation: {
|
caseSyncRuleRelation: {
|
||||||
scenarioCreator: true,
|
scenarioCreator: true,
|
||||||
showUpdateRule: false,
|
showUpdateRule: false,
|
||||||
}
|
},
|
||||||
|
citedScenarioCount: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -395,6 +396,7 @@ export default {
|
||||||
if (hasLicense()) {
|
if (hasLicense()) {
|
||||||
this.beforeUpdateRequest = deepClone(this.apiCase.request);
|
this.beforeUpdateRequest = deepClone(this.apiCase.request);
|
||||||
this.getSyncRule();
|
this.getSyncRule();
|
||||||
|
this.getCitedScenarioCount();
|
||||||
this.$EventBus.$on('showXpackCaseSet', noShowSyncRuleRelation => {
|
this.$EventBus.$on('showXpackCaseSet', noShowSyncRuleRelation => {
|
||||||
this.handleXpackCaseSetChange(noShowSyncRuleRelation);
|
this.handleXpackCaseSetChange(noShowSyncRuleRelation);
|
||||||
});
|
});
|
||||||
|
@ -707,6 +709,9 @@ export default {
|
||||||
},
|
},
|
||||||
validCaseRestChange() {
|
validCaseRestChange() {
|
||||||
let syncCaseVisible = false;
|
let syncCaseVisible = false;
|
||||||
|
if (this.citedScenarioCount === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (this.apiCase.request.headers && this.beforeUpdateRequest.headers) {
|
if (this.apiCase.request.headers && this.beforeUpdateRequest.headers) {
|
||||||
let submitRequestHeaders = JSON.stringify(this.apiCase.request.headers);
|
let submitRequestHeaders = JSON.stringify(this.apiCase.request.headers);
|
||||||
let beforeRequestHeaders = JSON.stringify(this.beforeUpdateRequest.headers);
|
let beforeRequestHeaders = JSON.stringify(this.beforeUpdateRequest.headers);
|
||||||
|
@ -869,6 +874,13 @@ export default {
|
||||||
},
|
},
|
||||||
handleXpackCaseSetChange(noShowSyncRuleRelation) {
|
handleXpackCaseSetChange(noShowSyncRuleRelation) {
|
||||||
this.noShowSyncRuleRelation = noShowSyncRuleRelation
|
this.noShowSyncRuleRelation = noShowSyncRuleRelation
|
||||||
|
},
|
||||||
|
getCitedScenarioCount() {
|
||||||
|
this.$get('/api/testcase/be/cited/scenario/' + this.apiCase.id, response => {
|
||||||
|
if (response.data) {
|
||||||
|
this.citedScenarioCount = response.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -427,7 +427,7 @@ export default {
|
||||||
this.showSyncTimeSetting = true;
|
this.showSyncTimeSetting = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.openUpdateRule = this.config.openUpdateRule
|
this.openUpdateRule = this.config.openUpdateRule !== false;
|
||||||
this.disabledRuleBtn = !this.openUpdateRule
|
this.disabledRuleBtn = !this.openUpdateRule
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -3414,7 +3414,7 @@ export default {
|
||||||
no_show_setting_tip: "After checking, the pop-up window will no longer pop up, and the synchronization and change notification will be performed according to the setting content by default: If you need to change the setting, you can open the setting item in the drop-down option next to the save button。",
|
no_show_setting_tip: "After checking, the pop-up window will no longer pop up, and the synchronization and change notification will be performed according to the setting content by default: If you need to change the setting, you can open the setting item in the drop-down option next to the save button。",
|
||||||
go_to_api_message: 'Interface API update message notification',
|
go_to_api_message: 'Interface API update message notification',
|
||||||
go_to_case_message: 'CASE update message notification',
|
go_to_case_message: 'CASE update message notification',
|
||||||
update_case_tip: 'When the CASE changes, the creator of the automation scene referring to the CASE recycles the message reminder in the station'
|
update_case_tip: 'When the CASE changes, the creator of the automation scene referring to the CASE will receive an in-site message reminder'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -3425,7 +3425,7 @@ export default {
|
||||||
no_show_setting_tip: "勾选后,不再弹出弹窗,会默认按照设置的内容执行同步和变更通知:如果需要更改设置,可以在保存按钮旁的下拉选项中,打开设置项。",
|
no_show_setting_tip: "勾选后,不再弹出弹窗,会默认按照设置的内容执行同步和变更通知:如果需要更改设置,可以在保存按钮旁的下拉选项中,打开设置项。",
|
||||||
go_to_api_message: '接口API更新消息通知',
|
go_to_api_message: '接口API更新消息通知',
|
||||||
go_to_case_message: 'CASE更新消息通知',
|
go_to_case_message: 'CASE更新消息通知',
|
||||||
update_case_tip: '当CASE发生变化时,引用CASE的自动化场景创建人回收到站内消息提醒'
|
update_case_tip: '当CASE发生变化时,引用CASE的自动化场景创建人会收到站内消息提醒'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -3401,7 +3401,7 @@ export default {
|
||||||
no_show_setting_tip: "勾選後,不再彈出彈窗,會默認按照設置的內容執行同步和變更通知:如果需要更改設置,可以在保存按鈕旁的下拉選項中,打開設置項。",
|
no_show_setting_tip: "勾選後,不再彈出彈窗,會默認按照設置的內容執行同步和變更通知:如果需要更改設置,可以在保存按鈕旁的下拉選項中,打開設置項。",
|
||||||
go_to_api_message: '接口API更新消息通知',
|
go_to_api_message: '接口API更新消息通知',
|
||||||
go_to_case_message: 'CASE更新消息通知',
|
go_to_case_message: 'CASE更新消息通知',
|
||||||
update_case_tip: '當CASE發生變化時,引用CASE的自動化場景創建人回收到站內消息提醒'
|
update_case_tip: '當CASE發生變化時,引用CASE的自動化場景創建人會收到站內消息提醒'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue