Merge branch 'master' of github.com:metersphere/metersphere
This commit is contained in:
commit
5ec898a4fb
|
@ -52,6 +52,9 @@ public class MsDubboSampler extends MsTestElement {
|
||||||
@JSONField(ordinal = 59)
|
@JSONField(ordinal = 59)
|
||||||
private List<KeyValue> attachmentArgs;
|
private List<KeyValue> attachmentArgs;
|
||||||
|
|
||||||
|
@JSONField(ordinal = 60)
|
||||||
|
private String useEnvironment;
|
||||||
|
|
||||||
// @JSONField(ordinal = 60)
|
// @JSONField(ordinal = 60)
|
||||||
// private Object requestResult;
|
// private Object requestResult;
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,9 @@ public class MsJDBCSampler extends MsTestElement {
|
||||||
@JSONField(ordinal = 29)
|
@JSONField(ordinal = 29)
|
||||||
private String protocol = "SQL";
|
private String protocol = "SQL";
|
||||||
|
|
||||||
|
@JSONField(ordinal = 30)
|
||||||
|
private String useEnvironment;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||||
if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) {
|
if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class TestCaseExcelDataCn extends TestCaseExcelData {
|
||||||
|
|
||||||
@ColumnWidth(50)
|
@ColumnWidth(50)
|
||||||
@ExcelProperty("前置条件")
|
@ExcelProperty("前置条件")
|
||||||
@Length(min = 0, max = 1000)
|
@Length(min = 0, max = 500)
|
||||||
private String prerequisite;
|
private String prerequisite;
|
||||||
|
|
||||||
@ColumnWidth(50)
|
@ColumnWidth(50)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
<!--操作按钮-->
|
<!--操作按钮-->
|
||||||
<div class="ms-opt-btn">
|
<div class="ms-opt-btn">
|
||||||
<el-button id="inputDelay" type="primary" size="small" @click="editScenario" title="ctrl + s">
|
<el-button id="inputDelay" type="primary" size="small" v-prevent-re-click @click="editScenario" title="ctrl + s">
|
||||||
{{ $t('commons.save') }}
|
{{ $t('commons.save') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
:project-list="projectList" ref="envPopover"/>
|
:project-list="projectList" ref="envPopover"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="2">
|
<el-col :span="2">
|
||||||
<el-button :disabled="scenarioDefinition.length < 1" size="small" type="primary" @click="runDebug">{{$t('api_test.request.debug')}}</el-button>
|
<el-button :disabled="scenarioDefinition.length < 1" size="small" type="primary" v-prevent-re-click @click="runDebug">{{$t('api_test.request.debug')}}</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
@ -707,17 +707,15 @@
|
||||||
},
|
},
|
||||||
runDebug() {
|
runDebug() {
|
||||||
/*触发执行操作*/
|
/*触发执行操作*/
|
||||||
// if (!this.currentEnvironmentId) {
|
|
||||||
// this.$error(this.$t('api_test.environment.select_environment'));
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
let sign = this.$refs.envPopover.checkEnv();
|
let sign = this.$refs.envPopover.checkEnv();
|
||||||
if (!sign) {
|
if (!sign) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$refs['currentScenario'].validate((valid) => {
|
this.$refs['currentScenario'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.editScenario();
|
Promise.all([
|
||||||
|
this.editScenario()]).then(val => {
|
||||||
|
if (val) {
|
||||||
this.debugData = {
|
this.debugData = {
|
||||||
id: this.currentScenario.id,
|
id: this.currentScenario.id,
|
||||||
name: this.currentScenario.name,
|
name: this.currentScenario.name,
|
||||||
|
@ -731,6 +729,8 @@
|
||||||
};
|
};
|
||||||
this.reportId = getUUID().substring(0, 8);
|
this.reportId = getUUID().substring(0, 8);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getEnvironments() {
|
getEnvironments() {
|
||||||
|
@ -884,6 +884,7 @@
|
||||||
return bodyUploadFiles;
|
return bodyUploadFiles;
|
||||||
},
|
},
|
||||||
editScenario() {
|
editScenario() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
document.getElementById("inputDelay").focus(); // 保存前在input框自动失焦,以免保存失败
|
document.getElementById("inputDelay").focus(); // 保存前在input框自动失焦,以免保存失败
|
||||||
this.$refs['currentScenario'].validate((valid) => {
|
this.$refs['currentScenario'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
@ -899,9 +900,11 @@
|
||||||
this.currentScenario.tags = JSON.parse(this.currentScenario.tags);
|
this.currentScenario.tags = JSON.parse(this.currentScenario.tags);
|
||||||
}
|
}
|
||||||
this.$emit('refresh', this.currentScenario);
|
this.$emit('refresh', this.currentScenario);
|
||||||
|
resolve();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
});
|
||||||
},
|
},
|
||||||
getApiScenario() {
|
getApiScenario() {
|
||||||
if (this.currentScenario.tags != undefined && !(this.currentScenario.tags instanceof Array)) {
|
if (this.currentScenario.tags != undefined && !(this.currentScenario.tags instanceof Array)) {
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
<ms-environment-select
|
<ms-environment-select
|
||||||
:project-id="projectId"
|
:project-id="projectId"
|
||||||
:is-read-only="isReadOnly"
|
:is-read-only="isReadOnly"
|
||||||
|
:useEnvironment='useEnvironment'
|
||||||
@setEnvironment="setEnvironment"/>
|
@setEnvironment="setEnvironment"/>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -65,7 +66,6 @@
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import ApiEnvironmentConfig from "../../../test/components/ApiEnvironmentConfig";
|
import ApiEnvironmentConfig from "../../../test/components/ApiEnvironmentConfig";
|
||||||
import {parseEnvironment} from "../../../test/model/EnvironmentModel";
|
|
||||||
import MsTag from "../../../../common/components/MsTag";
|
import MsTag from "../../../../common/components/MsTag";
|
||||||
import MsEnvironmentSelect from "./MsEnvironmentSelect";
|
import MsEnvironmentSelect from "./MsEnvironmentSelect";
|
||||||
import {API_METHOD_COLOUR} from "../../model/JsonData";
|
import {API_METHOD_COLOUR} from "../../model/JsonData";
|
||||||
|
@ -76,8 +76,6 @@
|
||||||
components: {MsEnvironmentSelect, MsTag, ApiEnvironmentConfig, MsTableAdvSearchBar},
|
components: {MsEnvironmentSelect, MsTag, ApiEnvironmentConfig, MsTableAdvSearchBar},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
environments: [],
|
|
||||||
environment: {},
|
|
||||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||||
isSelectAll: false
|
isSelectAll: false
|
||||||
}
|
}
|
||||||
|
@ -88,6 +86,7 @@
|
||||||
priorities: Array,
|
priorities: Array,
|
||||||
apiCaseList: Array,
|
apiCaseList: Array,
|
||||||
isReadOnly: Boolean,
|
isReadOnly: Boolean,
|
||||||
|
useEnvironment: String,
|
||||||
isCaseEdit: Boolean,
|
isCaseEdit: Boolean,
|
||||||
condition: {
|
condition: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -97,50 +96,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.environment = undefined;
|
|
||||||
this.getEnvironments();
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
environment() {
|
|
||||||
this.$emit('setEnvironment', this.environment);
|
|
||||||
},
|
|
||||||
isSelectAll() {
|
isSelectAll() {
|
||||||
this.$emit('selectAll', this.isSelectAll);
|
this.$emit('selectAll', this.isSelectAll);
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getEnvironments() {
|
|
||||||
if (this.projectId) {
|
|
||||||
this.$get('/api/environment/list/' + this.projectId, response => {
|
|
||||||
this.environments = response.data;
|
|
||||||
this.environments.forEach(environment => {
|
|
||||||
parseEnvironment(environment);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.environment = undefined;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
openEnvironmentConfig() {
|
|
||||||
if (!this.projectId) {
|
|
||||||
this.$error(this.$t('api_test.select_project'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.$refs.environmentConfig.open(this.projectId);
|
|
||||||
},
|
|
||||||
environmentChange(value) {
|
|
||||||
for (let i in this.environments) {
|
|
||||||
if (this.environments[i].id === value) {
|
|
||||||
this.environment = this.environments[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
environmentConfigClose() {
|
|
||||||
this.getEnvironments();
|
|
||||||
},
|
|
||||||
setEnvironment(data) {
|
setEnvironment(data) {
|
||||||
this.$emit('setEnvironment', data);
|
this.$emit('setEnvironment', data.id);
|
||||||
},
|
},
|
||||||
search() {
|
search() {
|
||||||
if (this.priorities && this.condition.order) {
|
if (this.priorities && this.condition.order) {
|
||||||
|
|
|
@ -169,7 +169,7 @@
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
environment: {},
|
environment: String,
|
||||||
index: {
|
index: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default() {
|
default() {
|
||||||
|
@ -207,7 +207,12 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
singleRun(data) {
|
singleRun(data) {
|
||||||
|
if (!this.environment) {
|
||||||
|
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
data.message = true;
|
data.message = true;
|
||||||
|
data.request.useEnvironment = this.environment;
|
||||||
this.saveTestCase(data);
|
this.saveTestCase(data);
|
||||||
this.$emit('singleRun', data);
|
this.$emit('singleRun', data);
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
:apiCaseList="apiCaseList"
|
:apiCaseList="apiCaseList"
|
||||||
:is-read-only="isReadOnly"
|
:is-read-only="isReadOnly"
|
||||||
:project-id="projectId"
|
:project-id="projectId"
|
||||||
|
:useEnvironment="useEnvironment"
|
||||||
:is-case-edit="isCaseEdit"
|
:is-case-edit="isCaseEdit"
|
||||||
ref="header"
|
ref="header"
|
||||||
/>
|
/>
|
||||||
|
@ -38,7 +39,7 @@
|
||||||
</ms-drawer>
|
</ms-drawer>
|
||||||
|
|
||||||
<!-- 执行组件 -->
|
<!-- 执行组件 -->
|
||||||
<ms-run :debug="false" :environment="environment" :reportId="reportId" :run-data="runData" :env-map="envMap"
|
<ms-run :debug="false" :reportId="reportId" :run-data="runData" :env-map="envMap"
|
||||||
@runRefresh="runRefresh" ref="runTest"/>
|
@runRefresh="runRefresh" ref="runTest"/>
|
||||||
<!--批量编辑-->
|
<!--批量编辑-->
|
||||||
<ms-batch-edit ref="batchEdit" @batchEdit="batchEdit" :typeArr="typeArr" :value-arr="valueArr"/>
|
<ms-batch-edit ref="batchEdit" @batchEdit="batchEdit" :typeArr="typeArr" :value-arr="valueArr"/>
|
||||||
|
@ -77,7 +78,7 @@
|
||||||
return {
|
return {
|
||||||
result: {},
|
result: {},
|
||||||
grades: [],
|
grades: [],
|
||||||
environment: {},
|
environment: "",
|
||||||
isReadOnly: false,
|
isReadOnly: false,
|
||||||
selectedEvent: Object,
|
selectedEvent: Object,
|
||||||
priorities: CASE_ORDER,
|
priorities: CASE_ORDER,
|
||||||
|
@ -111,7 +112,8 @@
|
||||||
priority: CASE_PRIORITY,
|
priority: CASE_PRIORITY,
|
||||||
method: REQ_METHOD,
|
method: REQ_METHOD,
|
||||||
},
|
},
|
||||||
envMap: new Map
|
envMap: new Map,
|
||||||
|
useEnvironment: "",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -190,8 +192,13 @@
|
||||||
this.$set(item, 'selected', false);
|
this.$set(item, 'selected', false);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.$success(this.$t('organization.integration.successful_operation'));
|
// 更新最后一条的环境
|
||||||
|
let cases = this.apiCaseList[0];
|
||||||
|
cases.request.useEnvironment = this.environment;
|
||||||
|
cases.message = true;
|
||||||
|
this.$refs.apiCaseItem[0].saveCase(cases);
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
this.$success(this.$t('organization.integration.successful_operation'));
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
|
@ -204,6 +211,7 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getApiTest(addCase) {
|
getApiTest(addCase) {
|
||||||
|
this.useEnvironment = "";
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
this.condition.projectId = this.projectId;
|
this.condition.projectId = this.projectId;
|
||||||
if (this.isCaseEdit) {
|
if (this.isCaseEdit) {
|
||||||
|
@ -226,7 +234,12 @@
|
||||||
if (!apiCase.request.hashTree) {
|
if (!apiCase.request.hashTree) {
|
||||||
apiCase.request.hashTree = [];
|
apiCase.request.hashTree = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
if (!this.useEnvironment && this.apiCaseList[0].request && this.apiCaseList[0].request.useEnvironment) {
|
||||||
|
this.useEnvironment = this.apiCaseList[0].request.useEnvironment;
|
||||||
|
this.environment = this.useEnvironment;
|
||||||
|
}
|
||||||
if (addCase && this.apiCaseList.length == 0 && !this.loaded) {
|
if (addCase && this.apiCaseList.length == 0 && !this.loaded) {
|
||||||
this.addCase();
|
this.addCase();
|
||||||
}
|
}
|
||||||
|
@ -264,7 +277,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
singleRun(row) {
|
singleRun(row) {
|
||||||
if (!this.environment || !this.environment) {
|
if (!this.environment) {
|
||||||
this.$warning(this.$t('api_test.environment.select_environment'));
|
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -274,7 +287,7 @@
|
||||||
row.request.name = row.id;
|
row.request.name = row.id;
|
||||||
this.$get('/api/definition/get/' + row.request.id, response => {
|
this.$get('/api/definition/get/' + row.request.id, response => {
|
||||||
row.request.path = response.data.path; // 取的path是对应接口的path,因此查库以获得
|
row.request.path = response.data.path; // 取的path是对应接口的path,因此查库以获得
|
||||||
row.request.useEnvironment = this.environment.id;
|
row.request.useEnvironment = this.environment;
|
||||||
row.request.projectId = getCurrentProjectID();
|
row.request.projectId = getCurrentProjectID();
|
||||||
this.runData.push(row.request);
|
this.runData.push(row.request);
|
||||||
/*触发执行操作*/
|
/*触发执行操作*/
|
||||||
|
@ -293,7 +306,7 @@
|
||||||
this.apiCaseList.forEach(item => {
|
this.apiCaseList.forEach(item => {
|
||||||
if (item.selected && item.id) {
|
if (item.selected && item.id) {
|
||||||
item.request.name = item.id;
|
item.request.name = item.id;
|
||||||
item.request.useEnvironment = this.environment.id;
|
item.request.useEnvironment = this.environment;
|
||||||
this.runData.push(item.request);
|
this.runData.push(item.request);
|
||||||
this.batchLoadingIds.push(item.id);
|
this.batchLoadingIds.push(item.id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
environmentId: ""
|
environmentId: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props:['projectId','isReadOnly'],
|
props:['projectId','isReadOnly','useEnvironment'],
|
||||||
created() {
|
created() {
|
||||||
this.getEnvironments();
|
this.getEnvironments();
|
||||||
},
|
},
|
||||||
|
@ -49,6 +49,9 @@
|
||||||
environmentId() {
|
environmentId() {
|
||||||
this.environmentChange(this.environmentId);
|
this.environmentChange(this.environmentId);
|
||||||
},
|
},
|
||||||
|
useEnvironment(){
|
||||||
|
this.environmentId = this.useEnvironment;
|
||||||
|
}
|
||||||
// planEnvironmentId() {
|
// planEnvironmentId() {
|
||||||
// this.environmentId = this.planEnvironmentId;
|
// this.environmentId = this.planEnvironmentId;
|
||||||
// }
|
// }
|
||||||
|
@ -60,9 +63,9 @@
|
||||||
this.environments = response.data;
|
this.environments = response.data;
|
||||||
this.environments.forEach(environment => {
|
this.environments.forEach(environment => {
|
||||||
parseEnvironment(environment);
|
parseEnvironment(environment);
|
||||||
// if (this.planEnvironmentId && environment.id === this.planEnvironmentId) {
|
if (this.useEnvironment && this.useEnvironment.id === environment.id) {
|
||||||
// this.planEnvironmentId = environment.id;
|
this.environmentId = this.useEnvironment;
|
||||||
// }
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -373,7 +373,7 @@ export default {
|
||||||
testId: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}],
|
testId: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}],
|
||||||
method: [{required: true, message: this.$t('test_track.case.input_method'), trigger: 'change'}],
|
method: [{required: true, message: this.$t('test_track.case.input_method'), trigger: 'change'}],
|
||||||
prerequisite: [{max: 500, message: this.$t('test_track.length_less_than') + '500', trigger: 'blur'}],
|
prerequisite: [{max: 500, message: this.$t('test_track.length_less_than') + '500', trigger: 'blur'}],
|
||||||
remark: [{max: 500, message: this.$t('test_track.length_less_than') + '500', trigger: 'blur'}]
|
remark: [{max: 1000, message: this.$t('test_track.length_less_than') + '1000', trigger: 'blur'}]
|
||||||
},
|
},
|
||||||
formLabelWidth: "120px",
|
formLabelWidth: "120px",
|
||||||
operationType: '',
|
operationType: '',
|
||||||
|
@ -767,7 +767,7 @@ export default {
|
||||||
this.getModuleOptions();
|
this.getModuleOptions();
|
||||||
this.getMaintainerOptions();
|
this.getMaintainerOptions();
|
||||||
this.getTestOptions();
|
this.getTestOptions();
|
||||||
this.getDemandOptions()
|
// this.getDemandOptions()
|
||||||
},
|
},
|
||||||
|
|
||||||
resetForm() {
|
resetForm() {
|
||||||
|
|
|
@ -59,6 +59,19 @@ Vue.directive('tester', tester);
|
||||||
Vue.directive('left-to-right-drag', left2RightDrag);
|
Vue.directive('left-to-right-drag', left2RightDrag);
|
||||||
Vue.directive('right-to-left-drag', right2LeftDrag);
|
Vue.directive('right-to-left-drag', right2LeftDrag);
|
||||||
Vue.directive('bottom-to-top-drag', bottom2TopDrag);
|
Vue.directive('bottom-to-top-drag', bottom2TopDrag);
|
||||||
|
// 防止重复点击
|
||||||
|
Vue.directive('preventReClick', {
|
||||||
|
inserted(el, binding) {
|
||||||
|
el.addEventListener('click', () => {
|
||||||
|
if (!el.disabled) {
|
||||||
|
el.disabled = true
|
||||||
|
setTimeout(() => {
|
||||||
|
el.disabled = false
|
||||||
|
}, binding.value || 2000)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
new Vue({
|
new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
|
|
Loading…
Reference in New Issue