Merge branch 'v1.8'

This commit is contained in:
Captain.B 2021-03-29 10:57:10 +08:00
commit b5e3077544
12 changed files with 817 additions and 714 deletions

View File

@ -198,7 +198,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
apiDefinitionService.addResult(testResult);
//测试计划定时任务-接口执行逻辑的话需要同步测试计划的报告数据
if (StringUtils.equals(this.runMode, ApiRunMode.SCHEDULE_API_PLAN.name())) {
if (StringUtils.equalsAny(this.runMode, ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name())) {
apiDefinitionExecResultService.saveApiResultByScheduleTask(testResult, ApiRunMode.SCHEDULE_API_PLAN.name());
List<String> testPlanReportIdList = new ArrayList<>();
testPlanReportIdList.add(debugReportId);

View File

@ -331,20 +331,6 @@ public class TestCaseReviewService {
}
public void testReviewRelevance(ReviewRelevanceRequest request) {
String reviewId = request.getReviewId();
List<String> userIds = getTestCaseReviewerIds(reviewId);
String creator = "";
TestCaseReview review = testCaseReviewMapper.selectByPrimaryKey(reviewId);
if (review != null) {
creator = review.getCreator();
}
String currentId = SessionUtils.getUser().getId();
if (!userIds.contains(currentId) && !StringUtils.equals(creator, currentId)) {
MSException.throwException("没有权限,不能关联用例!");
}
List<String> testCaseIds = request.getTestCaseIds();
if (testCaseIds.isEmpty()) {

View File

@ -69,7 +69,8 @@
<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: 0px; margin-right: 2px"/>
<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"
@ -175,20 +176,21 @@
import PriorityTableItem from "../../../track/common/tableItems/planview/PriorityTableItem";
import PlanStatusTableItem from "../../../track/common/tableItems/plan/PlanStatusTableItem";
import BatchEdit from "../../../track/case/components/BatchEdit";
import {API_SCENARIO_LIST, TEST_CASE_LIST, TEST_PLAN_LIST, WORKSPACE_ID} from "../../../../../common/js/constants";
import {PROJECT_NAME} from "../../../../../common/js/constants";
import {API_SCENARIO_LIST, PROJECT_NAME, WORKSPACE_ID} from "../../../../../common/js/constants";
import EnvironmentSelect from "../../definition/components/environment/EnvironmentSelect";
import BatchMove from "../../../track/case/components/BatchMove";
import {_sort, getLabel, getSystemLabel} from "@/common/js/tableUtils";
import {Api_Scenario_List} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {
_filter,
_handleSelect,
_handleSelectAll,
_sort,
getLabel,
getSelectDataCounts,
setUnSelectIds, toggleAllSelection
setUnSelectIds,
toggleAllSelection
} from "@/common/js/tableUtils";
import {Api_Scenario_List} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
@ -343,8 +345,6 @@
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
this.search();
this.getPrincipalOptions([]);
getSystemLabel(this, this.type)
},
watch: {
selectNodeIds() {
@ -440,9 +440,12 @@
item.tags = JSON.parse(item.tags);
}
});
this.result.loading = false;
if (this.$refs.scenarioTable) {
setTimeout(this.$refs.scenarioTable.doLayout, 200)
setTimeout(() => {
this.$refs.scenarioTable.doLayout();
this.result.loading = false;
}, 500)
}
if (!this.condition.selectAll) {

View File

@ -116,7 +116,9 @@
</el-col>
<el-col :span="6">
<env-popover :env-map="projectEnvMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
:project-list="projectList" ref="envPopover"/>
:project-list="projectList" ref="envPopover"
:disabled="scenarioDefinition.length < 1"
:is-read-only="scenarioDefinition.length < 1"/>
</el-col>
<el-col :span="3">
<el-button :disabled="scenarioDefinition.length < 1" size="mini" type="primary" v-prevent-re-click @click="runDebug">{{$t('api_test.request.debug')}}</el-button>
@ -201,7 +203,11 @@
@closePage="close" @unFullScreen="unFullScreen" @showAllBtn="showAllBtn" @runDebug="runDebug" @setProjectEnvMap="setProjectEnvMap" @showScenarioParameters="showScenarioParameters" @setCookieShare="setCookieShare" ref="maximizeHeader"/>
</template>
<maximize-scenario :scenario-definition="scenarioDefinition" :envMap="projectEnvMap" :moduleOptions="moduleOptions" :currentScenario="currentScenario" :type="type" ref="maximizeScenario" @openScenario="openScenario"/>
<maximize-scenario :scenario-definition="scenarioDefinition" :envMap="projectEnvMap" :moduleOptions="moduleOptions"
:currentScenario="currentScenario" :type="type" ref="maximizeScenario" @openScenario="openScenario"
:isHaveExec.sync="isHaveExec" :isExecWithOutEnv.sync="isExecWithOutEnv" :projectList="projectList"
:projectIds.sync="projectIds"
/>
</ms-drawer>
</div>
@ -310,6 +316,8 @@
projectList: [],
debugResult: new Map,
drawer: false,
isHaveExec: false,
isExecWithOutEnv: true
}
},
created() {
@ -580,10 +588,27 @@
if (arr[i].type === ELEMENT_TYPE.LoopController && arr[i].loopType === "LOOP_COUNT" && arr[i].hashTree && arr[i].hashTree.length > 1) {
arr[i].countController.proceed = true;
}
let type = arr[i].type;
const canExec = this.checkCanExec(type);
if (!this.isHaveExec) {
//
this.isHaveExec = canExec;
}
if (canExec) {
const execWithOutEnv = this.canExecWithOutEnv(type, arr[i].url);
if (!execWithOutEnv) {
if (!arr[i].projectId) {
// IDIDIDID
arr[i].projectId = scenarioProjectId ? scenarioProjectId : this.projectId;
}
this.projectIds.add(arr[i].projectId);
}
}
if (this.isExecWithOutEnv) {
this.isExecWithOutEnv = this.canExecWithOutEnv(type, arr[i].url)
}
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
this.recursiveSorting(arr[i].hashTree, arr[i].projectId);
}
@ -593,7 +618,21 @@
}
}
},
canExecWithOutEnv(type, path) {
return type !== ELEMENT_TYPE.HTTPSamplerProxy ? !this.checkCanExec(type) : this.isHTTPFullPath(path);
},
isHTTPFullPath(path) {
return path ? path.startsWith("http://") || path.startsWith("https://") : false;
},
checkCanExec(type) {
const allCanExecType = ELEMENTS.get("AllCanExecType");
const index = allCanExecType.indexOf(type);
return index !== -1;
},
sort() {
this.projectIds.clear();
this.isHaveExec = false;
this.isExecWithOutEnv = true;
for (let i in this.scenarioDefinition) {
//
this.scenarioDefinition[i].index = Number(i) + 1;
@ -606,6 +645,23 @@
if (!this.scenarioDefinition[i].projectId) {
this.scenarioDefinition[i].projectId = this.projectId;
}
let type = this.scenarioDefinition[i].type;
const canExec = this.checkCanExec(type);
if (!this.isHaveExec) {
//
this.isHaveExec = canExec;
}
if (canExec) {
const execWithOutEnv = this.canExecWithOutEnv(type, this.scenarioDefinition[i].url);
if (!execWithOutEnv) {
this.projectIds.add(this.scenarioDefinition[i].projectId);
}
}
if (this.isExecWithOutEnv) {
this.isExecWithOutEnv = this.canExecWithOutEnv(type, this.scenarioDefinition[i].url)
}
if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) {
this.recursiveSorting(this.scenarioDefinition[i].hashTree, this.scenarioDefinition[i].projectId);
}
@ -626,7 +682,6 @@
this.customizeRequest = {};
this.sort();
this.reload();
this.initProjectIds();
},
addScenario(arr) {
if (arr && arr.length > 0) {
@ -649,7 +704,6 @@
this.isBtnHide = false;
this.sort();
this.reload();
this.initProjectIds();
},
setApiParameter(item, refType, referenced) {
let request = {};
@ -691,7 +745,6 @@
this.isBtnHide = false;
this.sort();
this.reload();
this.initProjectIds();
},
getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
@ -718,7 +771,6 @@
hashTree.splice(index, 1);
this.sort();
this.reload();
this.initProjectIds();
}
}
});
@ -749,10 +801,19 @@
},
runDebug() {
/*触发执行操作*/
if (!this.isHaveExec) {
this.$warning("无可执行步骤!");
return;
}
//
if (!this.isExecWithOutEnv) {
let sign = this.$refs.envPopover.checkEnv();
if (!sign) {
return;
}
}
this.$refs['currentScenario'].validate((valid) => {
if (valid) {
Promise.all([
@ -1000,7 +1061,6 @@
}
}
this.sort();
this.initProjectIds();
// this.getEnvironments();
})
}
@ -1071,19 +1131,8 @@
})
},
refReload() {
this.initProjectIds();
this.reload();
},
initProjectIds() {
//
this.$nextTick(() => {
this.projectIds.clear();
this.scenarioDefinition.forEach(data => {
let arr = jsonPath.query(data, "$..projectId");
arr.forEach(a => this.projectIds.add(a));
})
})
},
detailRefresh(result) {
//
this.debugResult = result;

View File

@ -3,6 +3,7 @@
v-model="visible"
placement="bottom"
width="400"
:disabled="isReadOnly"
@show="showPopover"
trigger="click">
<env-select :project-ids="projectIds" :env-map="envMap" @close="visible = false"
@ -24,6 +25,12 @@ export default {
envMap: Map,
projectIds: Set,
projectList: Array,
isReadOnly: {
type: Boolean,
default() {
return false;
}
}
},
data() {
return {

View File

@ -18,7 +18,7 @@ export const ELEMENTS = new Map([
['CustomizeReq', ["ConstantTimer", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
['MaxSamplerProxy', ["JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
['AllSamplerProxy', ["HTTPSamplerProxy", "DubboSampler", "JDBCSampler", "TCPSampler"]],
['AllCanExecType', ["HTTPSamplerProxy", "DubboSampler", "JDBCSampler", "TCPSampler", "JSR223Processor"]]
])
export const ELEMENT_TYPE = {

View File

@ -162,6 +162,7 @@
type: String,
scenarioDefinition: Array,
envMap: Map,
projectList: Array
},
components: {
MsVariableList,
@ -222,8 +223,10 @@
response: {},
projectIds: new Set,
projectEnvMap: new Map,
projectList: [],
// projectList: [],
debugResult: new Map,
isHaveExec: false,
isExecWithOutEnv: true
}
},
created() {
@ -496,9 +499,28 @@
if (arr[i].type === ELEMENT_TYPE.LoopController && arr[i].loopType === "LOOP_COUNT" && arr[i].hashTree && arr[i].hashTree.length > 1) {
arr[i].countController.proceed = true;
}
let type = arr[i].type;
const canExec = this.checkCanExec(type);
if (!this.isHaveExec) {
//
this.isHaveExec = canExec;
this.$emit("update:isHaveExec", canExec);
}
if (canExec) {
const execWithOutEnv = this.canExecWithOutEnv(type, arr[i].url);
if (!execWithOutEnv) {
if (!arr[i].projectId) {
// IDIDIDID
arr[i].projectId = scenarioProjectId ? scenarioProjectId : this.projectId;
}
this.projectIds.add(arr[i].projectId);
this.$emit('update:projectIds', this.projectIds);
}
}
if (this.isExecWithOutEnv) {
this.isExecWithOutEnv = this.canExecWithOutEnv(type, arr[i].url);
this.$emit('update:isExecWithOutEnv', this.canExecWithOutEnv(type, arr[i].url))
}
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
this.recursiveSorting(arr[i].hashTree, arr[i].projectId);
}
@ -508,7 +530,24 @@
}
}
},
canExecWithOutEnv(type, path) {
return type !== ELEMENT_TYPE.HTTPSamplerProxy ? !this.checkCanExec(type) : this.isHTTPFullPath(path);
},
isHTTPFullPath(path) {
return path ? path.startsWith("http://") || path.startsWith("https://") : false;
},
checkCanExec(type) {
const allCanExecType = ELEMENTS.get("AllCanExecType");
const index = allCanExecType.indexOf(type);
return index !== -1;
},
sort() {
this.projectIds.clear();
this.$emit('update:projectIds', this.projectIds);
this.isHaveExec = false;
this.isExecWithOutEnv = true;
this.$emit('update:isHaveExec', false);
this.$emit('update:isExecWithOutEnv', true);
for (let i in this.scenarioDefinition) {
//
this.scenarioDefinition[i].index = Number(i) + 1;
@ -521,6 +560,26 @@
if (!this.scenarioDefinition[i].projectId) {
this.scenarioDefinition[i].projectId = this.projectId;
}
let type = this.scenarioDefinition[i].type;
const canExec = this.checkCanExec(type);
if (!this.isHaveExec) {
//
this.isHaveExec = canExec;
this.$emit('update:isHaveExec', canExec);
}
if (canExec) {
const execWithOutEnv = this.canExecWithOutEnv(type, this.scenarioDefinition[i].url);
if (!execWithOutEnv) {
this.projectIds.add(this.scenarioDefinition[i].projectId);
this.$emit('update:projectIds', this.projectIds);
}
}
if (this.isExecWithOutEnv) {
this.isExecWithOutEnv = this.canExecWithOutEnv(type, this.scenarioDefinition[i].url);
this.$emit('update:isExecWithOutEnv', this.canExecWithOutEnv(type, this.scenarioDefinition[i].url));
}
if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) {
this.recursiveSorting(this.scenarioDefinition[i].hashTree, this.scenarioDefinition[i].projectId);
}
@ -541,7 +600,6 @@
this.customizeRequest = {};
this.sort();
this.reload();
this.initProjectIds();
},
addScenario(arr) {
if (arr && arr.length > 0) {
@ -559,7 +617,6 @@
}
this.sort();
this.reload();
this.initProjectIds();
this.scenarioVisible = false;
},
setApiParameter(item, refType, referenced) {
@ -601,7 +658,6 @@
});
this.sort();
this.reload();
this.initProjectIds();
},
openTagConfig() {
if (!this.projectId) {
@ -622,7 +678,6 @@
hashTree.splice(index, 1);
this.sort();
this.reload();
this.initProjectIds();
}
}
});
@ -919,19 +974,8 @@
refReload(data, node) {
this.selectedTreeNode = data;
this.selectedNode = node;
this.initProjectIds();
this.reload();
},
initProjectIds() {
//
this.$nextTick(() => {
this.projectIds.clear();
this.scenarioDefinition.forEach(data => {
let arr = jsonPath.query(data, "$..projectId");
arr.forEach(a => this.projectIds.add(a));
})
})
},
detailRefresh(result) {
//
this.debugResult = result;

View File

@ -19,6 +19,8 @@
<el-checkbox v-model="cookieShare" @change="setCookieShare" style="margin-right: 20px">共享cookie</el-checkbox>
<env-popover :env-map="envMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
:disabled="scenarioDefinition.length < 1"
:is-read-only="scenarioDefinition.length < 1"
:project-list="projectList" ref="envPopover" class="ms-right"/>
<el-button :disabled="scenarioDefinition.length < 1" size="mini" type="primary" v-prevent-re-click @click="runDebug">{{$t('api_test.request.debug')}}</el-button>

View File

@ -353,7 +353,10 @@ export default {
}
})
if (this.$refs.caseTable) {
setTimeout(this.$refs.caseTable.doLayout, 200)
setTimeout(() => {
this.$refs.caseTable.doLayout();
this.result.loading = false;
}, 500)
}
this.$nextTick(function(){
this.checkTableRowIsSelect();

View File

@ -465,7 +465,10 @@
}
})
if (this.$refs.apiDefinitionTable) {
setTimeout(this.$refs.apiDefinitionTable.doLayout, 200)
setTimeout(() => {
this.$refs.apiDefinitionTable.doLayout();
this.result.loading = false;
}, 500)
}
// nexttick:
this.$nextTick(function(){

View File

@ -393,7 +393,10 @@ export default {
item.tags = JSON.parse(item.tags);
})
if (this.$refs.table) {
setTimeout(this.$refs.table.doLayout, 200)
setTimeout(() => {
this.$refs.table.doLayout();
this.result.loading = false;
}, 500)
}
this.$nextTick(function(){

View File

@ -476,7 +476,10 @@ export default {
}
this.selectRows.clear();
if (this.$refs.table) {
setTimeout(this.$refs.table.doLayout, 200)
setTimeout(() => {
this.$refs.table.doLayout();
this.result.loading = false;
}, 500)
}
});
}