feat(接口测试): 场景自动化定时任务增加运行环境校验
--story=1006599 --user=王孝刚 【接口测试】场景自动化定时任务增加运行环境校验 https://www.tapd.cn/55049933/s/1127056
This commit is contained in:
parent
2d70165fcd
commit
fb5b0d9559
|
@ -149,7 +149,7 @@ public class ApiScenarioExecuteService {
|
|||
|
||||
String reportScenarioIds = JSON.toJSONString(CollectionUtils.isNotEmpty(scenarioIds) && scenarioIds.size() > 50 ? scenarioIds.subList(0, 50) : scenarioIds);
|
||||
APIScenarioReportResult report = apiScenarioReportService.init(request.getConfig().getReportId(), reportScenarioIds,
|
||||
scenarioNames.toString(), ReportTriggerMode.MANUAL.name(), ExecuteType.Saved.name(), request.getProjectId(),
|
||||
scenarioNames.toString(), request.getTriggerMode(), ExecuteType.Saved.name(), request.getProjectId(),
|
||||
request.getReportUserID(), request.getConfig());
|
||||
|
||||
report.setVersionId(apiScenarios.get(0).getVersionId());
|
||||
|
|
|
@ -98,7 +98,7 @@ public class ApiScenarioSerialService {
|
|||
if (StringUtils.equalsAny(executionQueue.getRunMode(), ApiRunMode.SCENARIO.name(), ApiRunMode.SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO.name(), ApiRunMode.JENKINS_SCENARIO_PLAN.name())) {
|
||||
ApiScenarioWithBLOBs scenario = null;
|
||||
Map<String, String> planEnvMap = new LinkedHashMap<>();
|
||||
if (StringUtils.equalsAny(executionQueue.getRunMode(), ApiRunMode.SCENARIO.name())) {
|
||||
if (StringUtils.equalsAny(executionQueue.getRunMode(), ApiRunMode.SCENARIO.name(), ApiRunMode.SCHEDULE_SCENARIO.name())) {
|
||||
scenario = apiScenarioMapper.selectByPrimaryKey(queue.getTestId());
|
||||
} else {
|
||||
TestPlanApiScenario planApiScenario = testPlanApiScenarioMapper.selectByPrimaryKey(queue.getTestId());
|
||||
|
|
|
@ -286,7 +286,7 @@ public class ScheduleManager {
|
|||
jobDataMap.put("expression", expression);
|
||||
jobDataMap.put("userId", userId);
|
||||
jobDataMap.put("config", schedule.getConfig());
|
||||
|
||||
jobDataMap.put("projectId", schedule.getProjectId());
|
||||
return jobDataMap;
|
||||
}
|
||||
|
||||
|
|
|
@ -252,7 +252,8 @@
|
|||
|
||||
<template v-slot:opt-behind="scope">
|
||||
<ms-scenario-extend-buttons v-if="!trashEnable" style="display: contents" @openScenario="openScenario"
|
||||
:row="scope.row"/>
|
||||
:request="runRequest"
|
||||
:row="scope.row" @openSchedule="openSchedule(scope.row)"/>
|
||||
</template>
|
||||
|
||||
</ms-table>
|
||||
|
@ -916,6 +917,14 @@ export default {
|
|||
this.$refs.runMode.open();
|
||||
|
||||
},
|
||||
openSchedule(row) {
|
||||
let run = {};
|
||||
run.id = getUUID();
|
||||
run.ids = [row.id];
|
||||
run.projectId = this.projectId;
|
||||
run.condition = this.condition;
|
||||
this.runRequest = run;
|
||||
},
|
||||
orderBySelectRows() {
|
||||
let selectIds = this.$refs.scenarioTable.selectIds;
|
||||
let array = [];
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<template>
|
||||
<div>
|
||||
<div style="margin-left: 20px;">
|
||||
<el-select v-model="envGroupId" :placeholder="$t('workspace.env_group.select')" style="margin-top: 8px;width: 200px;" size="small">
|
||||
<el-select v-model="envGroupId" :placeholder="$t('workspace.env_group.select')"
|
||||
style="margin-top: 8px;width: 200px;" size="small" clearable>
|
||||
<el-option-group
|
||||
v-for="group in groups"
|
||||
:key="group.label"
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
:project-ids="projectIds"
|
||||
@setEnvGroup="setEnvGroup" :group-id="groupId"></env-group>
|
||||
<!-- 对环境组选项进行分类 可用|不可用 -->
|
||||
<env-group-with-option ref="envOptionGroup" v-show="radio === ENV_TYPE.GROUP && hasOptionGroup" @close="visible = false"
|
||||
<env-group-with-option ref="envOptionGroup" v-show="radio === ENV_TYPE.GROUP && hasOptionGroup"
|
||||
@close="visible = false"
|
||||
:project-ids="projectIds"
|
||||
@setEnvGroup="setEnvGroup" :group-id="groupId"></env-group-with-option>
|
||||
<el-button type="primary" slot="reference" size="mini" style="margin-top: 2px;">
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<ms-reference-view @openScenario="openScenario" ref="viewRef"/>
|
||||
<ms-schedule-maintain ref="scheduleMaintain" @refreshTable="refreshTable"/>
|
||||
<ms-schedule-maintain ref="scheduleMaintain" @refreshTable="refreshTable" :request="request"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
@ -30,7 +30,8 @@ export default {
|
|||
name: "MsScenarioExtendButtons",
|
||||
components: {MsReferenceView, MsScheduleMaintain},
|
||||
props: {
|
||||
row: Object
|
||||
row: Object,
|
||||
request: {}
|
||||
},
|
||||
methods: {
|
||||
handleCommand(cmd) {
|
||||
|
@ -39,6 +40,7 @@ export default {
|
|||
this.$refs.viewRef.open(this.row);
|
||||
break;
|
||||
case "schedule":
|
||||
this.$emit('openSchedule');
|
||||
this.$refs.scheduleMaintain.open(this.row);
|
||||
break;
|
||||
case "create_performance":
|
||||
|
@ -78,7 +80,7 @@ export default {
|
|||
},
|
||||
refreshTable() {
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -5,41 +5,113 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-tabs v-model="activeName">
|
||||
<el-tab-pane :label="$t('schedule.edit_timer_task')" name="first">
|
||||
<el-tab-pane :label="$t('schedule.task_config')" name="first">
|
||||
<div class="el-step__icon is-text" style="margin-right: 10px;">
|
||||
<div class="el-step__icon-inner">1</div>
|
||||
</div>
|
||||
<span>{{ $t('schedule.edit_timer_task') }}</span>
|
||||
<el-form :model="form" :rules="rules" ref="from" style="margin-top: 10px;">
|
||||
<el-form-item :label="$t('commons.schedule_switch')">
|
||||
|
||||
<el-form-item :label="$t('commons.schedule_cron_title')"
|
||||
prop="cronValue">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="18">
|
||||
<el-col :span="16">
|
||||
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
|
||||
:placeholder="$t('schedule.please_input_cron_expression')" size="mini">
|
||||
<a :disabled="isReadOnly" @click="showCronDialog" slot="suffix" class="head">
|
||||
{{ $t('schedule.generate_expression') }}
|
||||
</a>
|
||||
</el-input>
|
||||
|
||||
<span>{{ this.$t('commons.schedule_switch') }}</span>
|
||||
<el-tooltip effect="dark" placement="bottom"
|
||||
:content="schedule.enable ? $t('commons.close_schedule') : $t('commons.open_schedule')">
|
||||
<el-switch v-model="schedule.enable"></el-switch>
|
||||
<el-switch v-model="schedule.enable" style="margin-left: 20px"></el-switch>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button :disabled="isReadOnly" type="primary" @click="saveCron">{{
|
||||
<el-col :span="4">
|
||||
<el-button :disabled="isReadOnly" type="primary" @click="saveCron" size="mini">{{
|
||||
$t('commons.save')
|
||||
}}
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.schedule_cron_title')"
|
||||
prop="cronValue">
|
||||
<el-row>
|
||||
<el-col :span="18">
|
||||
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
|
||||
:placeholder="$t('schedule.please_input_cron_expression')"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-link :disabled="isReadOnly" type="primary" @click="showCronDialog">
|
||||
{{ $t('schedule.generate_expression') }}
|
||||
</el-link>
|
||||
</el-form-item>
|
||||
<crontab-result :ex="form.cronValue" ref="crontabResult"/>
|
||||
</el-form>
|
||||
<div class="el-step__icon is-text" style="margin-right: 10px;">
|
||||
<div class="el-step__icon-inner">2</div>
|
||||
</div>
|
||||
<span>{{ $t('load_test.runtime_config') }}</span>
|
||||
<div style="padding-top: 10px;">
|
||||
<span class="ms-mode-span">{{ $t("commons.environment") }}:</span>
|
||||
<env-popover :project-ids="projectIds"
|
||||
:placement="'bottom-start'"
|
||||
:project-list="projectList"
|
||||
:env-map="runConfig.envMap"
|
||||
:environment-type.sync="runConfig.environmentType"
|
||||
:group-id="runConfig.environmentGroupId"
|
||||
:has-option-group="true"
|
||||
@setEnvGroup="setEnvGroup"
|
||||
@setProjectEnvMap="setProjectEnvMap"
|
||||
@showPopover="showPopover"
|
||||
ref="envPopover" class="env-popover"/>
|
||||
</div>
|
||||
<div style="padding-top: 10px;">
|
||||
<span class="ms-mode-span">{{ $t("run_mode.title") }}:</span>
|
||||
<el-radio-group v-model="runConfig.mode" @change="changeMode">
|
||||
<el-radio label="serial">{{ $t("run_mode.serial") }}</el-radio>
|
||||
<el-radio label="parallel">{{ $t("run_mode.parallel") }}</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div class="ms-mode-div">
|
||||
<el-row>
|
||||
<el-col :span="3">
|
||||
<span class="ms-mode-span">{{ $t("run_mode.other_config") }}:</span>
|
||||
</el-col>
|
||||
<el-col :span="18">
|
||||
<div>
|
||||
<el-radio-group v-model="runConfig.reportType">
|
||||
<el-radio label="iddReport">{{ $t("run_mode.idd_report") }}</el-radio>
|
||||
<el-radio label="setReport">{{ $t("run_mode.set_report") }}</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div style="padding-top: 10px">
|
||||
<el-checkbox v-model="runConfig.runWithinResourcePool" style="padding-right: 10px;">
|
||||
{{ $t('run_mode.run_with_resource_pool') }}
|
||||
</el-checkbox>
|
||||
<el-select :disabled="!runConfig.runWithinResourcePool" v-model="runConfig.resourcePoolId"
|
||||
size="mini">
|
||||
<el-option
|
||||
v-for="item in resourcePools"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:disabled="!item.api"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<!--- 失败停止 -->
|
||||
<div style="margin-top: 10px" v-if="runConfig.mode === 'serial'">
|
||||
<el-checkbox v-model="runConfig.onSampleError">
|
||||
{{ $t("api_test.fail_to_stop") }}
|
||||
</el-checkbox>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="ms-mode-div" v-if="runConfig.reportType === 'setReport'">
|
||||
<span class="ms-mode-span-label">{{ $t("run_mode.report_name") }}:</span>
|
||||
<el-input
|
||||
v-model="runConfig.reportName"
|
||||
:placeholder="$t('commons.input_content')"
|
||||
size="small"
|
||||
style="width: 300px"/>
|
||||
</div>
|
||||
|
||||
<el-dialog width="60%" :title="$t('schedule.generate_expression')" :visible.sync="showCron"
|
||||
:modal="false">
|
||||
<crontab @hide="showCron=false" @fill="crontabFill" :expression="schedule.value"
|
||||
|
@ -60,14 +132,16 @@
|
|||
import {
|
||||
getCurrentProjectID,
|
||||
getCurrentUser, getCurrentWorkspaceId,
|
||||
listenGoBack,
|
||||
removeGoBackListener
|
||||
listenGoBack, objToStrMap,
|
||||
removeGoBackListener, strMapToObj
|
||||
} from "@/common/js/utils";
|
||||
import Crontab from "@/business/components/common/cron/Crontab";
|
||||
import CrontabResult from "@/business/components/common/cron/CrontabResult";
|
||||
import {cronValidate} from "@/common/js/cron";
|
||||
import MsScheduleNotification from "./ScheduleNotification";
|
||||
import ScheduleSwitch from "@/business/components/api/automation/schedule/ScheduleSwitch";
|
||||
import {ENV_TYPE} from "@/common/js/constants";
|
||||
import EnvPopover from "@/business/components/api/automation/scenario/EnvPopover";
|
||||
|
||||
function defaultCustomValidate() {
|
||||
return {pass: true};
|
||||
|
@ -84,7 +158,8 @@ export default {
|
|||
ScheduleSwitch,
|
||||
Crontab,
|
||||
MsScheduleNotification,
|
||||
"NoticeTemplate": noticeTemplate.default
|
||||
"NoticeTemplate": noticeTemplate.default,
|
||||
EnvPopover
|
||||
},
|
||||
|
||||
props: {
|
||||
|
@ -96,12 +171,18 @@ export default {
|
|||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
request: {}
|
||||
},
|
||||
|
||||
|
||||
watch: {
|
||||
'schedule.value'() {
|
||||
this.form.cronValue = this.schedule.value;
|
||||
},
|
||||
'runConfig.runWithinResourcePool'() {
|
||||
if (!this.runConfig.runWithinResourcePool) {
|
||||
this.runConfig.resourcePoolId = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -135,13 +216,63 @@ export default {
|
|||
activeName: 'first',
|
||||
rules: {
|
||||
cronValue: [{required: true, validator: validateCron, trigger: 'blur'}],
|
||||
}
|
||||
},
|
||||
resourcePools: [],
|
||||
runConfig: {
|
||||
reportName: "",
|
||||
mode: "serial",
|
||||
reportType: "iddReport",
|
||||
onSampleError: false,
|
||||
runWithinResourcePool: false,
|
||||
resourcePoolId: null,
|
||||
envMap: new Map,
|
||||
environmentGroupId: "",
|
||||
environmentType: ENV_TYPE.JSON
|
||||
},
|
||||
projectList: [],
|
||||
projectIds: new Set(),
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
currentUser: () => {
|
||||
return getCurrentUser();
|
||||
},
|
||||
changeMode() {
|
||||
this.runConfig.runWithinResourcePool = false;
|
||||
this.runConfig.resourcePoolId = null;
|
||||
this.runConfig.reportType = "iddReport";
|
||||
this.runConfig.reportName = "";
|
||||
},
|
||||
setEnvGroup(id) {
|
||||
this.runConfig.environmentGroupId = id;
|
||||
},
|
||||
setProjectEnvMap(projectEnvMap) {
|
||||
this.runConfig.envMap = strMapToObj(projectEnvMap);
|
||||
},
|
||||
showPopover() {
|
||||
this.projectIds.clear();
|
||||
let url = "/api/automation/env";
|
||||
|
||||
this.$post(url, this.request, res => {
|
||||
let data = res.data;
|
||||
if (data) {
|
||||
for (let d in data) {
|
||||
this.projectIds.add(data[d]);
|
||||
}
|
||||
}
|
||||
this.$refs.envPopover.openEnvSelect();
|
||||
});
|
||||
},
|
||||
getWsProjects() {
|
||||
this.$get("/project/getOwnerProjects", res => {
|
||||
this.projectList = res.data;
|
||||
})
|
||||
},
|
||||
getResourcePools() {
|
||||
this.result = this.$get('/testresourcepool/list/quota/valid', response => {
|
||||
this.resourcePools = response.data;
|
||||
});
|
||||
},
|
||||
scheduleChange() {
|
||||
let flag = this.schedule.enable;
|
||||
let param = {};
|
||||
|
@ -217,6 +348,9 @@ export default {
|
|||
this.form.cronValue = this.schedule.value;
|
||||
listenGoBack(this.close);
|
||||
this.activeName = 'first';
|
||||
this.getResourcePools();
|
||||
this.getWsProjects();
|
||||
this.runConfig.environmentType = ENV_TYPE.JSON;
|
||||
},
|
||||
findSchedule() {
|
||||
let scheduleResourceID = this.testId;
|
||||
|
@ -224,6 +358,12 @@ export default {
|
|||
this.result = this.$get("/schedule/findOne/" + scheduleResourceID + "/" + taskType, response => {
|
||||
if (response.data != null) {
|
||||
this.schedule = response.data;
|
||||
if (response.data.config) {
|
||||
this.runConfig = JSON.parse(response.data.config);
|
||||
if (this.runConfig.envMap) {
|
||||
this.runConfig.envMap = objToStrMap(this.runConfig.envMap);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.schedule = {
|
||||
value: '',
|
||||
|
@ -257,7 +397,7 @@ export default {
|
|||
let formCronValue = this.form.cronValue;
|
||||
this.schedule.value = formCronValue;
|
||||
this.saveSchedule();
|
||||
this.dialogVisible = false;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -275,6 +415,13 @@ export default {
|
|||
if (!param.workspaceId) {
|
||||
param.workspaceId = getCurrentWorkspaceId();
|
||||
}
|
||||
if (this.schedule.enable) {
|
||||
if ((this.runConfig.environmentType === 'JSON' && Object.keys(this.runConfig.envMap).length === 0) || (this.runConfig.environmentType === 'GROUP' && !this.runConfig.environmentGroupId)) {
|
||||
this.$warning(this.$t('workspace.env_group.please_select_env_for_current_scenario'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
param.config = JSON.stringify(this.runConfig);
|
||||
let url = '/api/automation/schedule/create';
|
||||
if (this.scheduleTaskType === "TEST_PLAN_TEST") {
|
||||
param.scheduleFrom = "testPlan";
|
||||
|
@ -301,6 +448,7 @@ export default {
|
|||
this.$success(this.$t('commons.save_success'));
|
||||
this.$emit("refreshTable");
|
||||
});
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
checkScheduleEdit() {
|
||||
if (this.create) {
|
||||
|
@ -357,7 +505,36 @@ export default {
|
|||
.el-form-item {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
>>> .el-form-item__error {
|
||||
margin-left: 148px;
|
||||
}
|
||||
|
||||
.ms-mode-span {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.head {
|
||||
border-bottom: 1px solid #7C3985;
|
||||
color: #7C3985;
|
||||
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/deep/ .el-link {
|
||||
/* display: -webkit-inline-box; */
|
||||
/* display: inline-flex; */
|
||||
}
|
||||
|
||||
.ms-mode-div {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.ms-mode-span-label:before {
|
||||
content: '*';
|
||||
color: #F56C6C;
|
||||
margin-right: 4px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -13,31 +13,31 @@
|
|||
</div>
|
||||
<span>{{ $t('schedule.edit_timer_task') }}</span>
|
||||
<el-form :model="form" :rules="rules" ref="from" style="padding-top: 10px;margin-left: 20px;">
|
||||
<el-form-item :label="$t('commons.schedule_switch')">
|
||||
<el-form-item :label="$t('commons.schedule_cron_title')"
|
||||
prop="cronValue">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="18">
|
||||
<el-col :span="16">
|
||||
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
|
||||
:placeholder="$t('schedule.please_input_cron_expression')" size="mini">
|
||||
<a :disabled="isReadOnly" type="primary" @click="showCronDialog" slot="suffix" class="head">
|
||||
{{ $t('schedule.generate_expression') }}
|
||||
</a>
|
||||
</el-input>
|
||||
|
||||
<span>{{ this.$t('commons.schedule_switch') }}</span>
|
||||
<el-tooltip effect="dark" placement="bottom"
|
||||
:content="schedule.enable ? $t('commons.close_schedule') : $t('commons.open_schedule')">
|
||||
<el-switch v-model="schedule.enable"></el-switch>
|
||||
<el-switch v-model="schedule.enable" style="margin-left: 20px"></el-switch>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button :disabled="isReadOnly" type="primary" @click="saveCron">{{
|
||||
<el-col :span="4">
|
||||
<el-button :disabled="isReadOnly" type="primary" @click="saveCron" size="mini">{{
|
||||
$t('commons.save')
|
||||
}}
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.schedule_cron_title')"
|
||||
prop="cronValue">
|
||||
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
|
||||
:placeholder="$t('schedule.please_input_cron_expression')"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-link :disabled="isReadOnly" type="primary" @click="showCronDialog">
|
||||
{{ $t('schedule.generate_expression') }}
|
||||
</el-link>
|
||||
|
||||
</el-form-item>
|
||||
<crontab-result :ex="form.cronValue" ref="crontabResult"/>
|
||||
</el-form>
|
||||
|
@ -46,9 +46,22 @@
|
|||
<div class="el-step__icon-inner">2</div>
|
||||
</div>
|
||||
<span>{{ $t('load_test.runtime_config') }}</span>
|
||||
<div style="padding-top: 10px;">
|
||||
<div style="margin-bottom: 10px; margin-top: 10px; ">
|
||||
<span class="ms-mode-span">{{ $t("commons.environment") }}:</span>
|
||||
<env-popover :project-ids="projectIds"
|
||||
:placement="'bottom-start'"
|
||||
:project-list="projectList"
|
||||
:env-map="runConfig.envMap"
|
||||
:environment-type.sync="runConfig.environmentType"
|
||||
:group-id="runConfig.environmentGroupId"
|
||||
@setEnvGroup="setEnvGroup"
|
||||
@setProjectEnvMap="setProjectEnvMap"
|
||||
@showPopover="showPopover"
|
||||
ref="envPopover" class="env-popover"/>
|
||||
</div>
|
||||
<div>
|
||||
<span class="ms-mode-span">{{ $t("run_mode.title") }}:</span>
|
||||
<el-radio-group v-model="runConfig.mode">
|
||||
<el-radio-group v-model="runConfig.mode" @change="changeMode">
|
||||
<el-radio label="serial">{{ $t("run_mode.serial") }}</el-radio>
|
||||
<el-radio label="parallel">{{ $t("run_mode.parallel") }}</el-radio>
|
||||
</el-radio-group>
|
||||
|
@ -56,13 +69,13 @@
|
|||
<div class="ms-mode-div" v-if="runConfig.mode === 'serial'">
|
||||
<el-row>
|
||||
<el-col :span="3">
|
||||
<span class="ms-mode-span">{{ $t("run_mode.other_config") }}:</span>
|
||||
<span class="ms-mode-span">{{ $t("run_mode.other_config") }}:</span>
|
||||
</el-col>
|
||||
<el-col :span="18">
|
||||
<div>
|
||||
<el-checkbox v-model="runConfig.onSampleError">{{ $t("api_test.fail_to_stop") }}</el-checkbox>
|
||||
</div>
|
||||
<div v-if="scheduleTaskType === 'TEST_PLAN_TEST'" style="padding-top: 10px">
|
||||
<div v-if="testType === 'API'" style="padding-top: 10px">
|
||||
<el-checkbox v-model="runConfig.runWithinResourcePool" style="padding-right: 10px;">
|
||||
{{ $t('run_mode.run_with_resource_pool') }}
|
||||
</el-checkbox>
|
||||
|
@ -72,7 +85,6 @@
|
|||
v-for="item in resourcePools"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:disabled="!item.api"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
@ -83,10 +95,10 @@
|
|||
<div class="ms-mode-div" v-if="runConfig.mode === 'parallel'">
|
||||
<el-row>
|
||||
<el-col :span="3">
|
||||
<span class="ms-mode-span">{{ $t("run_mode.other_config") }}:</span>
|
||||
<span class="ms-mode-span">{{ $t("run_mode.other_config") }}:</span>
|
||||
</el-col>
|
||||
<el-col :span="18">
|
||||
<div v-if="scheduleTaskType === 'TEST_PLAN_TEST'" style="padding-top: 10px">
|
||||
<div v-if="testType === 'API'">
|
||||
<el-checkbox v-model="runConfig.runWithinResourcePool" style="padding-right: 10px;">
|
||||
{{ $t('run_mode.run_with_resource_pool') }}
|
||||
</el-checkbox>
|
||||
|
@ -125,14 +137,16 @@ import {
|
|||
getCurrentProjectID,
|
||||
getCurrentUser,
|
||||
getCurrentWorkspaceId,
|
||||
listenGoBack,
|
||||
removeGoBackListener
|
||||
listenGoBack, objToStrMap,
|
||||
removeGoBackListener, strMapToObj
|
||||
} from "@/common/js/utils";
|
||||
import Crontab from "@/business/components/common/cron/Crontab";
|
||||
import CrontabResult from "@/business/components/common/cron/CrontabResult";
|
||||
import {cronValidate} from "@/common/js/cron";
|
||||
import MsScheduleNotification from "./ScheduleNotification";
|
||||
import ScheduleSwitch from "@/business/components/api/automation/schedule/ScheduleSwitch";
|
||||
import EnvPopover from "@/business/components/api/automation/scenario/EnvPopover";
|
||||
import {ENV_TYPE} from "@/common/js/constants";
|
||||
|
||||
function defaultCustomValidate() {
|
||||
return {pass: true};
|
||||
|
@ -149,7 +163,8 @@ export default {
|
|||
ScheduleSwitch,
|
||||
Crontab,
|
||||
MsScheduleNotification,
|
||||
"NoticeTemplate": noticeTemplate.default
|
||||
"NoticeTemplate": noticeTemplate.default,
|
||||
EnvPopover
|
||||
},
|
||||
|
||||
props: {
|
||||
|
@ -161,6 +176,8 @@ export default {
|
|||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
planCaseIds: [],
|
||||
type: String
|
||||
},
|
||||
|
||||
|
||||
|
@ -217,7 +234,14 @@ export default {
|
|||
onSampleError: false,
|
||||
runWithinResourcePool: false,
|
||||
resourcePoolId: null,
|
||||
envMap: new Map,
|
||||
environmentGroupId: "",
|
||||
environmentType: ENV_TYPE.JSON
|
||||
},
|
||||
projectList: [],
|
||||
testType: 'API',
|
||||
planId: String,
|
||||
projectIds: new Set(),
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
@ -276,6 +300,7 @@ export default {
|
|||
return param;
|
||||
},
|
||||
open(row) {
|
||||
this.planId = row.id;
|
||||
//测试计划页面跳转来的
|
||||
let paramTestId = "";
|
||||
this.paramRow = row;
|
||||
|
@ -294,6 +319,8 @@ export default {
|
|||
listenGoBack(this.close);
|
||||
this.activeName = 'first';
|
||||
this.getResourcePools();
|
||||
this.getWsProjects();
|
||||
this.runConfig.environmentType = ENV_TYPE.JSON;
|
||||
},
|
||||
findSchedule() {
|
||||
let scheduleResourceID = this.testId;
|
||||
|
@ -303,6 +330,9 @@ export default {
|
|||
this.schedule = response.data;
|
||||
if (response.data.config) {
|
||||
this.runConfig = JSON.parse(response.data.config);
|
||||
if (this.runConfig.envMap) {
|
||||
this.runConfig.envMap = objToStrMap(this.runConfig.envMap);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.schedule = {
|
||||
|
@ -337,7 +367,6 @@ export default {
|
|||
let formCronValue = this.form.cronValue;
|
||||
this.schedule.value = formCronValue;
|
||||
this.saveSchedule();
|
||||
this.dialogVisible = false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -375,6 +404,7 @@ export default {
|
|||
this.$success(this.$t('commons.save_success'));
|
||||
this.$emit("refreshTable");
|
||||
});
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
checkScheduleEdit() {
|
||||
if (this.create) {
|
||||
|
@ -422,6 +452,46 @@ export default {
|
|||
this.resourcePools = response.data;
|
||||
});
|
||||
},
|
||||
changeMode() {
|
||||
this.runConfig.onSampleError = false;
|
||||
this.runConfig.runWithinResourcePool = false;
|
||||
this.runConfig.resourcePoolId = null;
|
||||
},
|
||||
setProjectEnvMap(projectEnvMap) {
|
||||
this.runConfig.envMap = strMapToObj(projectEnvMap);
|
||||
},
|
||||
setEnvGroup(id) {
|
||||
this.runConfig.environmentGroupId = id;
|
||||
},
|
||||
getWsProjects() {
|
||||
this.$get("/project/getOwnerProjects", res => {
|
||||
this.projectList = res.data;
|
||||
})
|
||||
},
|
||||
showPopover() {
|
||||
this.projectIds.clear();
|
||||
let param = undefined;
|
||||
let url = "";
|
||||
if (this.type === 'apiCase') {
|
||||
url = '/test/plan/api/case/env';
|
||||
param = this.planCaseIds;
|
||||
} else if (this.type === 'apiScenario') {
|
||||
url = '/test/plan/api/scenario/env';
|
||||
param = this.planCaseIds;
|
||||
} else if (this.type === 'plan') {
|
||||
url = '/test/plan/case/env';
|
||||
param = {id: this.planId};
|
||||
}
|
||||
this.$post(url, param, res => {
|
||||
let data = res.data;
|
||||
if (data) {
|
||||
for (let d in data) {
|
||||
this.projectIds.add(d);
|
||||
}
|
||||
}
|
||||
this.$refs.envPopover.openEnvSelect();
|
||||
});
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isTesterPermission() {
|
||||
|
@ -450,7 +520,22 @@ export default {
|
|||
.ms-mode-div {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
>>> .el-form-item__error {
|
||||
margin-left: 148px;
|
||||
}
|
||||
|
||||
.head {
|
||||
border-bottom: 1px solid #7C3985;
|
||||
color: #7C3985;
|
||||
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
>>> .el-link {
|
||||
/* display: -webkit-inline-box; */
|
||||
/* display: inline-flex; */
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -310,7 +310,8 @@
|
|||
:with-tip="enableDeleteTip">
|
||||
{{ $t('test_track.plan.plan_delete_tip') }}
|
||||
</ms-delete-confirm>
|
||||
<ms-test-plan-schedule-maintain ref="scheduleMaintain" @refreshTable="initTableData"/>
|
||||
<ms-test-plan-schedule-maintain ref="scheduleMaintain" @refreshTable="initTableData" :plan-case-ids="[]"
|
||||
:type="'plan'"/>
|
||||
<ms-test-plan-schedule-batch-switch ref="scheduleBatchSwitch" @refresh="refresh"/>
|
||||
<plan-run-mode-with-env @handleRunBatch="_handleRun" ref="runMode" :plan-case-ids="[]" :type="'plan'"
|
||||
:plan-id="currentPlanId"/>
|
||||
|
|
|
@ -603,6 +603,7 @@ export default {
|
|||
env_list: "Environment List",
|
||||
confirm: "Confirm",
|
||||
please_select_env_for_current_scenario: "please select env for current scenario",
|
||||
please_select_env_for_current_plan: "please select env for current plan",
|
||||
lack_env: "Environment group is missing environment!",
|
||||
lack_necessary_environment: "This environment group lacks the necessary project environment!",
|
||||
available_group: 'available',
|
||||
|
|
|
@ -605,6 +605,7 @@ export default {
|
|||
env_list: "环境列表",
|
||||
confirm: "确 定",
|
||||
please_select_env_for_current_scenario: "请为当前场景选择一个运行环境!",
|
||||
please_select_env_for_current_plan: "请为当前测试计划选择一个运行环境!",
|
||||
lack_env: "环境组缺少环境!",
|
||||
lack_necessary_environment: "此环境组缺少必要的项目环境!",
|
||||
available_group: '可用环境组',
|
||||
|
@ -2524,7 +2525,7 @@ export default {
|
|||
edit_timer_task: "编辑定时任务",
|
||||
task_config: "任务配置",
|
||||
please_input_cron_expression: "请输入 Cron 表达式",
|
||||
generate_expression: "生成表达式",
|
||||
generate_expression: "自动生成",
|
||||
cron_expression_format_error: "Cron 表达式格式错误",
|
||||
cron_expression_interval_short_error: "间隔时间小于 3 分钟, 请避免执行耗时过长的测试",
|
||||
cron: {
|
||||
|
|
|
@ -605,6 +605,7 @@ export default {
|
|||
env_list: "環境列表",
|
||||
confirm: "確 定",
|
||||
please_select_env_for_current_scenario: "請為當前場景選擇一個運行環境!",
|
||||
please_select_env_for_current_plan: "請為當前测试计划選擇一個運行環境!",
|
||||
lack_env: "環境組缺少環境!",
|
||||
lack_necessary_environment: "此環境組缺少必要的項目環境!",
|
||||
available_group: '可用環境組',
|
||||
|
@ -2523,7 +2524,7 @@ export default {
|
|||
edit_timer_task: "編輯定時任務",
|
||||
task_config: "任務配置",
|
||||
please_input_cron_expression: "請輸入 Cron 表達式",
|
||||
generate_expression: "生成表達式",
|
||||
generate_expression: "自动生成",
|
||||
cron_expression_format_error: "Cron 表達式格式錯誤",
|
||||
cron_expression_interval_short_error: "間隔時間小於 3 分鐘, 請避免執行耗時過長的測試",
|
||||
cron: {
|
||||
|
|
Loading…
Reference in New Issue